afinn 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +1 -1
- data/LICENSE +20 -0
- data/README.md +17 -3
- data/lib/afinn.rb +8 -5
- data/lib/dictionaries/emojis.txt +88 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7fbf8223fc3365d6ef071e275aea8775e77ae35bf3571a29e4155fa2395214b
|
4
|
+
data.tar.gz: 317eb963985ecb9dd2fd02e5b868565fcc5be552329de011347bc2886f74d4d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eedbde62a1a274e5d039e645eb659343d3cc052dd35f6bcb40e28a8cbb148c2cdff4d0805ca9d5aab414a5252b79ae67076d24710a312995dd9f07a19efef96f
|
7
|
+
data.tar.gz: 64b5fef69edb820f3ad9e138c66556c995fb616cf07d9f8b5d27fe9ed5ea1fefffa113b73771b6489c2cb9d07ddf066c2031c9b61ae46537fa729971199b1889
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
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
|
-
*
|
7
|
-
*
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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.
|
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
|