opener-polarity-tagger 3.2.6 → 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a550043e18b17f1e12fd9466f5eee1dd2f806f97f38fe4b0e51e6ac4c5dd6ff1
4
- data.tar.gz: ec57806e4fa7559082aeccf9bb0e1492ef77d93f86d411549f5513282e10ce64
3
+ metadata.gz: e46a3cf60d76757018619e73dca7629c175c2bf091c3291b2935ef0826e7a08a
4
+ data.tar.gz: 0bb5b5ac8d605478791314260d6bd1a7d709722e1598a354236a62dd5741b0b0
5
5
  SHA512:
6
- metadata.gz: 1b53a75fccce4af956ab6b334406896ce6489967067e9abc1b529eb2ece9a1dbe167e8a567e6f938292d945a0e174d1c0b79305ce301e477549fd2161a03361c
7
- data.tar.gz: 5b8bd573afe2eb9fb41002e8d62949c890893395d711ad98220df2e159220d54caac8d70f5c5134898e821213ea6c05e1d1b226a4c50336361fc33f528b6cdb7
6
+ metadata.gz: f6759038cb51cfef7aa1dd14aef0d8dda9260dc93f0a532fb9dad03bb3d26bfc1c3f60b163f1e77358b9a80862a14aeb4ad8d01a3f1a6b40118d9896a6ef520d
7
+ data.tar.gz: 4bdb95248999e753e29b85ea172fdbea1489925bab48227de3018c46736068c0cd91eefa2867ee6f181bdc09a59a8250df4e445ec80d41b5b3cd216398b80b0d
@@ -18,6 +18,10 @@ module Opener
18
18
  @node.attr :lemma
19
19
  end
20
20
 
21
+ def text
22
+ @node.attr :text
23
+ end
24
+
21
25
  def pos
22
26
  @node.attr :pos
23
27
  end
@@ -1,6 +1,6 @@
1
1
  require_relative 'lexicons_cache'
2
2
  require_relative 'lexicon_map'
3
- require_relative 'kaf/document'
3
+ require_relative '../kaf/document'
4
4
 
5
5
  module Opener
6
6
  class PolarityTagger
@@ -16,33 +16,32 @@ module Opener
16
16
  @ignore_pos = ignore_pos
17
17
  end
18
18
 
19
- def clear_cache lang: nil, environment:
20
- end
21
-
22
19
  def run input, params = {}
23
- @kaf = KAF::Document.from_xml input
20
+ kaf = KAF::Document.from_xml input
24
21
 
25
22
  @cache_keys = params[:cache_keys] ||= {}
26
- @cache_keys.merge! lang: @kaf.language
27
- @map = @kaf.map = CACHE[**@cache_keys].lexicons
23
+ @cache_keys.merge! lang: kaf.language
24
+ @map = kaf.map = CACHE[**@cache_keys].lexicons
28
25
 
29
- raise Opener::Core::UnsupportedLanguageError, @kaf.language if @map.blank?
26
+ raise Opener::Core::UnsupportedLanguageError, kaf.language if @map.blank?
30
27
 
31
- @kaf.terms.each do |t|
28
+ kaf.terms.each do |t|
32
29
  lemma = t.lemma&.downcase
30
+ text = t.text.to_s.downcase
33
31
  pos = if @ignore_pos then nil else t.pos end
34
32
  attrs = Hashie::Mash.new
35
33
 
36
34
  lexicon, polarity_pos = @map.by_polarity lemma, pos
35
+ lexicon, polarity_pos = @map.by_polarity text, pos if lexicon.polarity == 'unknown'
37
36
 
38
37
  if lexicon.polarity != 'unknown'
39
38
  attrs.polarity = lexicon.polarity
40
39
  end
41
- if l = @map.by_negator(lemma)
40
+ if l = @map.by_negator(lemma) || @map.by_negator(text)
42
41
  lexicon, polarity_pos = l, nil
43
42
  attrs.sentiment_modifier = 'shifter'
44
43
  end
45
- if l = @map.by_intensifier(lemma)
44
+ if l = @map.by_intensifier(lemma) || @map.by_intensifier(text)
46
45
  lexicon, polarity_pos = l, nil
47
46
  attrs.sentiment_modifier = 'intensifier'
48
47
  end
@@ -53,9 +52,9 @@ module Opener
53
52
  end
54
53
  end
55
54
 
56
- @kaf.add_linguistic_processor DESC, "#{LAST_EDITED}_#{VERSION}", 'terms'
55
+ kaf.add_linguistic_processor DESC, "#{LAST_EDITED}_#{VERSION}", 'terms'
57
56
 
58
- @kaf.to_xml
57
+ kaf.to_xml
59
58
  end
60
59
 
61
60
  end
@@ -1,7 +1,7 @@
1
1
  module Opener
2
2
  class PolarityTagger
3
3
 
4
- VERSION = '3.2.6'
4
+ VERSION = '3.2.7'
5
5
 
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-polarity-tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.6
4
+ version: 3.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - development@olery.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opener-daemons
@@ -212,12 +212,12 @@ files:
212
212
  - core/poltagger-basic-multi.py
213
213
  - exec/polarity-tagger.rb
214
214
  - ext/hack/Rakefile
215
+ - lib/opener/kaf/document.rb
216
+ - lib/opener/kaf/term.rb
215
217
  - lib/opener/polarity_tagger.rb
216
218
  - lib/opener/polarity_tagger/cli.rb
217
219
  - lib/opener/polarity_tagger/external.rb
218
220
  - lib/opener/polarity_tagger/internal.rb
219
- - lib/opener/polarity_tagger/kaf/document.rb
220
- - lib/opener/polarity_tagger/kaf/term.rb
221
221
  - lib/opener/polarity_tagger/lexicon_map.rb
222
222
  - lib/opener/polarity_tagger/lexicons_cache.rb
223
223
  - lib/opener/polarity_tagger/public/markdown.css