lingua-it-readability 1.0.2 → 1.0.4
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/CHANGELOG.md +16 -6
- data/README.md +6 -14
- data/lib/lingua/it/readability.rb +2 -14
- data/lib/lingua/it/readability/version.rb +1 -1
- 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: f19e616c95d2c5ac39b48a3c8bff987f6dff50d0
|
|
4
|
+
data.tar.gz: 0d8454d351aca62f6c78448a61457f9776ddde92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10e8b13a85658e1088761a47328c1213a6acd3bfe775c54b846ec44fe691dd1f5b523242e3a62c0a547503d2cb2aaa6124f655c5ddc438c12038ab13ffabfa9d
|
|
7
|
+
data.tar.gz: d91cebb9572f202e9be9ab37a725b383ec0b8070d7b5b41b20360d3880554c1bd025cfed4885131261817985e5c2aa0057fedd02c499d1eaa198d18953fbe2f7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
|
+
#### 1.0.4 - 2016-02-09
|
|
2
|
+
###### Added
|
|
3
|
+
- Readme usage section
|
|
4
|
+
###### Fixed
|
|
5
|
+
- Minor bugs
|
|
6
|
+
|
|
7
|
+
#### 1.0.3 - 2016-02-09
|
|
8
|
+
###### Added
|
|
9
|
+
- Readme usage section
|
|
10
|
+
|
|
1
11
|
#### 1.0.2 - 2016-02-09
|
|
2
12
|
###### Added
|
|
3
13
|
- Readme usage section
|
|
4
14
|
###### Fixed
|
|
5
|
-
- Minor bugs
|
|
15
|
+
- Minor bugs
|
|
6
16
|
|
|
7
17
|
#### 1.0.1 - 2016-02-09
|
|
8
18
|
###### Added
|
|
9
|
-
- Some more tests
|
|
19
|
+
- Some more tests
|
|
10
20
|
###### Fixed
|
|
11
21
|
- Improvements on syllables regex
|
|
12
22
|
|
|
13
23
|
#### 1.0.0 - 2016-02-09
|
|
14
24
|
###### Added
|
|
15
|
-
- Some more tests
|
|
25
|
+
- Some more tests
|
|
16
26
|
|
|
17
27
|
#### 0.6.0 - 2016-02-08
|
|
18
28
|
###### Added
|
|
19
|
-
- Types of text
|
|
20
|
-
- Some more tests
|
|
29
|
+
- Types of text
|
|
30
|
+
- Some more tests
|
|
21
31
|
|
|
22
32
|
#### 0.5.0 - 2016-02-05
|
|
23
33
|
###### Added
|
|
24
|
-
- Initial release
|
|
34
|
+
- Initial release
|
|
25
35
|
- Sentences recognition
|
|
26
36
|
- Italian abbreviations
|
|
27
37
|
- Syllables recongnition
|
data/README.md
CHANGED
|
@@ -23,26 +23,18 @@ Or install it yourself as:
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
```ruby
|
|
26
|
-
text = 'Testo campione da analizzare.'
|
|
26
|
+
text = 'Testo campione da analizzare con Gulpease e Flesch tarati su lingua Italiana.'
|
|
27
27
|
report = Lingua::IT::Readability.new(text)
|
|
28
28
|
report.num_sentences # 1
|
|
29
|
-
report.num_words #
|
|
30
|
-
report.num_syllables #
|
|
31
|
-
report.
|
|
32
|
-
|
|
33
|
-
# it's also possible to not directly initialize the object..
|
|
34
|
-
report = Lingua::IT::Readability.new
|
|
35
|
-
report.analyze(text)
|
|
36
|
-
|
|
37
|
-
# ..and get al the infos as well
|
|
38
|
-
report.num_sentences # 1
|
|
39
|
-
report.num_words # 4
|
|
40
|
-
report.num_syllables # 11
|
|
29
|
+
report.num_words # 12
|
|
30
|
+
report.num_syllables # 29
|
|
31
|
+
report.gulpease # 59
|
|
32
|
+
report.flesch # 36.92
|
|
41
33
|
report.report # a formatted summary of statistics and measures
|
|
42
34
|
|
|
43
35
|
# accept type 'scientific' to treat list items separated by semicolons as sentences
|
|
44
36
|
text = "Lista:\n- Gennaio;\n- Febbraio;"
|
|
45
|
-
report.
|
|
37
|
+
report = Lingua::IT::Readability.new(text)
|
|
46
38
|
report.num_sentences # 3
|
|
47
39
|
report.num_words # 3
|
|
48
40
|
report.num_syllables # 8
|
|
@@ -9,6 +9,7 @@ end
|
|
|
9
9
|
module Lingua
|
|
10
10
|
module IT
|
|
11
11
|
class Readability
|
|
12
|
+
attr_reader :text
|
|
12
13
|
attr_reader :text
|
|
13
14
|
attr_reader :type
|
|
14
15
|
attr_reader :paragraphs
|
|
@@ -29,19 +30,6 @@ module Lingua
|
|
|
29
30
|
count_words
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
# Analyze the sample with +text+
|
|
33
|
-
def analyze(text, type = 'standard')
|
|
34
|
-
@text = text.dup
|
|
35
|
-
@type = type
|
|
36
|
-
@paragraphs = Lingua::IT::Paragraph.paragraphs(self.text)
|
|
37
|
-
@sentences = Lingua::IT::Sentence.sentences(self.text, self.type)
|
|
38
|
-
@words = []
|
|
39
|
-
@frequencies = {}
|
|
40
|
-
@frequencies.default = 0
|
|
41
|
-
@syllables = Lingua::IT::Syllable.syllables(self.text)
|
|
42
|
-
count_words
|
|
43
|
-
end
|
|
44
|
-
|
|
45
33
|
# The number of paragraphs in the sample. A paragraph is defined as a
|
|
46
34
|
# newline followed by one or more empty or whitespace-only lines.
|
|
47
35
|
def num_paragraphs
|
|
@@ -138,7 +126,7 @@ module Lingua
|
|
|
138
126
|
|
|
139
127
|
private
|
|
140
128
|
|
|
141
|
-
#
|
|
129
|
+
# Number of words in the sample. A words is represented by a sequence
|
|
142
130
|
# of single characters exlucding punctuation, except for all kind of
|
|
143
131
|
# parenthesis like () [] and {}. Being calibrated for italian language
|
|
144
132
|
# it takes in account even accented characters.
|