odyssey 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +17 -0
- data/README.md +15 -4
- data/lib/odyssey.rb +15 -2
- data/lib/{formulas → odyssey/formulas}/ari.rb +1 -1
- data/lib/{formulas → odyssey/formulas}/coleman_liau.rb +1 -1
- data/lib/{formulas → odyssey/formulas}/fake_formula.rb +1 -1
- data/lib/{formulas → odyssey/formulas}/flesch_kincaid_gl.rb +1 -1
- data/lib/{formulas → odyssey/formulas}/flesch_kincaid_re.rb +1 -1
- data/lib/{formulas/_formula.rb → odyssey/formulas/formula.rb} +1 -2
- data/lib/{formulas → odyssey/formulas}/gunning_fog.rb +1 -1
- data/lib/{formulas → odyssey/formulas}/smog.rb +1 -1
- data/lib/odyssey/refinements.rb +9 -0
- data/lib/odyssey/version.rb +1 -1
- data/odyssey.gemspec +8 -9
- data/spec/odyssey/formulas/ari_spec.rb +27 -0
- data/spec/odyssey/formulas/coleman_liau_spec.rb +28 -0
- data/spec/odyssey/formulas/flesch_kincaid_gl_spec.rb +25 -0
- data/spec/odyssey/formulas/flesch_kincaid_re_spec.rb +25 -0
- data/spec/odyssey/formulas/gunning_fog_spec.rb +25 -0
- data/spec/odyssey/formulas/smog_spec.rb +27 -0
- data/spec/odyssey/refinements_spec.rb +14 -0
- data/spec/odyssey_spec.rb +37 -152
- data/spec/spec_helper.rb +2 -1
- metadata +40 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f8e415094592c3db8e4c7ef95471e8a8d9fe974e6082a68ca1aee14741859d78
|
4
|
+
data.tar.gz: 2706164618acba8b59271b8edcef213fade62ec9da2d1b94b815db807f58adba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b194aa3f7a798a6decd7a9998e9b8c0e4c04ae7a8f8547c32ae8a7cce7102c3346528d2dfa38e1ea1acc4f888559d99f644aded4afc78fd67f0947e56064e2a
|
7
|
+
data.tar.gz: 2f041bbe7cbd458bcc75625eafe527bd9776df99c20b3774f4158c04d4aca9db969e385f74d3e7769bca2831eb47e8feeed5e90bc59ddb6eab9a5c9573e06635
|
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
dist: bionic # Ubuntu 18.04
|
4
|
+
|
5
|
+
# Test against all Ruby-supported versions
|
6
|
+
#
|
7
|
+
# See https://www.ruby-lang.org/en/downloads/branches/
|
8
|
+
rvm:
|
9
|
+
- 2.4
|
10
|
+
- 2.5
|
11
|
+
- 2.6
|
12
|
+
|
13
|
+
script: |
|
14
|
+
bundle exec rake spec
|
15
|
+
|
16
|
+
notifications:
|
17
|
+
email: false
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Odyssey
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/odyssey.svg)](https://badge.fury.io/rb/odyssey)
|
4
|
+
[![Build Status](https://travis-ci.org/cameronsutter/odyssey.svg?branch=master)](https://travis-ci.org/cameronsutter/odyssey)
|
5
|
+
|
3
6
|
Odyssey is an extendible text analyzing gem that outputs the readability score of text. It has several of the common readability formulas available, but defaults to the Flesch-Kincaid Reading Ease score.
|
4
7
|
|
5
8
|
## Installation
|
@@ -26,7 +29,7 @@ Example:
|
|
26
29
|
|
27
30
|
Odyssey.flesch_kincaid_re("See Spot run.", true)
|
28
31
|
|
29
|
-
if all_stats is false, this returns a simple score. If it is true, it returns a Hash:
|
32
|
+
if `all_stats` is false, this returns a simple score. If it is true, it returns a Hash:
|
30
33
|
|
31
34
|
|
32
35
|
{
|
@@ -70,14 +73,22 @@ if all_stats is true, this returns a Hash, similar to the Hash above:
|
|
70
73
|
'average_syllables_per_word' => Float
|
71
74
|
}
|
72
75
|
|
76
|
+
In order to get all stats and scores, you can use this shortcut:
|
77
|
+
|
78
|
+
Odyssey.analyze_all(text)
|
79
|
+
|
80
|
+
or, using `Odyssey::Refinements`:
|
81
|
+
|
82
|
+
using Odyssey::Refinements
|
83
|
+
text.readability
|
84
|
+
|
73
85
|
## Extending Odyssey
|
74
86
|
|
75
|
-
To extend Odyssey, you can create a class that inherits from Formula
|
87
|
+
To extend Odyssey, you can create a class that inherits from `Odyssey::Formula`.
|
76
88
|
|
77
|
-
class CoolNewFormula < Formula
|
89
|
+
class CoolNewFormula < Odyssey::Formula
|
78
90
|
|
79
91
|
def score(text, stats)
|
80
|
-
|
81
92
|
end
|
82
93
|
|
83
94
|
def name
|
data/lib/odyssey.rb
CHANGED
@@ -44,6 +44,11 @@ module Odyssey
|
|
44
44
|
output
|
45
45
|
end
|
46
46
|
|
47
|
+
def self.analyze_all(text)
|
48
|
+
formulas = %w[Ari ColemanLiau FleschKincaidGl FleschKincaidRe GunningFog Smog]
|
49
|
+
analyze_multi text, formulas, true
|
50
|
+
end
|
51
|
+
|
47
52
|
#run whatever method was given as if it were a shortcut to a formula
|
48
53
|
def self.method_missing(method_name, *args, &block)
|
49
54
|
#send to the main method
|
@@ -58,6 +63,14 @@ module Odyssey
|
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
61
|
-
require 'require_all'
|
62
66
|
require 'odyssey/engine'
|
63
|
-
|
67
|
+
require 'odyssey/refinements'
|
68
|
+
require 'odyssey/formulas/formula'
|
69
|
+
|
70
|
+
require 'odyssey/formulas/ari'
|
71
|
+
require 'odyssey/formulas/coleman_liau'
|
72
|
+
require 'odyssey/formulas/fake_formula'
|
73
|
+
require 'odyssey/formulas/flesch_kincaid_gl'
|
74
|
+
require 'odyssey/formulas/flesch_kincaid_re'
|
75
|
+
require 'odyssey/formulas/gunning_fog'
|
76
|
+
require 'odyssey/formulas/smog'
|
data/lib/odyssey/version.rb
CHANGED
data/odyssey.gemspec
CHANGED
@@ -6,22 +6,21 @@ require 'odyssey/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "odyssey"
|
8
8
|
spec.version = Odyssey::VERSION
|
9
|
-
spec.authors = ["Cameron Sutter"
|
10
|
-
spec.email = ["cameronsutter0@gmail.com"
|
11
|
-
spec.description = %q{Odyssey is an
|
9
|
+
spec.authors = ["Cameron Sutter"]
|
10
|
+
spec.email = ["cameronsutter0@gmail.com"]
|
11
|
+
spec.description = %q{Odyssey is an extendable text analysis gem that outputs the readability score of text. It has several of the common readability formulas available, but defaults to the Flesch-Kincaid Reading Ease score.}
|
12
12
|
spec.summary = %q{Text readability analyzer using Flesch-Kincaid and others}
|
13
13
|
spec.homepage = "https://github.com/cameronsutter/odyssey"
|
14
14
|
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.add_dependency "require_all", "~> 2.0"
|
15
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
17
16
|
|
18
17
|
spec.files = `git ls-files`.split($/)
|
19
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
20
|
spec.require_paths = ["lib"]
|
22
21
|
|
23
|
-
spec.add_development_dependency "bundler"
|
24
|
-
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "rspec"
|
26
|
-
spec.add_development_dependency "pry"
|
22
|
+
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "pry"
|
27
26
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
context 'Automated Readability Index' do
|
4
|
+
|
5
|
+
describe 'get score' do
|
6
|
+
before :all do
|
7
|
+
@simple = Odyssey.ari one_simple_sentence
|
8
|
+
@double = Odyssey.ari two_simple_sentences
|
9
|
+
@complex = Odyssey.ari one_complex_sentence
|
10
|
+
@complex_double = Odyssey.ari two_complex_sentences
|
11
|
+
@very_complex = Odyssey.ari very_complex
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should return something' do
|
15
|
+
@simple.should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return the score' do
|
19
|
+
@simple.should == -4.2
|
20
|
+
@double.should == -3.4
|
21
|
+
@complex.should == 1.4
|
22
|
+
@complex_double.should == 2.8
|
23
|
+
@very_complex.should == 12.1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
context 'Coleman-Liau Index' do
|
4
|
+
|
5
|
+
describe 'get score' do
|
6
|
+
before :all do
|
7
|
+
@simple = Odyssey.coleman_liau one_simple_sentence
|
8
|
+
@double = Odyssey.coleman_liau two_simple_sentences
|
9
|
+
@complex = Odyssey.coleman_liau one_complex_sentence
|
10
|
+
@complex_double = Odyssey.coleman_liau two_complex_sentences
|
11
|
+
@very_complex = Odyssey.coleman_liau very_complex
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should return something' do
|
15
|
+
@simple.should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return the score' do
|
19
|
+
@simple.should == 3.7
|
20
|
+
@double.should == 4.7
|
21
|
+
@complex.should == 7.1
|
22
|
+
@complex_double.should == 9.1
|
23
|
+
@very_complex.should == 10.7
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
context 'Flesch-Kincaid Grade Level' do
|
4
|
+
|
5
|
+
describe 'get score' do
|
6
|
+
before :all do
|
7
|
+
@simple = Odyssey.flesch_kincaid_gl one_simple_sentence
|
8
|
+
@double = Odyssey.flesch_kincaid_gl two_simple_sentences
|
9
|
+
@complex = Odyssey.flesch_kincaid_gl one_complex_sentence
|
10
|
+
@complex_double = Odyssey.flesch_kincaid_gl two_complex_sentences
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return something' do
|
14
|
+
@simple.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should return the score' do
|
18
|
+
@simple.should == -2.6
|
19
|
+
@double.should == -2.6
|
20
|
+
@complex.should == 2.3
|
21
|
+
@complex_double.should == 3
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
context 'Flesch-Kincaid Reading Ease' do
|
4
|
+
|
5
|
+
describe 'get score' do
|
6
|
+
before :all do
|
7
|
+
@simple = Odyssey.flesch_kincaid_re one_simple_sentence
|
8
|
+
@double = Odyssey.flesch_kincaid_re two_simple_sentences
|
9
|
+
@complex = Odyssey.flesch_kincaid_re one_complex_sentence
|
10
|
+
@complex_double = Odyssey.flesch_kincaid_re two_complex_sentences
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return something' do
|
14
|
+
@simple.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should return the score' do
|
18
|
+
@simple.should == 119.2
|
19
|
+
@double.should == 119.2
|
20
|
+
@complex.should == 94.3
|
21
|
+
@complex_double.should == 88.7
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
context 'Gunning-Fog Score' do
|
4
|
+
|
5
|
+
describe 'get score' do
|
6
|
+
before :all do
|
7
|
+
@simple = Odyssey.gunning_fog one_simple_sentence
|
8
|
+
@double = Odyssey.gunning_fog two_simple_sentences
|
9
|
+
@complex = Odyssey.gunning_fog one_complex_sentence
|
10
|
+
@complex_double = Odyssey.gunning_fog two_complex_sentences
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should return something' do
|
14
|
+
@simple.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should return the score' do
|
18
|
+
@simple.should == 1.2
|
19
|
+
@double.should == 1.2
|
20
|
+
@complex.should == 3.6
|
21
|
+
@complex_double.should == 3.4
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
context 'SMOG Index' do
|
4
|
+
|
5
|
+
describe 'get score' do
|
6
|
+
before :all do
|
7
|
+
@simple = Odyssey.smog one_simple_sentence
|
8
|
+
@double = Odyssey.smog two_simple_sentences
|
9
|
+
@complex = Odyssey.smog one_complex_sentence
|
10
|
+
@complex_double = Odyssey.smog two_complex_sentences
|
11
|
+
@very_complex = Odyssey.smog very_complex
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should return something' do
|
15
|
+
@simple.should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return the score' do
|
19
|
+
# @simple.should == 1.8
|
20
|
+
# @double.should == 1.8
|
21
|
+
# @complex.should == 1.8
|
22
|
+
# @complex_double.should == 1.8
|
23
|
+
# @very_complex.should == 10.1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
using Odyssey::Refinements
|
4
|
+
|
5
|
+
describe Odyssey::Refinements do
|
6
|
+
describe String do
|
7
|
+
describe '#readability' do
|
8
|
+
it "calls Odyssey#analyze_all" do
|
9
|
+
expect(Odyssey).to receive(:analyze_all).with(one_simple_sentence)
|
10
|
+
one_simple_sentence.readability
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/odyssey_spec.rb
CHANGED
@@ -65,156 +65,6 @@ describe Odyssey do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
context 'Flesch-Kincaid Reading Ease' do
|
69
|
-
|
70
|
-
describe 'get score' do
|
71
|
-
before :all do
|
72
|
-
@simple = Odyssey.flesch_kincaid_re one_simple_sentence
|
73
|
-
@double = Odyssey.flesch_kincaid_re two_simple_sentences
|
74
|
-
@complex = Odyssey.flesch_kincaid_re one_complex_sentence
|
75
|
-
@complex_double = Odyssey.flesch_kincaid_re two_complex_sentences
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'should return something' do
|
79
|
-
@simple.should_not be_nil
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'should return the score' do
|
83
|
-
@simple.should == 119.2
|
84
|
-
@double.should == 119.2
|
85
|
-
@complex.should == 94.3
|
86
|
-
@complex_double.should == 88.7
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'Flesch-Kincaid Grade Level' do
|
93
|
-
|
94
|
-
describe 'get score' do
|
95
|
-
before :all do
|
96
|
-
@simple = Odyssey.flesch_kincaid_gl one_simple_sentence
|
97
|
-
@double = Odyssey.flesch_kincaid_gl two_simple_sentences
|
98
|
-
@complex = Odyssey.flesch_kincaid_gl one_complex_sentence
|
99
|
-
@complex_double = Odyssey.flesch_kincaid_gl two_complex_sentences
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'should return something' do
|
103
|
-
@simple.should_not be_nil
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'should return the score' do
|
107
|
-
@simple.should == -2.6
|
108
|
-
@double.should == -2.6
|
109
|
-
@complex.should == 2.3
|
110
|
-
@complex_double.should == 3
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
context 'Gunning-Fog Score' do
|
117
|
-
|
118
|
-
describe 'get score' do
|
119
|
-
before :all do
|
120
|
-
@simple = Odyssey.gunning_fog one_simple_sentence
|
121
|
-
@double = Odyssey.gunning_fog two_simple_sentences
|
122
|
-
@complex = Odyssey.gunning_fog one_complex_sentence
|
123
|
-
@complex_double = Odyssey.gunning_fog two_complex_sentences
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'should return something' do
|
127
|
-
@simple.should_not be_nil
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'should return the score' do
|
131
|
-
@simple.should == 1.2
|
132
|
-
@double.should == 1.2
|
133
|
-
@complex.should == 3.6
|
134
|
-
@complex_double.should == 3.4
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
context 'Coleman-Liau Index' do
|
141
|
-
|
142
|
-
describe 'get score' do
|
143
|
-
before :all do
|
144
|
-
@simple = Odyssey.coleman_liau one_simple_sentence
|
145
|
-
@double = Odyssey.coleman_liau two_simple_sentences
|
146
|
-
@complex = Odyssey.coleman_liau one_complex_sentence
|
147
|
-
@complex_double = Odyssey.coleman_liau two_complex_sentences
|
148
|
-
@very_complex = Odyssey.coleman_liau very_complex
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'should return something' do
|
152
|
-
@simple.should_not be_nil
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'should return the score' do
|
156
|
-
@simple.should == 3.7
|
157
|
-
@double.should == 4.7
|
158
|
-
@complex.should == 7.1
|
159
|
-
@complex_double.should == 9.1
|
160
|
-
@very_complex.should == 10.7
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
end
|
165
|
-
|
166
|
-
context 'SMOG Index' do
|
167
|
-
|
168
|
-
describe 'get score' do
|
169
|
-
before :all do
|
170
|
-
@simple = Odyssey.smog one_simple_sentence
|
171
|
-
@double = Odyssey.smog two_simple_sentences
|
172
|
-
@complex = Odyssey.smog one_complex_sentence
|
173
|
-
@complex_double = Odyssey.smog two_complex_sentences
|
174
|
-
@very_complex = Odyssey.smog very_complex
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'should return something' do
|
178
|
-
@simple.should_not be_nil
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'should return the score' do
|
182
|
-
# @simple.should == 1.8
|
183
|
-
# @double.should == 1.8
|
184
|
-
# @complex.should == 1.8
|
185
|
-
# @complex_double.should == 1.8
|
186
|
-
# @very_complex.should == 10.1
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
end
|
191
|
-
|
192
|
-
context 'Automated Readability Index' do
|
193
|
-
|
194
|
-
describe 'get score' do
|
195
|
-
before :all do
|
196
|
-
@simple = Odyssey.ari one_simple_sentence
|
197
|
-
@double = Odyssey.ari two_simple_sentences
|
198
|
-
@complex = Odyssey.ari one_complex_sentence
|
199
|
-
@complex_double = Odyssey.ari two_complex_sentences
|
200
|
-
@very_complex = Odyssey.ari very_complex
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'should return something' do
|
204
|
-
@simple.should_not be_nil
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'should return the score' do
|
208
|
-
@simple.should == -4.2
|
209
|
-
@double.should == -3.4
|
210
|
-
@complex.should == 1.4
|
211
|
-
@complex_double.should == 2.8
|
212
|
-
@very_complex.should == 12.1
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
end
|
217
|
-
|
218
68
|
context 'Run multiple formulas' do
|
219
69
|
|
220
70
|
describe 'get scores' do
|
@@ -264,13 +114,48 @@ describe Odyssey do
|
|
264
114
|
@simple_stats['formula'].should be_nil
|
265
115
|
@simple_stats['score'].should be_nil
|
266
116
|
end
|
267
|
-
|
268
117
|
end
|
269
118
|
|
270
119
|
it 'should raise an error for empty formula list' do
|
271
|
-
expect { Odyssey.analyze_multi one_simple_sentence, []}.to raise_error(ArgumentError)
|
120
|
+
expect { Odyssey.analyze_multi one_simple_sentence, [] }.to raise_error(ArgumentError)
|
272
121
|
end
|
122
|
+
end
|
273
123
|
|
124
|
+
context 'Run all formulas' do
|
125
|
+
describe 'get scores' do
|
126
|
+
let :analyze_all do
|
127
|
+
{
|
128
|
+
'string_length' => 13,
|
129
|
+
'letter_count' => 10,
|
130
|
+
'syllable_count' => 3,
|
131
|
+
'word_count' => 3,
|
132
|
+
'sentence_count' => 1,
|
133
|
+
'average_words_per_sentence' => 3.0,
|
134
|
+
'average_syllables_per_word' => 1.0,
|
135
|
+
'scores' => {
|
136
|
+
'Ari' => -4.2,
|
137
|
+
'ColemanLiau' => 3.7,
|
138
|
+
'FleschKincaidGl' => -2.6,
|
139
|
+
'FleschKincaidRe' => 119.2,
|
140
|
+
'GunningFog' => 1.2,
|
141
|
+
'Smog' => 3.1
|
142
|
+
}
|
143
|
+
}
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should call analyze_multi' do
|
147
|
+
expect(Odyssey).to receive(:analyze_multi).with(one_simple_sentence, Array, true)
|
148
|
+
Odyssey.analyze_all one_simple_sentence
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'should return a Hash' do
|
152
|
+
expect(Odyssey.analyze_all one_simple_sentence).to be_a Hash
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'returns all scores and info' do
|
156
|
+
expect(Odyssey.analyze_all one_simple_sentence).to eq analyze_all
|
157
|
+
end
|
158
|
+
end
|
274
159
|
end
|
275
160
|
|
276
161
|
describe 'plugin formulas' do
|
data/spec/spec_helper.rb
CHANGED
@@ -4,6 +4,7 @@ require 'odyssey'
|
|
4
4
|
RSpec.configure do |config|
|
5
5
|
config.color = true
|
6
6
|
config.formatter = 'documentation'
|
7
|
+
config.expect_with(:rspec) { |c| c.syntax = %i[should expect] }
|
7
8
|
end
|
8
9
|
|
9
10
|
def one_simple_sentence
|
@@ -24,4 +25,4 @@ end
|
|
24
25
|
|
25
26
|
def very_complex
|
26
27
|
"The best things in an artist's work are so much a matter of intuition, that there is much to be said for the point of view that would altogether discourage intellectual inquiry into artistic phenomena on the part of the artist. Intuitions are shy things and apt to disappear if looked into too closely. And there is undoubtedly a danger that too much knowledge and training may supplant the natural intuitive feeling of a student, leaving only a cold knowledge of the means of expression in its place. For the artist, if he has the right stuff in him"
|
27
|
-
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,127 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odyssey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Sutter
|
8
|
-
- Michael Lahnert
|
9
|
-
- Daniel Jethro
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
13
|
-
date: 2019-
|
11
|
+
date: 2019-10-12 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: require_all
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - "~>"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '2.0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '2.0'
|
29
13
|
- !ruby/object:Gem::Dependency
|
30
14
|
name: bundler
|
31
15
|
requirement: !ruby/object:Gem::Requirement
|
32
16
|
requirements:
|
33
|
-
- - "
|
17
|
+
- - ">="
|
34
18
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
19
|
+
version: '0'
|
36
20
|
type: :development
|
37
21
|
prerelease: false
|
38
22
|
version_requirements: !ruby/object:Gem::Requirement
|
39
23
|
requirements:
|
40
|
-
- - "
|
24
|
+
- - ">="
|
41
25
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
26
|
+
version: '0'
|
43
27
|
- !ruby/object:Gem::Dependency
|
44
28
|
name: rake
|
45
29
|
requirement: !ruby/object:Gem::Requirement
|
46
30
|
requirements:
|
47
|
-
- - "
|
31
|
+
- - ">="
|
48
32
|
- !ruby/object:Gem::Version
|
49
33
|
version: '0'
|
50
34
|
type: :development
|
51
35
|
prerelease: false
|
52
36
|
version_requirements: !ruby/object:Gem::Requirement
|
53
37
|
requirements:
|
54
|
-
- - "
|
38
|
+
- - ">="
|
55
39
|
- !ruby/object:Gem::Version
|
56
40
|
version: '0'
|
57
41
|
- !ruby/object:Gem::Dependency
|
58
42
|
name: rspec
|
59
43
|
requirement: !ruby/object:Gem::Requirement
|
60
44
|
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '3.1'
|
64
45
|
- - ">="
|
65
46
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
47
|
+
version: '0'
|
67
48
|
type: :development
|
68
49
|
prerelease: false
|
69
50
|
version_requirements: !ruby/object:Gem::Requirement
|
70
51
|
requirements:
|
71
|
-
- - "~>"
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: '3.1'
|
74
52
|
- - ">="
|
75
53
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
54
|
+
version: '0'
|
77
55
|
- !ruby/object:Gem::Dependency
|
78
56
|
name: pry
|
79
57
|
requirement: !ruby/object:Gem::Requirement
|
80
58
|
requirements:
|
81
|
-
- - "
|
59
|
+
- - ">="
|
82
60
|
- !ruby/object:Gem::Version
|
83
61
|
version: '0'
|
84
62
|
type: :development
|
85
63
|
prerelease: false
|
86
64
|
version_requirements: !ruby/object:Gem::Requirement
|
87
65
|
requirements:
|
88
|
-
- - "
|
66
|
+
- - ">="
|
89
67
|
- !ruby/object:Gem::Version
|
90
68
|
version: '0'
|
91
|
-
description: Odyssey is an
|
69
|
+
description: Odyssey is an extendable text analysis gem that outputs the readability
|
92
70
|
score of text. It has several of the common readability formulas available, but
|
93
71
|
defaults to the Flesch-Kincaid Reading Ease score.
|
94
72
|
email:
|
95
73
|
- cameronsutter0@gmail.com
|
96
|
-
- ''
|
97
|
-
- jethrodaniel@gmail.com
|
98
74
|
executables: []
|
99
75
|
extensions: []
|
100
76
|
extra_rdoc_files: []
|
101
77
|
files:
|
102
78
|
- ".gitignore"
|
79
|
+
- ".travis.yml"
|
103
80
|
- Gemfile
|
104
81
|
- LICENSE.txt
|
105
82
|
- README.md
|
106
83
|
- Rakefile
|
107
|
-
- lib/formulas/_formula.rb
|
108
|
-
- lib/formulas/ari.rb
|
109
|
-
- lib/formulas/coleman_liau.rb
|
110
|
-
- lib/formulas/fake_formula.rb
|
111
|
-
- lib/formulas/flesch_kincaid_gl.rb
|
112
|
-
- lib/formulas/flesch_kincaid_re.rb
|
113
|
-
- lib/formulas/gunning_fog.rb
|
114
|
-
- lib/formulas/smog.rb
|
115
84
|
- lib/odyssey.rb
|
116
85
|
- lib/odyssey/engine.rb
|
86
|
+
- lib/odyssey/formulas/ari.rb
|
87
|
+
- lib/odyssey/formulas/coleman_liau.rb
|
88
|
+
- lib/odyssey/formulas/fake_formula.rb
|
89
|
+
- lib/odyssey/formulas/flesch_kincaid_gl.rb
|
90
|
+
- lib/odyssey/formulas/flesch_kincaid_re.rb
|
91
|
+
- lib/odyssey/formulas/formula.rb
|
92
|
+
- lib/odyssey/formulas/gunning_fog.rb
|
93
|
+
- lib/odyssey/formulas/smog.rb
|
94
|
+
- lib/odyssey/refinements.rb
|
117
95
|
- lib/odyssey/version.rb
|
118
96
|
- odyssey.gemspec
|
97
|
+
- spec/odyssey/formulas/ari_spec.rb
|
98
|
+
- spec/odyssey/formulas/coleman_liau_spec.rb
|
99
|
+
- spec/odyssey/formulas/flesch_kincaid_gl_spec.rb
|
100
|
+
- spec/odyssey/formulas/flesch_kincaid_re_spec.rb
|
101
|
+
- spec/odyssey/formulas/gunning_fog_spec.rb
|
102
|
+
- spec/odyssey/formulas/smog_spec.rb
|
103
|
+
- spec/odyssey/refinements_spec.rb
|
119
104
|
- spec/odyssey_spec.rb
|
120
105
|
- spec/spec_helper.rb
|
121
106
|
homepage: https://github.com/cameronsutter/odyssey
|
122
107
|
licenses:
|
123
108
|
- MIT
|
124
|
-
metadata:
|
109
|
+
metadata:
|
110
|
+
source_code_uri: https://github.com/cameronsutter/odyssey
|
125
111
|
post_install_message:
|
126
112
|
rdoc_options: []
|
127
113
|
require_paths:
|
@@ -137,11 +123,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
requirements: []
|
140
|
-
|
141
|
-
rubygems_version: 2.5.2.3
|
126
|
+
rubygems_version: 3.0.4
|
142
127
|
signing_key:
|
143
128
|
specification_version: 4
|
144
129
|
summary: Text readability analyzer using Flesch-Kincaid and others
|
145
130
|
test_files:
|
131
|
+
- spec/odyssey/formulas/ari_spec.rb
|
132
|
+
- spec/odyssey/formulas/coleman_liau_spec.rb
|
133
|
+
- spec/odyssey/formulas/flesch_kincaid_gl_spec.rb
|
134
|
+
- spec/odyssey/formulas/flesch_kincaid_re_spec.rb
|
135
|
+
- spec/odyssey/formulas/gunning_fog_spec.rb
|
136
|
+
- spec/odyssey/formulas/smog_spec.rb
|
137
|
+
- spec/odyssey/refinements_spec.rb
|
146
138
|
- spec/odyssey_spec.rb
|
147
139
|
- spec/spec_helper.rb
|