lingua-it-readability 1.0.1 → 1.0.2
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 +12 -0
- data/README.md +26 -1
- data/lib/lingua/it/readability.rb +14 -1
- 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: 18561b76f0a2f96a136524432b0f3ef0802da481
|
|
4
|
+
data.tar.gz: 4921422b8f36c15ebcf353bcc4eddc68a21ea8cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce34e8496f042885ddf61d21e9bd772751a4ce70f55e5a3e6c813f87ee04ed0c8322a63df5440e8d40d3c46dad9aa086ddc1cb85f6a24925cba8eb1030bf07e3
|
|
7
|
+
data.tar.gz: 2572c4ca055d5af170ebbec9825752ed95ff940cf3a7649c1da17a0e35249b83f809881d3fab4595c65c97e01641e3f4dd6fc73c3f62bb845a13328a70dd0d12
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
#### 1.0.2 - 2016-02-09
|
|
2
|
+
###### Added
|
|
3
|
+
- Readme usage section
|
|
4
|
+
###### Fixed
|
|
5
|
+
- Minor bugs.
|
|
6
|
+
|
|
7
|
+
#### 1.0.1 - 2016-02-09
|
|
8
|
+
###### Added
|
|
9
|
+
- Some more tests.
|
|
10
|
+
###### Fixed
|
|
11
|
+
- Improvements on syllables regex
|
|
12
|
+
|
|
1
13
|
#### 1.0.0 - 2016-02-09
|
|
2
14
|
###### Added
|
|
3
15
|
- Some more tests.
|
data/README.md
CHANGED
|
@@ -22,7 +22,32 @@ Or install it yourself as:
|
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
```ruby
|
|
26
|
+
text = 'Testo campione da analizzare.'
|
|
27
|
+
report = Lingua::IT::Readability.new(text)
|
|
28
|
+
report.num_sentences # 1
|
|
29
|
+
report.num_words # 4
|
|
30
|
+
report.num_syllables # 11
|
|
31
|
+
report.report # a formatted summary of statistics and measures
|
|
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
|
|
41
|
+
report.report # a formatted summary of statistics and measures
|
|
42
|
+
|
|
43
|
+
# accept type 'scientific' to treat list items separated by semicolons as sentences
|
|
44
|
+
text = "Lista:\n- Gennaio;\n- Febbraio;"
|
|
45
|
+
report.analyze(text)
|
|
46
|
+
report.num_sentences # 3
|
|
47
|
+
report.num_words # 3
|
|
48
|
+
report.num_syllables # 8
|
|
49
|
+
report.report # a formatted summary of statistics and measures
|
|
50
|
+
```
|
|
26
51
|
|
|
27
52
|
## Development
|
|
28
53
|
|
|
@@ -17,7 +17,20 @@ module Lingua
|
|
|
17
17
|
attr_reader :frequencies
|
|
18
18
|
|
|
19
19
|
# Initialize the sample with +text+
|
|
20
|
-
def initialize(text, type = 'standard')
|
|
20
|
+
def initialize(text = '', type = 'standard')
|
|
21
|
+
@text = text.dup
|
|
22
|
+
@type = type
|
|
23
|
+
@paragraphs = Lingua::IT::Paragraph.paragraphs(self.text)
|
|
24
|
+
@sentences = Lingua::IT::Sentence.sentences(self.text, self.type)
|
|
25
|
+
@words = []
|
|
26
|
+
@frequencies = {}
|
|
27
|
+
@frequencies.default = 0
|
|
28
|
+
@syllables = Lingua::IT::Syllable.syllables(self.text)
|
|
29
|
+
count_words
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Analyze the sample with +text+
|
|
33
|
+
def analyze(text, type = 'standard')
|
|
21
34
|
@text = text.dup
|
|
22
35
|
@type = type
|
|
23
36
|
@paragraphs = Lingua::IT::Paragraph.paragraphs(self.text)
|