wordstats 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fa5e8d49246fec84506b98d7b0ee83df1069e88
4
- data.tar.gz: ac70c855cab97581ecbae397334a057778b9a735
3
+ metadata.gz: 468979e402beb05a610123af7211cec9cc86be12
4
+ data.tar.gz: 2849026cca7451e51de89ce49783971f785f7ea7
5
5
  SHA512:
6
- metadata.gz: 22b3fe16de0ab48a5eb944f485443b2ff8a53137a7ced6edc2025af58f748ebff40d7fdba5f9401feaaff845804546fa3d71b988cd72152c4bc43cd4880b8911
7
- data.tar.gz: 11713db9daf84190f5cf51a52c06a7cf6fe92571587bbaf7bdb8578755fe9ba43eb2442850f47989d1bebe1030c67b6889b37b8c1875546744779d131e52af1e
6
+ metadata.gz: 18670a1ef1180ae1ff41428503348e08b9a9b08384725f12356dda5bfb96c8df69880b87c9ea75f39b94aa4c54773e1cc16d511207c29329422cc201d06efa8e
7
+ data.tar.gz: 8347282af1b8ad75da47379b01ee1e22c03cae70e11cd8d07412c890f93ec0e1f2be3b88a9decfe79fcfdf97862760fe49c090d32a0515174bfabbc9dda5129f
data/lib/wordstats.rb CHANGED
@@ -8,11 +8,11 @@ class Wordstats
8
8
  end
9
9
 
10
10
  def process(str)
11
- word_count(str)
12
- avg_word_length(str)
13
- most_common_noun(str)
14
- most_common_word(str)
15
- avg_sentence_length(str)
11
+ p "Word Count: " + word_count(str).to_s
12
+ p "Average Word Length: " + avg_word_length(str).to_s
13
+ p "Most Common Noun: " + most_common_noun(str).to_s
14
+ p "Most Common Word: " + most_common_word(str).to_s
15
+ p "Average Sentence Length: " + avg_sentence_length(str).to_s + " words"
16
16
  end
17
17
 
18
18
  def word_count(str)
@@ -26,7 +26,8 @@ class Wordstats
26
26
  word_arr.each do |word|
27
27
  word_length_arr << word.length
28
28
  end
29
- word_length_arr.reduce(:+) / word_length_arr.length
29
+ sum = word_length_arr.reduce(:+)
30
+ sum / word_length_arr.length
30
31
  end
31
32
 
32
33
  def most_common_noun(str)
@@ -72,7 +73,8 @@ class Wordstats
72
73
  word_arr = sentence.split(' ')
73
74
  sentence_length_arr << word_arr.length
74
75
  end
75
- sentence_length_arr.reduce(:+) / sentence_length_arr.length
76
+ sum = sentence_length_arr.reduce(:+)
77
+ sum / sentence_length_arr.length
76
78
  end
77
79
 
78
80
  end
@@ -1,3 +1,3 @@
1
1
  class Wordstats
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Niu
@@ -86,6 +86,7 @@ files:
86
86
  - bin/setup
87
87
  - lib/wordstats.rb
88
88
  - lib/wordstats/version.rb
89
+ - wordstats-1.0.0.gem
89
90
  - wordstats.gemspec
90
91
  homepage: https://github.com/kevniu/Word-Stats
91
92
  licenses: