epitome 0.3.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cb53fea0c18408368a6d577ea95aadf8da5535d
4
- data.tar.gz: 5d2a556cc5b816919e6bdd77dfa6a141efe9f63d
3
+ metadata.gz: aad2c8fc4a5e37379b2aea76c4ff18becf88de2e
4
+ data.tar.gz: 07a84242a19c4c9fa268c6fad11ff393be31bee3
5
5
  SHA512:
6
- metadata.gz: 669e7cb2fba922e2ccb16faf864a491ca7747eda4d9a97688163213db21c5ebd0307b4ab1920eb9b09aebe745b1e00d9736891ec40aaa7939d6dcc2fc438b828
7
- data.tar.gz: 5580d6b1f39039690d0f7423be422dd27d2b17f2c4b77ea3a5996b4a263f70ee07ab357f0ab9c65b6dc840dc4604b31a1828205b08b6024af60a5cabd08c1753
6
+ metadata.gz: 0df6dd77b55f5f2a523fad554178ba59794e89c2976692141989955e84bde13c34ac8b6f1f29351e510a342da39ecedb425f9d0c3e3ba5ed71a81c195ce93d33
7
+ data.tar.gz: 9ab51cfde82db95f0043bd16744f7eaf9b884c0d6414a546db223fd6ecc4f41bf71d4e7145e9cf17462ffd87952af7c66abd59a5fad578a9727f8f092361d411
data/README.md CHANGED
@@ -39,7 +39,11 @@ Finally, output the summary
39
39
  @corpus.summary(length=3)
40
40
  ```
41
41
 
42
- This returns a nice, short text.
42
+ By default, this output a nice, short string. If you want an array containing each individual sentence,
43
+ you can pass the argument:
44
+ ```ruby
45
+ @corpus.summary(:array)
46
+ ```
43
47
 
44
48
  ## Options
45
49
  ### Summary options
@@ -28,7 +28,7 @@ module Epitome
28
28
 
29
29
  end
30
30
 
31
- def summary(summary_length, threshold=0.2)
31
+ def summary(summary_length, threshold=0.2, output=:string)
32
32
  s = @clean_corpus.values.flatten
33
33
  # n is the number of sentences in the total corpus
34
34
  n = @clean_corpus.values.flatten.size
@@ -58,7 +58,13 @@ module Epitome
58
58
  # Ugly sleight of hand to return a text based on results
59
59
  # <Array>Results => <Hash>Results => <String>ResultsText
60
60
  h = Hash[@sentences.zip(results)]
61
- return h.sort_by {|k, v| v}.reverse.first(summary_length).to_h.keys.join(" ")
61
+ if output == :array
62
+ return h.sort_by {|k, v| v}.reverse.first(summary_length).to_h.keys
63
+ elsif output == :string
64
+ return h.sort_by {|k, v| v}.reverse.first(summary_length).to_h.keys.join(" ")
65
+ else
66
+ return "No return format specified."
67
+ end
62
68
  end
63
69
 
64
70
  private
@@ -1,3 +1,3 @@
1
1
  module Epitome
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epitome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - McFreely