readability_score 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/rscore +10 -0
  3. data/lib/readability_score.rb +61 -0
  4. metadata +49 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 73894e752f214f41a925418434d3d775c615d545fc17965701aa818858293c23
4
+ data.tar.gz: 0d77be49f03f63935eb2dee938d95180998dbbe35a41f95c85d6f225b0e93c7b
5
+ SHA512:
6
+ metadata.gz: 9cad53f1757ce1fa053a5028534acfa764bba33e412d8768b659073030f0539dc9c753a3d9b2eb036a28c2fd4129b3ff8070d7398ea96d7221a9ff625ad76bf3
7
+ data.tar.gz: 858c1f36a1485dc825efad82fa2d52bd1cc5fdc56e54e8b95ffcdcb314065dc7cb78863042e1d4c80d6e64b14dac12d0ae21c1e96fbf2a1eab42f795bb516aa5
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "readability_score"
5
+
6
+ if ARGV.length != 1
7
+ ReadabilityScore.check
8
+ else
9
+ ReadabilityScore.check ARGV[0]
10
+ end
@@ -0,0 +1,61 @@
1
+ require 'json'
2
+ require 'require_all'
3
+ require 'odyssey'
4
+ require 'awesome_print'
5
+
6
+ class ReadabilityScore
7
+ def self.check(filename = "README.md")
8
+ puts "Checking the contents of #{filename}..."
9
+ fh = open filename
10
+ content = fh.read
11
+ fh.close
12
+
13
+ average_readability = Odyssey.ari(content, false)
14
+ coleman_liau = Odyssey.coleman_liau(content, false)
15
+ grade_level = Odyssey.flesch_kincaid_grade_level(content, false)
16
+ readability_ease = Odyssey.flesch_kincaid_reading_ease(content, false)
17
+ gunning_fog = Odyssey.gunning_fog(content, false)
18
+ smog = Odyssey.smog(content, false)
19
+ text = Odyssey.fake_formula(content, true)
20
+
21
+ gender_specific_words = ["he", "she", "him", "her"]
22
+ .select { |word|
23
+ text["score"]["words"].include?(word)
24
+ }
25
+
26
+ relevant_words = ["readme", "code along", "codealong", "lab", "test"]
27
+ .select { |word|
28
+ text["score"]["words"].include?(word)
29
+ }
30
+
31
+ irrelevant_words = ["a", "an", "and", "the", "like", "with", "through", "over", "before", "at", "of", "to", "in", "for", "on", "by", "between", "after", "since", "without", "under", "beyond", "near", "above", "off", "down", "except", "about", "learn", "co", "open", "really", "we're" ]
32
+ word_hash = {}
33
+ text["score"]["words"]
34
+ .select {|word| !irrelevant_words.include?(word.downcase)}
35
+ .each {|word|
36
+ word_hash.key?(word) ? word_hash[word] += 1 : word_hash[word] = 1
37
+ }
38
+
39
+ puts "Automated Readability Index (1 => Kindergarten, 8 => 7th Grade, 14+ => College Level):"
40
+ puts average_readability
41
+ puts ""
42
+ puts "Coleman Liau Index (1 => Kindergarten, 8 => 7th Grade, 14+ => College Level):"
43
+ puts coleman_liau
44
+ puts ""
45
+ puts "Flesch Kincaid Grade Level (1 => Kindergarten, 8 => 7th Grade, 14+ => College Level):"
46
+ puts grade_level
47
+ puts ""
48
+ puts "Flesch Kincaid Reading Ease (100.0-90.0 => 5th Grade, 80.0-70.0 => 7th Grade, 50.0-30.0 => College Level):"
49
+ puts readability_ease
50
+ puts ""
51
+ puts "Gunning Fog Index (7 => 7th grade, 10 => 10th Grade, 13-16 => College Level):"
52
+ puts gunning_fog
53
+ puts ""
54
+ puts "Smog Index (7 => 7th grade, 10 => 10th Grade, 13-16 => College Level):"
55
+ puts smog
56
+ puts ""
57
+
58
+ puts "Gender specific words: #{gender_specific_words}"
59
+ end
60
+
61
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: readability_score
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - maxwellbenton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Readable uses the Odyssey gem's built in readability index scores to
14
+ test a particular README.md file. Once installed, simply navigate to a directory
15
+ with a README present and call the gem to get feedback on the content.
16
+ email:
17
+ - maxwellbenton@gail.com
18
+ executables:
19
+ - rscore
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - bin/rscore
24
+ - lib/readability_score.rb
25
+ homepage: https://github.com/learn-co-curriculum/readable/
26
+ licenses:
27
+ - MIT
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.7.6
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Readable generates readability scores for README.md files in the terminal
49
+ test_files: []