text-metrics 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d2c50a6c558c741b22dd13e0c7327c0453ca619bc5dc535364c7af81e282a00d
4
+ data.tar.gz: 761532ff88057efc471f1c0b1f8c1395f527d7ce1d2490e41a982e85994b22f9
5
+ SHA512:
6
+ metadata.gz: 5327430d90c3a17bdc4822112700fcba99bb5f6fa5df7a22063b534048d87bfd59eb82b9fcd0363defa659c5e39a5e3109a005b94d55c35e23b2801bbd547532
7
+ data.tar.gz: 6dde381cb4592e1158aced2f8c90bae5fd585951e1f02450da197b98c0eaa1741903d4cc0310402fb5dba2447e9908187782327c57c5855d000e8ded84239a63
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # Change log
2
+
3
+ ## master
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2024 Adrien POLY
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ <!-- [![Gem Version](https://badge.fury.io/rb/text-metrics.svg)](https://rubygems.org/gems/text-metrics) -->
2
+
3
+ [![Build](https://github.com/plume-app/text-metrics/workflows/Build/badge.svg)](https://github.com/plume-app/text-metrics/actions)
4
+
5
+ # Text Metrics
6
+
7
+ Text Metrics is a Ruby library for text analysis. It is inspired from Textstat library in Python and the Ruby port of [Textstat](https://github.com/kupolak/textstat).
8
+
9
+ In addition to basic metrics it also provides readability tests like Flesch Reading Ease, Flesch-Kincaid Grade Level, Gunning Fog Index, Coleman-Liau Index.
10
+
11
+ At this point the main language supported are English and French.
12
+
13
+ ## Features
14
+
15
+ _Basic metrics:_
16
+
17
+ - [x] words count
18
+ - [x] characters count
19
+ - [x] sentences count
20
+ - [x] syllables per word average
21
+ - [x] letters per word average
22
+ - [x] sentence length average
23
+ - [x] sentence length (characters) average
24
+
25
+ _Readability tests:_
26
+
27
+ - [x] Flesch Reading Ease
28
+ - [x] Flesch-Kincaid Grade Level
29
+ - [x] Smog Index
30
+ - [x] Coleman-Liau Index
31
+ - [x] Lix Index
32
+ - [ ] Gunning Fog Index
33
+
34
+ ## Installation
35
+
36
+ No official release yet, but you can install it from GitHub:
37
+
38
+ ```ruby
39
+ # Gemfile
40
+ gem "text-metrics", github: "plume-app/text-metrics", branch: "main"
41
+ ```
42
+
43
+ ### Supported Ruby versions
44
+
45
+ - Ruby (MRI) >= 3.1.0
46
+
47
+ ## Usage
48
+
49
+ ```ruby
50
+ @text_analyser = TextMetrics.new(text: "This gem analyses all kind of texts.")
51
+ # get all metrics at once:
52
+
53
+ @text_analyser.all
54
+ # { words_count: 7, characters_count: 30, sentences_count: 1, syllables_count: 9, syllables_per_word_average: 1.3, letters_per_word_average: 4.29, words_per_sentence_average: 7.0, characters_per_sentence_average: 30.0, flesch_reading_ease: 89.75, flesch_kincaid_grade: 2.5 }
55
+
56
+ # or get each metric separately:
57
+ @text_analyser.words_count # => 7
58
+ @text_analyser.characters_count # => 30
59
+ @text_analyser.sentences_count # => 1
60
+ @text_analyser.syllables_count # => 9
61
+ @text_analyser.syllables_per_word_average # => 1.3
62
+ @text_analyser.letters_per_word_average # => 4.29
63
+ @text_analyser.words_per_sentence_average # => 7.0
64
+ @text_analyser.characters_per_sentence_average # => 30.0
65
+ @text_analyser.flesch_reading_ease # => 89.75
66
+ @text_analyser.flesch_kincaid_grade # => 2.5
67
+ ```
68
+
69
+ ## Contributing
70
+
71
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/plume-app/text-metrics](https://github.com/plume-app/text-metrics).
72
+
73
+ ## Credits
74
+
75
+ This gem was inspired by [Textstat](https://github.com/kupolak/textstat) and [Textstat](https://github.com/textstat/textstat) in Python.
76
+ This gem is generated via [`newgem` template](https://github.com/palkan/newgem) by [@palkan](https://github.com/palkan).
77
+
78
+ ## License
79
+
80
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).