afinn 0.1.0 → 0.1.1

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: 21253857ac7169f67f8046dcb58f812125142c2120b5aeb72328f66164714747
4
- data.tar.gz: 8665dac467c7fdcc2cff7cc0b46cee4c204330c1dfff769b8d61781d8d895e24
3
+ metadata.gz: b7fbf8223fc3365d6ef071e275aea8775e77ae35bf3571a29e4155fa2395214b
4
+ data.tar.gz: 317eb963985ecb9dd2fd02e5b868565fcc5be552329de011347bc2886f74d4d5
5
5
  SHA512:
6
- metadata.gz: aec3baf34e1572d3001f04612b9058754b4440c0643921292962778f1ce88f22cc84b223e95d2c9d9d64d8b2cb5d0439799fc342a5093e01c1dc02ba9d482a73
7
- data.tar.gz: df29fa460a84ab34895ed362e56b3e32ea9685353a298043a7fd4d627ef441cf4b89c7d566a80ebc8510c84109b1752d04f6809b81457099bde8c538fd40cb75
6
+ metadata.gz: eedbde62a1a274e5d039e645eb659343d3cc052dd35f6bcb40e28a8cbb148c2cdff4d0805ca9d5aab414a5252b79ae67076d24710a312995dd9f07a19efef96f
7
+ data.tar.gz: 64b5fef69edb820f3ad9e138c66556c995fb616cf07d9f8b5d27fe9ed5ea1fefffa113b73771b6489c2cb9d07ddf066c2031c9b61ae46537fa729971199b1889
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- ## [Unreleased]
1
+ ## [Released]
2
+ ## [0.1.1] - 2022-02-24
3
+
4
+ - Added emoji support
2
5
 
3
6
  ## [0.1.0] - 2022-02-24
4
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- afinn (0.1.0)
4
+ afinn (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2022 Prograils.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -3,9 +3,10 @@
3
3
  Sentiment analysis in Ruby.
4
4
 
5
5
  Dictionaries included:
6
- * 🇬🇧 English Language
7
- * 🇩🇰 Danish Language
8
- * Emoticions
6
+ * English Language 🇬🇧
7
+ * Danish Language 🇩🇰
8
+ * Emoticions :) :/ :(
9
+ * Emojis 🤣 🤤 👿
9
10
 
10
11
  ## Installation
11
12
 
@@ -36,6 +37,19 @@ afinn = Afinn.new(language = :en)
36
37
  afinn.score_to_words("I had a slow puncture that needed attending to and they took care of it very well. Friendly and efficient staff and a clean and tidy work area. Happy to recommend them and will use them in the future.")
37
38
  #=> "Positive"
38
39
  ```
40
+ ## Dictionaries
41
+ The dictionaries used in this repository are from a project by Finn Årup Nielsen:
42
+ https://github.com/fnielsen/afinn/tree/master/afinn/data
43
+
44
+ For more information visit:
45
+ http://corpustext.com/reference/sentiment_afinn.html
46
+
47
+ Paper with supplement: http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6006/pdf/imm6006.pdf
48
+
49
+ ## See also
50
+ * https://github.com/fnielsen/afinn - Sentiment analysis in Python with AFINN word list
51
+ * https://github.com/darenr/afinn - Sentiment analysis in Javascript with AFINN word list
52
+
39
53
 
40
54
  ## Contributing
41
55
 
data/lib/afinn.rb CHANGED
@@ -3,7 +3,8 @@
3
3
  LANGUAGE_TO_FILENAME = {
4
4
  da: "da.txt",
5
5
  en: "en.txt",
6
- emoticons: "emoticons.txt"
6
+ emoticons: "emoticons.txt",
7
+ emojis: "emojis.txt"
7
8
  }.freeze
8
9
 
9
10
  class Afinn
@@ -41,10 +42,12 @@ class Afinn
41
42
  data = read_word_file(full_filename)
42
43
 
43
44
  if emoticons
44
- filename_emoticons = LANGUAGE_TO_FILENAME[:emoticons]
45
- full_filename_emoticons = File.join(__dir__, "dictionaries", filename_emoticons)
46
- emo = read_word_file(full_filename_emoticons)
47
- data = data.merge(emo)
45
+ [:emoticons, :emojis].each do |emoticon|
46
+ filename_emoticons = LANGUAGE_TO_FILENAME[emoticon]
47
+ full_filename_emoticons = File.join(__dir__, "dictionaries", filename_emoticons)
48
+ emo = read_word_file(full_filename_emoticons)
49
+ data = data.merge(emo)
50
+ end
48
51
  end
49
52
  @word_dict = data
50
53
  end
@@ -0,0 +1,88 @@
1
+ 😠 -3
2
+ 😧 -3
3
+ 😲 2
4
+ 😊 2
5
+ 🤡 0
6
+ 😰 -2
7
+ 😖 -2
8
+ 😕 -2
9
+ 🤠 2
10
+ 😢 -2
11
+ 😿 -2
12
+ 😞 -2
13
+ 😥 -1
14
+ 😵 -1
15
+ 🤤 0
16
+ 😑 0
17
+ 🤕 -2
18
+ 🤒 -1
19
+ 😨 -2
20
+ 😳 -2
21
+ 😦 -1
22
+ 😬 -2
23
+ 😁 2
24
+ 😀 2
25
+ 😍 3
26
+ ❤️ 3
27
+ ❤ 3
28
+ ♥ 3
29
+ 😻 3
30
+ 🤗 2
31
+ 😯 -1
32
+ 👿 -4
33
+ 😇 3
34
+ 😂 3
35
+ 😹 3
36
+ 😗 2
37
+ 😽 2
38
+ 😚 2
39
+ 😘 3
40
+ 😙 2
41
+ 😆 1
42
+ 🤥 -2
43
+ 😷 -1
44
+ 🤑 0
45
+ 🤢 -2
46
+ 🤓 -1
47
+ 😐 0
48
+ 😶 0
49
+ 😮 -2
50
+ 😔 -1
51
+ 😣 -2
52
+ 😾 -4
53
+ 😡 -4
54
+ ☺️ 2
55
+ 😌 2
56
+ 🤣 4
57
+ 🙄 -1
58
+ 😱 -3
59
+ 🙀 -3
60
+ 😴 0
61
+ 😪 0
62
+ 🙁 -1
63
+ 🙂 1
64
+ 😄 2
65
+ 😸 2
66
+ 😃 2
67
+ 😺 2
68
+ 😈 -3
69
+ 😏 2
70
+ 😼 2
71
+ 🤧 -2
72
+ 😭 -3
73
+ 😛 1
74
+ 😝 0
75
+ 😜 -1
76
+ 😎 1
77
+ 😓 -1
78
+ 😅 2
79
+ 🤔 -1
80
+ 😫 -2
81
+ 😤 0
82
+ 😒 -2
83
+ 🙃 0
84
+ 😩 -2
85
+ 😉 3
86
+ 😟 -3
87
+ 😋 3
88
+ 🤐 -1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afinn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Polak
@@ -23,10 +23,12 @@ files:
23
23
  - CHANGELOG.md
24
24
  - Gemfile
25
25
  - Gemfile.lock
26
+ - LICENSE
26
27
  - README.md
27
28
  - Rakefile
28
29
  - lib/afinn.rb
29
30
  - lib/dictionaries/da.txt
31
+ - lib/dictionaries/emojis.txt
30
32
  - lib/dictionaries/emoticons.txt
31
33
  - lib/dictionaries/en.txt
32
34
  homepage: https://github.com/prograils/afinn