mindwords 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mindwords.rb +32 -27
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec2890a679fe960fc09d401fc33fa57c735b4e8ba940dfa02834880d2f92320a
|
4
|
+
data.tar.gz: 2829b18b62650d5f49986113e67e01127331b89e17aaee698219220f3fae6387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd62b5aa44b6227a0028e990369dfa582d0b5c32bbee93969a37456cdc2e787d6d25108d3f4279e1422bd95ce107c01622b9167ab43407c2aa0627a6d0ec2989
|
7
|
+
data.tar.gz: af4672aef859de43270d5a16d422815670e7e093282a19c901358d2770fd95276080c1594125a3215c3b0f1ce9b17d9ed6603b6e91dd6ae05b8b2764fb1484cc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mindwords.rb
CHANGED
@@ -26,33 +26,7 @@ class MindWords
|
|
26
26
|
|
27
27
|
@parent, @debug = parent, debug
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
@filepath = raws if type == :file or type == :dfs
|
32
|
-
lines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
|
33
|
-
lines.shift if lines.first =~ /<\?mindwords\?>/
|
34
|
-
|
35
|
-
@lines = lines.inject([]) do |r,line|
|
36
|
-
|
37
|
-
# the following does 2 things:
|
38
|
-
# 1. splits words separated by a bar (|) onto their own line
|
39
|
-
# 2. prefixes a word with an underscore if the word is the
|
40
|
-
# same as the hashtag. That way it's not removed by the
|
41
|
-
# redundancy checker
|
42
|
-
|
43
|
-
raw_words, raw_hashtags = line.split(/(?= #)/,2)
|
44
|
-
words = raw_words.split(/ *\| */)
|
45
|
-
hashtags = raw_hashtags.scan(/(?<=#)\w+/)
|
46
|
-
|
47
|
-
words.each do |word|
|
48
|
-
|
49
|
-
linex = (word + raw_hashtags)
|
50
|
-
r << (hashtags.include?(word) ? linex.sub!(/\b#{word}\b/, '_\0') \
|
51
|
-
: linex)
|
52
|
-
end
|
53
|
-
|
54
|
-
r
|
55
|
-
end
|
29
|
+
import(raws) if raws.length > 1
|
56
30
|
|
57
31
|
end
|
58
32
|
|
@@ -95,6 +69,37 @@ class MindWords
|
|
95
69
|
|
96
70
|
end
|
97
71
|
|
72
|
+
def import(raws)
|
73
|
+
|
74
|
+
s, type = RXFHelper.read raws
|
75
|
+
|
76
|
+
@filepath = raws if type == :file or type == :dfs
|
77
|
+
lines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
|
78
|
+
lines.shift if lines.first =~ /<\?mindwords\?>/
|
79
|
+
|
80
|
+
@lines = lines.inject([]) do |r,line|
|
81
|
+
|
82
|
+
# the following does 2 things:
|
83
|
+
# 1. splits words separated by a bar (|) onto their own line
|
84
|
+
# 2. prefixes a word with an underscore if the word is the
|
85
|
+
# same as the hashtag. That way it's not removed by the
|
86
|
+
# redundancy checker
|
87
|
+
|
88
|
+
raw_words, raw_hashtags = line.split(/(?= #)/,2)
|
89
|
+
words = raw_words.split(/ *\| */)
|
90
|
+
hashtags = raw_hashtags.scan(/(?<=#)\w+/)
|
91
|
+
|
92
|
+
words.each do |word|
|
93
|
+
|
94
|
+
linex = (word + raw_hashtags)
|
95
|
+
r << (hashtags.include?(word) ? linex.sub!(/\b#{word}\b/, '_\0') \
|
96
|
+
: linex)
|
97
|
+
end
|
98
|
+
|
99
|
+
r
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
98
103
|
# helpful when searching for a word itself using autosuggest
|
99
104
|
#
|
100
105
|
def lookup(s)
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mindwords
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
aWH7D2AmhOpqNwWnPHzWR/yzpigAVTrvpHfRxZleQj6Z/090nIH2KR0RdioMmPFq
|
36
36
|
3+574KQzs/gR9Y5a+iMcvHRN
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-01-
|
38
|
+
date: 2022-01-02 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|