dxtitle_search 0.3.1 → 0.3.2

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: 2ddaa5dc16334b0c89dfca449e875a99e35ff110eab534aa2b0b3b8ff9299dd4
4
- data.tar.gz: f236adf29de45746e766880c6da22f78b3829d192f91e3cf8a8ad25a1fe39452
3
+ metadata.gz: e227dc645595c967bf03dd213ea6846c7c9c438a26ee7db3fd059f464493f370
4
+ data.tar.gz: eccff27f864a56f00f0952d8ddd47a70eaeb2fca6eca24d961cf4c91d54f7387
5
5
  SHA512:
6
- metadata.gz: e19af732c9c6ff0c0a389c8b03ff4d1a0a5b932c047a74060c7853b1e52f135dba563b9195c71b1a1fd78313a988ab18dc88078db625a01b1f3e0ee9788eb025
7
- data.tar.gz: c34c280d1dcd920e613f49af75c0a45f2f1a900a1baae438033c6fd50422e11c8bbe1756040e1cdad2204c62f2625e06551943a7d6243563d5c55edadb0859e0
6
+ metadata.gz: db771d09b581573be92de6c65b79c3f635dbcb6187e0bc1d6a00c5d4042a3f13f4838696588d65cc9856be56ed5666047221204e5910fbe38e8aec42f075ee70
7
+ data.tar.gz: f39cbbb2ca067cfb4c307787b94dab70c7c0d34255037e24e9228b32f284ebbe6361523456d078659aa11e5e3e694ef6dfae3890b18b87ce90d2a707d618a14d
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -11,6 +11,7 @@ class DxTitleSearch
11
11
 
12
12
  @debug = debug
13
13
  @indexer = Indexer101.new debug: debug
14
+ @level = level
14
15
 
15
16
  s = if sources then
16
17
 
@@ -20,7 +21,7 @@ class DxTitleSearch
20
21
  puts 'a: ' + a.inspect if @debug
21
22
  @indexer.scan_dxindex a, level: level
22
23
 
23
- elsif obj and obj.lines.length < 2
24
+ elsif obj and (obj.is_a?(DxLite) or obj.is_a?(Dynarex)) or obj.lines.length < 2
24
25
 
25
26
  @indexer.scan_dxindex obj, level: level
26
27
 
@@ -43,9 +44,36 @@ class DxTitleSearch
43
44
 
44
45
  puts 'a3: ' + a3.inspect if @debug
45
46
 
47
+ @dx = Dynarex.new('results/result(title, url, date)').import(a3)
48
+
46
49
  def a3.to_dx()
47
50
  Dynarex.new('results/result(title, url, date)').import(self)
48
51
  end
52
+
53
+ def a3.to_tags()
54
+ a = self.map {|x| x[:title].scan(/(?<=#)(\w+)/)}.flatten
55
+ a.uniq.sort.map {|x| [x, a.count(x)]}
56
+ end
57
+
58
+ def a3.search(keywords)
59
+
60
+ dx = Dynarex.new('results/result(title, url, date)').import(self)
61
+
62
+ level = keywords[0] == '#' ? 0 : 1
63
+ dts = DxTitleSearch.new dx, level: level
64
+ dts.search keywords
65
+
66
+ end
67
+
68
+ def a3.tag_search(keywords)
69
+
70
+ dx = Dynarex.new('results/result(title, url, date)').import(self)
71
+
72
+ level = keywords[0] == '#' ? 0 : 1
73
+ dts = DxTitleSearch.new dx, level: level
74
+ dts.tag_search keywords
75
+
76
+ end
49
77
 
50
78
  return a3
51
79
 
@@ -54,6 +82,16 @@ class DxTitleSearch
54
82
  def tag_search(keywords)
55
83
  r = @indexer.lookup *keywords.split(/[\W]+(?=[\w]+)/).map {|x| "#" + x}
56
84
  r.map {|x| x.to_s[1..-1]}
57
- end
85
+ end
86
+
87
+ def to_tags()
88
+
89
+ a = @indexer.index.map do |key, value|
90
+ [key.to_s[1..-1], value.length]
91
+ end
92
+
93
+ a.sort_by(&:first)
94
+
95
+ end
58
96
 
59
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dxtitle_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '0.2'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.2.4
49
+ version: 0.2.5
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ dependencies:
56
56
  version: '0.2'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 0.2.4
59
+ version: 0.2.5
60
60
  description:
61
61
  email: digital.robertson@gmail.com
62
62
  executables: []
metadata.gz.sig CHANGED
Binary file