artemo 3.1.4 → 3.1.5
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 +4 -4
- data/.DS_Store +0 -0
- data/CHANGELOG +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/.DS_Store +0 -0
- data/lib/artemo/basic_emotions.rb +4 -0
- data/lib/artemo/common.rb +1 -1
- data/lib/artemo/complex_emotions.rb +2 -0
- data/lib/artemo/plot.rb +0 -1
- data/lib/artemo/result.rb +9 -6
- data/lib/artemo/version.rb +1 -1
- data/spec/test_artemo_basic_emotions_spec.rb +1 -26
- data/spec/test_artemo_common_spec.rb +1 -1
- data/spec/test_artemo_complex_emotions_spec.rb +0 -15
- data/spec/test_artemo_result_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23724fad07817c5010b8bbcceebeaf53821c9576
|
4
|
+
data.tar.gz: 86b1473a7688193b0702dbc85cc80e026bd9a904
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4ccff9b0ef6501516c7e38815b075a6c2e61efe513bc3af1baf283076fb38039da8a133635b1061a61da141749b7a5d0e0afde34a88c97671efb80095b509c1
|
7
|
+
data.tar.gz: 2a2a13cbd11a294f6901d659ca2c1966fbc1b84d3ca66bafa6ce4422db779685ecfd706f524ea89226d126170ddd32c6b731515315ae7d605483d2a13517c8ce
|
data/.DS_Store
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/.DS_Store
CHANGED
Binary file
|
@@ -18,6 +18,7 @@ class BasicEmotions < Common
|
|
18
18
|
|
19
19
|
# @note This method compare two words, if word is in array text then add one.
|
20
20
|
|
21
|
+
private
|
21
22
|
def self.compare
|
22
23
|
sum_array = Array.new(8).fill(0)
|
23
24
|
@keywords.each.with_index do |line, index|
|
@@ -31,6 +32,7 @@ class BasicEmotions < Common
|
|
31
32
|
# @note This method is after inherited method comparing values in gradient,
|
32
33
|
# and it's checking which value is greater, if it's greater then it is true.
|
33
34
|
|
35
|
+
private
|
34
36
|
def self.check(array_one)
|
35
37
|
values_array = Array.new(8).fill(0)
|
36
38
|
array_one.each_index do |index|
|
@@ -50,6 +52,7 @@ class BasicEmotions < Common
|
|
50
52
|
# @note This method check which value is true and if it's true add two,
|
51
53
|
# else add one.
|
52
54
|
|
55
|
+
private
|
53
56
|
def self.weigh(array_one, array_two)
|
54
57
|
weighed_array = Array.new(8).fill(0)
|
55
58
|
array_one.each.with_index do |item, index|
|
@@ -66,6 +69,7 @@ class BasicEmotions < Common
|
|
66
69
|
|
67
70
|
# @note This method is expanding 8 element array to 24 element array in ranges.
|
68
71
|
|
72
|
+
private
|
69
73
|
def self.expand(array_one)
|
70
74
|
expanded_array = Array.new(24).fill(0)
|
71
75
|
array_one.each.with_index do |item, index|
|
data/lib/artemo/common.rb
CHANGED
@@ -7,7 +7,7 @@ class Common
|
|
7
7
|
def self.scale(array_one)
|
8
8
|
min, max = array_one.minmax
|
9
9
|
array_one.each.with_index do |item, index|
|
10
|
-
array_one[index] = (((100.0 -
|
10
|
+
array_one[index] = (((100.0 - 1.0) / (max - min)) * (item - max) + 100.0).floor
|
11
11
|
end
|
12
12
|
array_one
|
13
13
|
end
|
@@ -12,6 +12,7 @@ class ComplexEmotions < Common
|
|
12
12
|
|
13
13
|
# @note This method is sorting values by pattern x+0, x+8, x+16 then (x*3), (x*3)+1, (x*3)+2.
|
14
14
|
|
15
|
+
private
|
15
16
|
def self.sort(array_one)
|
16
17
|
sorted_array = Array.new(24)
|
17
18
|
tmp_array = Array.new(3)
|
@@ -29,6 +30,7 @@ class ComplexEmotions < Common
|
|
29
30
|
|
30
31
|
# @note This method is summing values if they are greater than 25.
|
31
32
|
|
33
|
+
private
|
32
34
|
def self.sum(array_one)
|
33
35
|
sum_array = Array.new(24).fill(0)
|
34
36
|
index = 0
|
data/lib/artemo/plot.rb
CHANGED
data/lib/artemo/result.rb
CHANGED
@@ -1,26 +1,29 @@
|
|
1
1
|
# @note This class show results
|
2
2
|
# @return [Hash] of sorted complex emotions
|
3
|
-
class Result
|
3
|
+
class Result < Common
|
4
4
|
|
5
5
|
# @note This method initializes all class
|
6
6
|
|
7
7
|
def self.call(array_one)
|
8
|
-
|
8
|
+
scaled = scale(array_one)
|
9
|
+
finish(scaled)
|
9
10
|
end
|
10
11
|
|
11
12
|
# @note This method is showing results.
|
12
|
-
|
13
|
-
|
13
|
+
|
14
|
+
private
|
15
|
+
def self.finish(array_one)
|
14
16
|
results = {}
|
15
|
-
_min, max = array_one.minmax
|
16
17
|
array_one.each_index do |index|
|
17
|
-
results[titles[index]] =
|
18
|
+
results[titles[index]] = array_one[index]
|
18
19
|
end
|
20
|
+
results.delete_if{|_k, v| v == 1 || v == 2}
|
19
21
|
results.sort_by { |_k, v| v }.to_h
|
20
22
|
end
|
21
23
|
|
22
24
|
# @note This method is storing titles of emotions in Array.
|
23
25
|
|
26
|
+
private
|
24
27
|
def self.titles
|
25
28
|
['love', 'guilt', 'delight', 'submission', 'curiosity', 'sentimentality', 'awe', 'despair', 'shame', 'disappointment', 'revulsion', 'outrage', 'remorse', 'envy', 'pessimism', 'contempt', 'cynicism', 'morbidness', 'aggressiveness', 'pride', 'dominance', 'optimism', 'fatalism', 'anxiety']
|
26
29
|
end
|
data/lib/artemo/version.rb
CHANGED
@@ -4,32 +4,7 @@ describe BasicEmotions do
|
|
4
4
|
context 'Basic emotions: ' do
|
5
5
|
it 'call to first method' do
|
6
6
|
be = BasicEmotions.call [['test'], ['test'], ['test'], ['test'], ['test'], ['test'], ['test'], ['test']], ['test']
|
7
|
-
expect(be).to eq [33, 0, 33, 0, 33, 0, 33, 0, 34, 0, 34, 0, 34, 0, 34, 0, 33,
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'check method' do
|
11
|
-
be = BasicEmotions.check([50, 0, 25, 0, 0, 50, 0, 75])
|
12
|
-
expect(be).to eq [true, false, true, false, false, true, false, true]
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'weigh method' do
|
16
|
-
be = BasicEmotions.weigh([50, 25, 25, 12, 25, 50, 35, 75], [true, false, true, false, false, true, false, true])
|
17
|
-
expect(be).to eq [100, 25, 50, 12, 25, 100, 35, 150]
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'scale method' do
|
21
|
-
be = BasicEmotions.scale([100, 25, 50, 12, 25, 100, 35, 150])
|
22
|
-
expect(be).to eq [63, 9, 27, 0, 9, 63, 16, 100]
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'expand method #1' do
|
26
|
-
be = BasicEmotions.expand([63, 9, 27, 0, 9, 63, 16, 100])
|
27
|
-
expect(be).to eq [0, 0, 0, 0, 0, 0, 0, 33, 30, 0, 0, 0, 0, 30, 0, 34, 33, 9, 27, 0, 9, 33, 16, 33]
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'expand method #2' do
|
31
|
-
be = BasicEmotions.expand([100, 100, 0, 0, 0, 0, 0, 0])
|
32
|
-
expect(be).to eq [33, 33, 0, 0, 0, 0, 0, 0, 34, 34, 0, 0, 0, 0, 0, 0, 33, 33, 0, 0, 0, 0, 0, 0]
|
7
|
+
expect(be).to eq [33, 0, 33, 0, 33, 0, 33, 0, 34, 0, 34, 0, 34, 0, 34, 0, 33, 1, 33, 1, 33, 1, 33, 1]
|
33
8
|
end
|
34
9
|
end
|
35
10
|
end
|
@@ -6,20 +6,5 @@ describe ComplexEmotions do
|
|
6
6
|
ce = ComplexEmotions.call [33, 33, 0, 0, 0, 0, 0, 0, 34, 34, 0, 0, 0, 0, 0, 0, 33, 33, 0, 0, 0, 0, 0, 0]
|
7
7
|
expect(ce).to eq [97, 97, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
8
8
|
end
|
9
|
-
|
10
|
-
it 'sort method' do
|
11
|
-
ce = ComplexEmotions.sort [97, 97, 0, 0, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 97, 97, 0, 0, 0, 0, 0, 0]
|
12
|
-
expect(ce).to eq [97, 100, 97, 97, 100, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'sum method #1' do
|
16
|
-
ce = ComplexEmotions.sum [97, 97, 0, 0, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 97, 97, 0, 0, 0, 0, 0, 0]
|
17
|
-
expect(ce).to eq [97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'sum method #2' do
|
21
|
-
ce = ComplexEmotions.sum [100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0]
|
22
|
-
expect(ce).to eq [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 200, 0, 0]
|
23
|
-
end
|
24
9
|
end
|
25
10
|
end
|
@@ -3,21 +3,21 @@ require 'artemo'
|
|
3
3
|
describe Result do
|
4
4
|
context 'Results ' do
|
5
5
|
it 'show love' do
|
6
|
-
s = Result.
|
6
|
+
s = Result.call([100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
7
7
|
sh = s.keys.last
|
8
8
|
expect(sh).to eq "love"
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'show despair' do
|
12
|
-
s = Result.
|
12
|
+
s = Result.call([0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
13
13
|
sh = s.keys.last
|
14
14
|
expect(sh).to eq "despair"
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'min, max' do
|
18
|
-
s = Result.
|
18
|
+
s = Result.call([100, 30, 30, 30, 30, 30, 30, 5, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 700, 30])
|
19
19
|
min, max = s.values.minmax
|
20
|
-
expect(min).to eq 0
|
20
|
+
expect(min).to eq 4.0
|
21
21
|
expect(max).to eq 100.0
|
22
22
|
end
|
23
23
|
end
|