mindwords 0.5.5 → 0.5.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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -3
- data/lib/mindwords.rb +50 -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: 9278b3fbcf3da1caed6dd21c274bb8b26e12dec525d05ecf322965b083e8c884
|
4
|
+
data.tar.gz: 8c9b4a404897fd119b64f13e7140daecc8eb55f404595e001508b0b8dd031b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d4aa5d8a2d6fbc11492518c9be080d98adf122240867baea88d94dfb2b87781bb0e6f94aa5ea7dc632e9be6525c2a3fe02b854b26d86f57accef214b533a904
|
7
|
+
data.tar.gz: 96d3d52f2c88e2419aee86737469a837c51985fc716277cd97694f5f32905ee349e7bbbb40e63e121555cdb81c5b90d5b06baabc28b7a1011a00c98fbb584a35
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
U
|
2
|
-
|
3
|
-
r�b��Ȥ�7;�B=�r���
|
1
|
+
��(Ԏ���Z��C��"U��
|
2
|
+
��:�AG�x����`.yK�;-������`��:��X�� T��jH�i+�H�?~zV��Kv�AY_��(�7��y���c�d�vR������$J��
|
data/lib/mindwords.rb
CHANGED
@@ -63,6 +63,41 @@ class MindWords
|
|
63
63
|
File.write file, to_s()
|
64
64
|
|
65
65
|
end
|
66
|
+
|
67
|
+
# Accepts a list of words with the aim of returning a MindWords document
|
68
|
+
# using matched words with hashtags from the existing MindWords document.
|
69
|
+
#
|
70
|
+
def reflect(raws)
|
71
|
+
|
72
|
+
h = to_h
|
73
|
+
|
74
|
+
missing_words = []
|
75
|
+
|
76
|
+
# add the tags from the main list
|
77
|
+
a = raws.strip.lines.map do |x|
|
78
|
+
if h[x.chomp] then
|
79
|
+
[x.chomp, h[x.chomp]]
|
80
|
+
else
|
81
|
+
missing_words << x
|
82
|
+
nil
|
83
|
+
end
|
84
|
+
end.compact
|
85
|
+
|
86
|
+
# add any linkage words from the tags
|
87
|
+
#
|
88
|
+
a.map(&:last).flatten(1).each do |s|
|
89
|
+
|
90
|
+
a << [s, h[s]] if h[s]
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
# remove suplicates lines and transform it into a raw mindwords format
|
95
|
+
#
|
96
|
+
raws3 = a.uniq.map {|s,tags| [s, tags.map {|x| '#' + x }.join(' ')].join(' ') }.join("\n")
|
97
|
+
|
98
|
+
[MindWords.new(raws3), missing_words]
|
99
|
+
|
100
|
+
end
|
66
101
|
|
67
102
|
def search(keyword)
|
68
103
|
|
@@ -129,6 +164,19 @@ class MindWords
|
|
129
164
|
@lines = tag_sort().lines
|
130
165
|
self
|
131
166
|
end
|
167
|
+
|
168
|
+
def to_a()
|
169
|
+
|
170
|
+
@lines.map do |x|
|
171
|
+
s, rawtags = x.split(/(?= #)/,2)
|
172
|
+
[s, rawtags.scan(/(?<=#)\w+/)]
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
def to_h()
|
178
|
+
to_a.to_h
|
179
|
+
end
|
132
180
|
|
133
181
|
def to_hashtags()
|
134
182
|
@hashtags
|
@@ -139,6 +187,8 @@ class MindWords
|
|
139
187
|
sort ? a2tree(tree_sort(LineTree.new(@outline).to_a)) : @outline
|
140
188
|
end
|
141
189
|
|
190
|
+
alias to_tree to_outline
|
191
|
+
|
142
192
|
def to_s(colour: false)
|
143
193
|
|
144
194
|
header = "<?mindwords?>\n\n"
|
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.5.
|
4
|
+
version: 0.5.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: 2021-
|
38
|
+
date: 2021-02-25 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
|