pxindex-builder 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/pxindex-builder.rb +58 -0
- data.tar.gz.sig +0 -0
- metadata +127 -0
- metadata.gz.sig +2 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 900c67db65c6a8baccf06262ec1ecd641f6ca752
|
4
|
+
data.tar.gz: 8fc87cd446c191f1f16c3b13b6fa50377f8f6ad5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: af66a01f5694fdcc950333c2e5c9453e96b75301a1dac22324375ccf85b434cece960e05956a0f0265f7427314e6532dfd6c172cf269b28aff5991eae8dee201
|
7
|
+
data.tar.gz: e590f621ecad5aa962b33417027156e129f2e529cf184ffbec37a478a6027519f16779cc061af40d74691ca8bb7487f3829fd4002c401b03d0aaae516100bea0
|
checksums.yaml.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: pxindex-builder.rb
|
4
|
+
|
5
|
+
require 'wordsdotdat'
|
6
|
+
require 'phrase_lookup'
|
7
|
+
require 'polyrex-builder'
|
8
|
+
|
9
|
+
|
10
|
+
class PxIndexBuilder
|
11
|
+
|
12
|
+
attr_reader :to_xml
|
13
|
+
|
14
|
+
def initialize(raw_s, ignore=[])
|
15
|
+
|
16
|
+
s, _ = RXFHelper.read(raw_s)
|
17
|
+
|
18
|
+
h = YAML.load(s)
|
19
|
+
words = h.keys.join(' ').split(/ +/).map {|x| x[/\w+/]}.uniq\
|
20
|
+
.reject {|x| x.length < 3}\
|
21
|
+
.reject {|x| ignore.include? x}\
|
22
|
+
.reject {|x| x.length < 4 and !WordsDotDat.list.include? x.downcase}\
|
23
|
+
.group_by(&:chr).sort
|
24
|
+
|
25
|
+
pl = PhraseLookup.new s
|
26
|
+
|
27
|
+
index = words.map do |letter, list|
|
28
|
+
|
29
|
+
a = list.map do |w|
|
30
|
+
phrases = pl.q(w)
|
31
|
+
[w, phrases, phrases.map {|x| h[x] }.max]
|
32
|
+
end
|
33
|
+
|
34
|
+
[letter, a.sort_by(&:last).reverse]
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
@to_xml = PolyrexBuilder.new(scan(index), parents: %i(entry)).to_xml
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def scan(rows)
|
45
|
+
|
46
|
+
rows.map do |x|
|
47
|
+
|
48
|
+
head, body, _ = x
|
49
|
+
|
50
|
+
a = [{title: head}]
|
51
|
+
a << scan(body) if body and body.any?
|
52
|
+
a
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pxindex-builder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE3MTAyMDIwMTAxOVoXDTE4MTAyMDIwMTAxOVowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC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E-----
|
34
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: wordsdotdat
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.1
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.1
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: phrase_lookup
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.1'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.1.3
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.1'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.3
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: polyrex-builder
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.2'
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.2.0
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0.2'
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.2.0
|
96
|
+
description:
|
97
|
+
email: james@jamesrobertson.eu
|
98
|
+
executables: []
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- lib/pxindex-builder.rb
|
103
|
+
homepage: https://github.com/jrobertson/pxindex-builder
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.6.13
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: Builds a Polyrex index (pxindex) XML document from a YAML document
|
127
|
+
test_files: []
|
metadata.gz.sig
ADDED