abstractor 2.1.01 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmUyMzBmNjgwNGM2MGZhMjBiMjI2YzQ4ODIyYjM2YzRlMWVlMWM1Yg==
4
+ NGYyMTA2ODY2YWM5ZTgzNzNhM2Y4NmM3ZDBiMDhlZWRmYjcwZmVmYg==
5
5
  data.tar.gz: !binary |-
6
- YmM5ZWE3ZDhhMTY1NzEzMjM0NjQyODEzMzNmNWZmYmU2NTQyYzU1NA==
6
+ YjhkNzBiNTMwMzAzNTQyYWZlNTJmMzgzYjc2ZTcyYjc3NWM0YzcyMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjMwNjNhMGQzNjY4MGQwZThmZDVkZjhiMTBjMWM1NGI1ZmFkMGYzZjFmNWU5
10
- OTgyMzUzMjFiZjE0YjRkMTQwNzdmMzU0NTdmZTQwOTYwOTU5ZWVmNjA0YTk2
11
- NzAwMjNmNWFmMWU2MDdhMzUxOTk5ZjQ2Mzc0MzAzYjhjOTViYjY=
9
+ OGQ3NWMwNmNmYzlkYzgyZjUxNDYyOTg4M2E0MmNjMmFkOTAwMjU1Yzg0YTAz
10
+ NDVmN2Q2MzVmY2VmYWI5MjkwMjZjZDcyN2VlOTYwNmFmZjVhZjFmNzJmZDZi
11
+ NDIzYTA3YTgwY2M4MWU2ZWVjMGU0NTY0NzE4MzUwM2MwZTEyNzg=
12
12
  data.tar.gz: !binary |-
13
- MjZmMjA3MDQ4NDUzZWFlMDA0Mjc1NzcwZmFhOTBiNGUxYjQ4YmY5YzVkNDg2
14
- N2RmYzU0YTg2ZWY2NGEzYjFmYWEzNTdkMjZmMDdkNDkwZDY5OTQ4N2NiNTAy
15
- ZGY4MzRkMGQzZmZkYTY2MDIyNzFhZjBjNjBiNjllZDRhOGM0M2E=
13
+ ZTI0YmIyMDI2N2Q0ODk5ZDdmYzU3YTI0NDUzYTBlZjQ1OTA1OWY4Mjg1OWU1
14
+ MTVmNzQ0YjI2NjQxZmJmODc1MGE4OWU1ZjU1OTA0ZGM5MjJiNzNhNTQxMDBi
15
+ ZWJlZTZiZWJjYjlmYmE0YTRjN2U0NDNmYzQxMWMzOTNmMjYzYmU=
@@ -59,10 +59,12 @@ module Abstractor
59
59
  end
60
60
  end
61
61
 
62
- def detect_abstractor_suggestion(suggested_value)
62
+ def detect_abstractor_suggestion(suggested_value, unknown, not_applicable)
63
63
  abstractor_suggestion = nil
64
64
  abstractor_suggestion = abstractor_suggestions(true).detect do |abstractor_suggestion|
65
- abstractor_suggestion.suggested_value == suggested_value
65
+ abstractor_suggestion.suggested_value == suggested_value &&
66
+ abstractor_suggestion.unknown == unknown &&
67
+ abstractor_suggestion.not_applicable == not_applicable
66
68
  end
67
69
  end
68
70
 
@@ -121,6 +123,12 @@ module Abstractor
121
123
  abstractor_suggestion.save!
122
124
  end
123
125
  end
126
+
127
+ if abstractor_abstraction.abstractor_suggestions.empty?
128
+ abstractor_abstraction.unknown = unknown
129
+ abstractor_abstraction.not_applicable = not_applicable
130
+ abstractor_abstraction.save!
131
+ end
124
132
  end
125
133
  end
126
134
  end
@@ -266,7 +266,7 @@ module Abstractor
266
266
  abstractor_object_value = suggested_value
267
267
  suggested_value = suggested_value.value
268
268
  end
269
- abstractor_suggestion = abstractor_abstraction.detect_abstractor_suggestion(suggested_value) unless suggested_value.nil?
269
+ abstractor_suggestion = abstractor_abstraction.detect_abstractor_suggestion(suggested_value, unknown, not_applicable)
270
270
  if !abstractor_suggestion
271
271
  abstractor_suggestion_status_needs_review = Abstractor::AbstractorSuggestionStatus.where(name: 'Needs review').first
272
272
  abstractor_suggestion = Abstractor::AbstractorSuggestion.create(
@@ -280,7 +280,7 @@ module Abstractor
280
280
  abstractor_suggestion.abstractor_suggestion_object_value = Abstractor::AbstractorSuggestionObjectValue.new(abstractor_object_value: abstractor_object_value) if abstractor_object_value
281
281
  end
282
282
 
283
- abstractor_suggestion_source = abstractor_suggestion.detect_abstractor_suggestion_source(abstractor_abstraction_source, sentence_match_value, source_id, source_type)
283
+ abstractor_suggestion_source = abstractor_suggestion.detect_abstractor_suggestion_source(abstractor_abstraction_source, sentence_match_value, source_id, source_type, source_method)
284
284
  if !abstractor_suggestion_source
285
285
  Abstractor::AbstractorSuggestionSource.create(
286
286
  abstractor_abstraction_source: abstractor_abstraction_source,
@@ -332,7 +332,7 @@ module Abstractor
332
332
  def create_unknown_abstractor_suggestion(about, abstractor_abstraction, abstractor_abstraction_source)
333
333
  #Create an 'unknown' suggestion based on matching nothing only if we have not made a suggstion
334
334
  abstractor_abstraction_source.normalize_from_method_to_sources(about).each do |source|
335
- if abstractor_abstraction.abstractor_suggestions(true).empty?
335
+ if abstractor_abstraction.abstractor_suggestions(true).select { |abstractor_suggestion| abstractor_suggestion.unknown != true }.empty?
336
336
  suggest(abstractor_abstraction, abstractor_abstraction_source, nil, nil, source[:source_id], source[:source_type].to_s, source[:source_method], nil, true, nil, nil, nil)
337
337
  end
338
338
  end
@@ -74,12 +74,13 @@ module Abstractor
74
74
  abstractor_abstraction.abstractor_suggestions.where('id != ?', id)
75
75
  end
76
76
 
77
- def detect_abstractor_suggestion_source(abstractor_abstraction_source, sentence_match_value, source_id, source_type)
77
+ def detect_abstractor_suggestion_source(abstractor_abstraction_source, sentence_match_value, source_id, source_type, source_method)
78
78
  abstractor_suggestion_source = abstractor_suggestion_sources.detect do |abstractor_suggestion_source|
79
79
  abstractor_suggestion_source.abstractor_abstraction_source == abstractor_abstraction_source &&
80
80
  abstractor_suggestion_source.sentence_match_value == sentence_match_value &&
81
81
  abstractor_suggestion_source.source_id == source_id &&
82
- abstractor_suggestion_source.source_type == source_type
82
+ abstractor_suggestion_source.source_type == source_type &&
83
+ abstractor_suggestion_source.source_method == source_method
83
84
  end
84
85
  end
85
86
  end
@@ -1,3 +1,3 @@
1
1
  module Abstractor
2
- VERSION = '2.1.01'
2
+ VERSION = '2.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.01
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Gurley, Yulia Bushmanova
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-04 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails