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 +4 -4
- data/lib/demystify.rb +3 -3
- data/lib/demystify/version.rb +1 -1
- data/sample2.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0dca5bb503963fbc165cd75f83bc14276cc5074
|
4
|
+
data.tar.gz: c07850aca39ff29921923dbe0069b8d2d1c0c6ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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]
|
data/lib/demystify/version.rb
CHANGED
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).
|