opener-polarity-tagger 3.2.7 → 3.3.0

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: e46a3cf60d76757018619e73dca7629c175c2bf091c3291b2935ef0826e7a08a
4
- data.tar.gz: 0bb5b5ac8d605478791314260d6bd1a7d709722e1598a354236a62dd5741b0b0
3
+ metadata.gz: dcce63ff8ce9916a2387c5d0f48209b203eacbc3834eedcf3b5b4990084ac1ad
4
+ data.tar.gz: 495e79bfdec921d459ff78e50bdae28a2c6a0a8bc2aed150de27f49a7f99c423
5
5
  SHA512:
6
- metadata.gz: f6759038cb51cfef7aa1dd14aef0d8dda9260dc93f0a532fb9dad03bb3d26bfc1c3f60b163f1e77358b9a80862a14aeb4ad8d01a3f1a6b40118d9896a6ef520d
7
- data.tar.gz: 4bdb95248999e753e29b85ea172fdbea1489925bab48227de3018c46736068c0cd91eefa2867ee6f181bdc09a59a8250df4e445ec80d41b5b3cd216398b80b0d
6
+ metadata.gz: e51288c630084ce9be780b022ae23012337622b6df30de91962f5c73fd2ef32054435247bf850924a40ca723c3fe1a71fc9f688455b1ea5141acf80959fbe37a
7
+ data.tar.gz: e8f00bd36a27aab5242d91e3f350d4da94d2661ef5565590e1793e02eb65075cf7dd789682b2cd0e06cf4b84bb21a5d5671d51f7e9d94ec1748cd1c8012f33ac
@@ -45,9 +45,7 @@ def load_lexicons(language, path=None):
45
45
  def show_lexicons(language, path=None):
46
46
  if path is None:
47
47
  path = __module_dir
48
- #lexicons, default_id, this_folder, folder_per_lang = load_lexicons(language, path)
49
- LexiconSent(language,None,path)
50
-
48
+ lexicons, default_id, this_folder, folder_per_lang = load_lexicons(language, path)
51
49
  print
52
50
  print '#'*30
53
51
  print 'Available lexicons for',language
@@ -31,19 +31,19 @@ module Opener
31
31
  pos = if @ignore_pos then nil else t.pos end
32
32
  attrs = Hashie::Mash.new
33
33
 
34
- lexicon, polarity_pos = @map.by_polarity lemma, pos
35
- lexicon, polarity_pos = @map.by_polarity text, pos if lexicon.polarity == 'unknown'
34
+ # text matching have priority as sometimes
35
+ # the lemma provided by Stanza is a different word
36
+ lexicon, polarity_pos = @map.by_polarity text, pos
37
+ lexicon, polarity_pos = @map.by_polarity lemma, pos if lexicon.polarity == 'unknown'
36
38
 
37
- if lexicon.polarity != 'unknown'
38
- attrs.polarity = lexicon.polarity
39
- end
40
- if l = @map.by_negator(lemma) || @map.by_negator(text)
39
+ if l = @map.by_negator(text) || @map.by_negator(lemma)
41
40
  lexicon, polarity_pos = l, nil
42
41
  attrs.sentiment_modifier = 'shifter'
43
- end
44
- if l = @map.by_intensifier(lemma) || @map.by_intensifier(text)
42
+ elsif l = @map.by_intensifier(text) || @map.by_intensifier(lemma)
45
43
  lexicon, polarity_pos = l, nil
46
44
  attrs.sentiment_modifier = 'intensifier'
45
+ elsif lexicon.polarity != 'unknown'
46
+ attrs.polarity = lexicon.polarity
47
47
  end
48
48
 
49
49
  if attrs.size > 0
@@ -46,13 +46,12 @@ module Opener
46
46
  end
47
47
 
48
48
  def by_polarity lemma, short_pos
49
- return [@with_polarity[lemma+short_pos] || UNKNOWN, short_pos] if short_pos
49
+ l = @with_polarity[lemma+short_pos] if short_pos
50
+ return [l, short_pos] if l
50
51
 
51
52
  POS_ORDER.chars.each do |short_pos|
52
- if l = @with_polarity[lemma+short_pos]
53
- puts "Found polarify #{l.polarity} for #{lemma} with PoS #{short_pos}"
54
- return [l, short_pos]
55
- end
53
+ l = @with_polarity[lemma+short_pos]
54
+ return [l, short_pos] if l
56
55
  end
57
56
 
58
57
  [UNKNOWN, 'unknown']
@@ -1,7 +1,7 @@
1
1
  module Opener
2
2
  class PolarityTagger
3
3
 
4
- VERSION = '3.2.7'
4
+ VERSION = '3.3.0'
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.7
4
+ version: 3.3.0
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-09 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opener-daemons