opener-polarity-tagger 3.2.6 → 3.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e46a3cf60d76757018619e73dca7629c175c2bf091c3291b2935ef0826e7a08a
|
4
|
+
data.tar.gz: 0bb5b5ac8d605478791314260d6bd1a7d709722e1598a354236a62dd5741b0b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6759038cb51cfef7aa1dd14aef0d8dda9260dc93f0a532fb9dad03bb3d26bfc1c3f60b163f1e77358b9a80862a14aeb4ad8d01a3f1a6b40118d9896a6ef520d
|
7
|
+
data.tar.gz: 4bdb95248999e753e29b85ea172fdbea1489925bab48227de3018c46736068c0cd91eefa2867ee6f181bdc09a59a8250df4e445ec80d41b5b3cd216398b80b0d
|
File without changes
|
@@ -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
|
-
|
20
|
+
kaf = KAF::Document.from_xml input
|
24
21
|
|
25
22
|
@cache_keys = params[:cache_keys] ||= {}
|
26
|
-
@cache_keys.merge! lang:
|
27
|
-
@map =
|
23
|
+
@cache_keys.merge! lang: kaf.language
|
24
|
+
@map = kaf.map = CACHE[**@cache_keys].lexicons
|
28
25
|
|
29
|
-
raise Opener::Core::UnsupportedLanguageError,
|
26
|
+
raise Opener::Core::UnsupportedLanguageError, kaf.language if @map.blank?
|
30
27
|
|
31
|
-
|
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
|
-
|
55
|
+
kaf.add_linguistic_processor DESC, "#{LAST_EDITED}_#{VERSION}", 'terms'
|
57
56
|
|
58
|
-
|
57
|
+
kaf.to_xml
|
59
58
|
end
|
60
59
|
|
61
60
|
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.
|
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-
|
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
|