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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5542c77a0a6c46b3332c8fe544ab9841cbef55c
4
- data.tar.gz: 6c243df9b4f38517e2a6f5cd733c51ebd767a29d
3
+ metadata.gz: 18561b76f0a2f96a136524432b0f3ef0802da481
4
+ data.tar.gz: 4921422b8f36c15ebcf353bcc4eddc68a21ea8cf
5
5
  SHA512:
6
- metadata.gz: af902cab383c81c39ae7d714b1e64f1e11b5f9024d39337f3efb64aaba6c9f9b4b9a64adf8cfb80a206b13fc8052c3f8f68b92db6125cf32468ad3aec657aca3
7
- data.tar.gz: 33a0f97d97d8bb042cfec017d3f288c4d9968a2ccef1351325441336eaf19bcab7d84fce6ddffbd815c4f753af6464b661df16ca84e4cd4156785426a662d19f
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
- TODO: Write usage instructions here
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)
@@ -1,7 +1,7 @@
1
1
  module Lingua
2
2
  module It
3
3
  module Readability
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lingua-it-readability
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Giacomo Baldan