pxindex-builder 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/pxindex-builder.rb +21 -20
- data.tar.gz.sig +0 -0
- metadata +28 -25
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8d16d5f32fb73bc13efabdea2aa410e492cd25a58d69de231b859add956ea537
|
4
|
+
data.tar.gz: b618cd9d89f9719ca8e27eef1941af060cef59e044acb38daf4e0d1bdc16d59e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c98340121ac8b0633126ad2921a9426f6b514b61bc7a57f13da0b0e0060cb1d5b597dd7418ea39c2b837d6dd67050c72b2ce9231656c6a57beb384b66d8994e4
|
7
|
+
data.tar.gz: c9ff7177b2616fce22d6d0f2508ec8acd9c9816257c92183a2fe54fcbb1803669672dccb4d5faf2e7ef94d1a14e180f1a5106b61e7ceb05c05fa88e87a483345
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/pxindex-builder.rb
CHANGED
@@ -2,38 +2,39 @@
|
|
2
2
|
|
3
3
|
# file: pxindex-builder.rb
|
4
4
|
|
5
|
-
require 'line-tree'
|
5
|
+
require 'line-tree' # *new*
|
6
6
|
require 'wordsdotdat'
|
7
7
|
require 'phrase_lookup'
|
8
8
|
require 'polyrex-builder'
|
9
|
+
require 'rxfreader'
|
9
10
|
|
10
11
|
|
11
12
|
class PxIndexBuilder
|
12
13
|
|
13
14
|
attr_reader :to_xml, :to_h, :to_s
|
14
|
-
|
15
|
+
|
15
16
|
def initialize(obj, debug: false, ignore: [])
|
16
|
-
|
17
|
+
|
17
18
|
@debug = debug
|
18
19
|
puts 'inside initialize: ' if @debug
|
19
|
-
|
20
|
+
|
20
21
|
if obj.is_a? String then
|
21
|
-
|
22
|
-
s, _ =
|
23
|
-
|
22
|
+
|
23
|
+
s, _ = RXFReader.read(obj)
|
24
|
+
|
24
25
|
s =~ /^---/ ? import_phrases(YAML.load(s), s, ignore) : import_index(s)
|
25
|
-
|
26
|
+
|
26
27
|
elsif obj.is_a? Hash
|
27
28
|
import_phrases obj, s, ignore
|
28
29
|
end
|
29
|
-
|
30
|
+
|
30
31
|
end
|
31
|
-
|
32
|
-
|
32
|
+
|
33
|
+
|
33
34
|
private
|
34
|
-
|
35
|
+
|
35
36
|
def import_index(raw_s)
|
36
|
-
|
37
|
+
|
37
38
|
# find the entries which aren't on the main index
|
38
39
|
s = raw_s.sub(/<[^>]+>\n/,'')
|
39
40
|
doc = LineTree.new(s, debug: @debug).to_doc(encapsulate: true)
|
@@ -44,18 +45,18 @@ class PxIndexBuilder
|
|
44
45
|
puts 'a2: ' + a2.inspect if @debug
|
45
46
|
a3 = a2.map(&:rstrip) - a.map(&:rstrip)
|
46
47
|
puts 'a3:' + a3.inspect if @debug
|
47
|
-
|
48
|
+
|
48
49
|
# add the new entries to the main index
|
49
50
|
s << "\n" + a3.join("\n")
|
50
51
|
|
51
52
|
s.prepend '<?ph schema="entries/section[heading]/entry[title, url]"?>
|
52
53
|
|
53
54
|
'
|
54
|
-
|
55
|
+
|
55
56
|
@to_s = s
|
56
|
-
|
57
|
+
|
57
58
|
end
|
58
|
-
|
59
|
+
|
59
60
|
def import_phrases(h, s, ignore=[])
|
60
61
|
|
61
62
|
words = h.keys.join(' ').split(/ +/).map {|x| x[/\w+/]}.uniq\
|
@@ -65,11 +66,11 @@ class PxIndexBuilder
|
|
65
66
|
.reject {|x| x.length < 4 and !WordsDotDat.list.include? x.downcase}\
|
66
67
|
.group_by(&:chr).sort
|
67
68
|
|
68
|
-
pl = PhraseLookup.new s
|
69
|
+
pl = PhraseLookup.new s
|
69
70
|
|
70
71
|
index = words.map do |letter, list|
|
71
72
|
|
72
|
-
a = list.map do |w|
|
73
|
+
a = list.map do |w|
|
73
74
|
phrases = pl.q(w)
|
74
75
|
[w, phrases, phrases.map {|x| h[x] }.max]
|
75
76
|
end
|
@@ -92,7 +93,7 @@ class PxIndexBuilder
|
|
92
93
|
rows.map do |x|
|
93
94
|
|
94
95
|
head, body, _ = x
|
95
|
-
|
96
|
+
|
96
97
|
a = [{title: head}]
|
97
98
|
a << scan(body) if body and body.any?
|
98
99
|
a
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pxindex-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMjIzMTkwNTAxWhcN
|
15
|
+
MjMwMjIzMTkwNTAxWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDW85TI
|
17
|
+
/Z5K4vUfBYKBHGpILk6JxCmBYJJFmYPjDQwuwfrmrU5lvPUDAdp9kQycXcKVc5Uy
|
18
|
+
XhKfobl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2RcJDMBw64synIBtM
|
33
|
+
zK1YL6OKysdroRHd7PMfui82y5TazNdbs+a0mfLslnYmuD1Qyz48G0RBf9uiM7NN
|
34
|
+
kWVg9FrcOSwREdGPQo8Nm5XBrnjNQ5kMt0dkD0hYl/6c3GlVZnNnTQtTVrI2U7/0
|
35
|
+
C5ZqDgzQ3HQLwk8KbRjlBIdMHVjHfLaqNRllK8YWKSim4ZMMaBUnTZeZE8tRUiV6
|
36
|
+
5sJpSrhbx0blESXn24F1Nx/U
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: line-tree
|
@@ -114,7 +118,7 @@ dependencies:
|
|
114
118
|
- !ruby/object:Gem::Version
|
115
119
|
version: 0.3.0
|
116
120
|
description:
|
117
|
-
email:
|
121
|
+
email: digital.robertson@gmail.com
|
118
122
|
executables: []
|
119
123
|
extensions: []
|
120
124
|
extra_rdoc_files: []
|
@@ -139,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
143
|
- !ruby/object:Gem::Version
|
140
144
|
version: '0'
|
141
145
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.6.13
|
146
|
+
rubygems_version: 3.2.22
|
144
147
|
signing_key:
|
145
148
|
specification_version: 4
|
146
149
|
summary: Builds a Polyrex index (pxindex) XML document from a YAML document or an
|
metadata.gz.sig
CHANGED
Binary file
|