mindwords 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3dce3985e118c20bf9564d5d5d80b471cfb1422387d02a9b2faedaa29ee6b847
4
- data.tar.gz: c74d01bae140212eb3e3d8f6a65fed89a1fde92920fd4924f4f32b15cc8fd901
3
+ metadata.gz: 9278b3fbcf3da1caed6dd21c274bb8b26e12dec525d05ecf322965b083e8c884
4
+ data.tar.gz: 8c9b4a404897fd119b64f13e7140daecc8eb55f404595e001508b0b8dd031b7d
5
5
  SHA512:
6
- metadata.gz: 7867fb1ac1224ec7d5f4515b450182d01344fe95cd4002409fe45eeb59a6cedaa7ba07074c1f22030d332fe3a09e4290c1aa0243e5033575898b098328aa160c
7
- data.tar.gz: 0c10f58552946d28c0a81fca5e1ce078575ec8c7402e2b64bc8c56e1b24c0979053356898af377f036d7bdabfd9e4957bc87e970eded50a7ee3d94703ab75b88
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���'�>g75,�0!S)w��ğS I�P�]�<��H�嗗i���^s�.���� ��4��g֎�����.�T��`H��<��)���Kt�]���c�Nu����XQ9�)/P�N_�����;��I�9�
2
- ����41 ����5=��x�����΁�Bs5rB���� t���G��eʞ9���3��R�򙮿�Hp|�0-��I��cX�sk�謷�էW�<L�3Ul=hvɺ���C`z_�[�֑xNf8 ���<a��ձ
3
- r�b��Ȥ�7;�B=�r���
1
+ ��(Ԏ���Z��C��"U��
2
+ ��:�AG�x����`.yK�;-������`��:��X�� T��jHi+�H�? ~zV��KvAY_��(�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.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-01-31 00:00:00.000000000 Z
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