demystify 0.0.5 → 0.0.6

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: d2008bae5fd3de5d608e3be677c79d2161c22395
4
- data.tar.gz: 73a508eec35acfd344190acc4087e147677301c3
3
+ metadata.gz: d0dca5bb503963fbc165cd75f83bc14276cc5074
4
+ data.tar.gz: c07850aca39ff29921923dbe0069b8d2d1c0c6ea
5
5
  SHA512:
6
- metadata.gz: 837386e0d03317044acc05033292ade1ebe9c0dd75f6d656e6254c4682f728f44fef36ad90aa34585938ca27f680af84661e0d5c761323c3b44abdc85706c11d
7
- data.tar.gz: 6cda8a7243d518eba10ca6707be5812452aee01e237d356262d1e8ae241208673699d87fe55cfc84e798053fe46b7c7cbdedf54d764cff7f1aad949bc62dbdf9
6
+ metadata.gz: 1aba323992f688fa51b7d5a50ebe6a203699ee065ad634a5d6207672e398b625ccd1d5f2515be4e98529b2a59d6a70e653b9978ce8c028abd8ff236f8b30909f
7
+ data.tar.gz: 07cda85ed17db86feb3289d4c1ab15f6412a1e3108506381036d6b3c7ca8bce46a3d4917c58137193cbf4bef3bb0629bdde90fbef51f013ba14b80f80ad5cd64
data/lib/demystify.rb CHANGED
@@ -32,7 +32,7 @@ module Demystify
32
32
  def initialize(file)
33
33
  @content = open(file).read
34
34
  @chars = @content.split("")
35
- @words = @content.split(/[^[[:word:]]]+/)
35
+ @words = @content.split(/[^[[:word:]]|'|-]+/)
36
36
  make_sentences
37
37
  make_probability_hashes
38
38
  make_first_and_last_words
@@ -98,7 +98,6 @@ module Demystify
98
98
  count = 0
99
99
  i = 0
100
100
  while i < (@chars.length - sequence.length)
101
- # puts @chars[i...sequence.length].join("")
102
101
  if @chars[i...(i+sequence.length)].join("") == sequence
103
102
  count += 1
104
103
  end
@@ -112,6 +111,7 @@ module Demystify
112
111
  end
113
112
 
114
113
  def sentence_count
114
+ p @words
115
115
  @sentences.length
116
116
  end
117
117
 
@@ -150,7 +150,7 @@ module Demystify
150
150
  @forwards_probability_hash = Hash.new { |h, k| h[k] = [] }
151
151
  @backwards_probability_hash = Hash.new { |h, k| h[k] = [] }
152
152
  @sentences.each do |sentence|
153
- sentence_array = sentence.split(/[^[[:word:]]]+/)
153
+ sentence_array = sentence.split(/[^[[:word:]]|'|-]+[,|;|:|.|?|!]?/)
154
154
  sentence_array.each_with_index do |word, i|
155
155
  unless i == sentence_array.length - 1
156
156
  @forwards_probability_hash[word] << sentence_array[i+1]
@@ -1,3 +1,3 @@
1
1
  module Demystify
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/sample2.txt CHANGED
@@ -1 +1 @@
1
- Whale is the common name for a widely distributed and diverse group of fully aquatic placental marine mammals. They are an informal grouping within the infraorder Cetacea, usually excluding dolphins and porpoises. Whales, dolphins and porpoises belong to the order Cetartiodactyla with even-toed ungulates and their closest living relatives are the hippopotamuses, having diverged about 40 million years ago. The two parvorders of whales, baleen whales (Mysticeti) and toothed whales (Odontoceti), are thought to have split apart around 34 million years ago. The whales comprise eight extant families: Balaenopteridae (the rorquals), Balaenidae (right whales), Cetotheriidae (the pygmy right whale), Eschrichtiidae (the gray whale), Monodontidae (belugas and narwhals), Physeteridae (the sperm whale), Kogiidae (the dwarf and pygmy sperm whale), and Ziphiidae (the beaked whales).
1
+ Aren't you a silly-boy? Go run home to James's house. Whale is the common name for a widely distributed and diverse group of fully aquatic placental marine mammals. They are an informal grouping within the infraorder Cetacea, usually excluding dolphins and porpoises. Whales, dolphins and porpoises belong to the order Cetartiodactyla with even-toed ungulates and their closest living relatives are the hippopotamuses, having diverged about 40 million years ago. The two parvorders of whales, baleen whales (Mysticeti) and toothed whales (Odontoceti), are thought to have split apart around 34 million years ago. The whales comprise eight extant families: Balaenopteridae (the rorquals), Balaenidae (right whales), Cetotheriidae (the pygmy right whale), Eschrichtiidae (the gray whale), Monodontidae (belugas and narwhals), Physeteridae (the sperm whale), Kogiidae (the dwarf and pygmy sperm whale), and Ziphiidae (the beaked whales).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demystify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - DouglasTGordon