liveblog-indexer 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 56937c6f8eb2b40f417e73a5512fa60593647517
4
+ data.tar.gz: a87152912b799beab92e305565065ee391364b32
5
+ SHA512:
6
+ metadata.gz: 9e99db1533e3279c4d4b70ddb58609fb5e234e8e9124d401bff3970d5e8d2ffa5671556d1ec0e6706c0212868bde0c469f5e07e5a85609838aa5494df7bf9426
7
+ data.tar.gz: 9d58190002e8cb8b490c61879f47901fe07c0ec374546dd52fae46d0c5c95ec8a6dce1c92eff850e957c0d776fe99f59577eb5c32f1bf46c2512a516140f385e
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,5 @@
1
+ 5>Y�9��&��Ʈfh��/Ec;� �V����
2
+ ���f�d�ߟ��Q��z��,�$��
3
+ 9�%ħ
4
+ �U�����������.��=��o!,pʅ�\wφ��|�E�W����/A�FV^=��t��/���e:�Z9 ��2�t�|�z_,����J�a�Ǹ}b ���f���F��������+����亰�v��j'K�ѳ��(��^>g���l��
5
+ ���N�DEN٘C}��?HњCc��>��`%?j
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: liveblog-indexer.rb
4
+
5
+ require 'xws'
6
+ require 'json'
7
+ require 'polyrex'
8
+
9
+
10
+ class LiveBlogIndexer
11
+
12
+ def initialize(filepath=nil)
13
+
14
+ @master = if filepath and File.exists? filepath then
15
+ JSON.parse(File.read(filepath))
16
+ else
17
+ {}
18
+ end
19
+
20
+ @xws = XWS.new
21
+
22
+ end
23
+
24
+ def add_index(src)
25
+
26
+ doc = Rexle.new(RXFHelper.read(src).first )
27
+ sections = doc.root.xpath 'records/section'
28
+
29
+ sections.each do |section|
30
+
31
+ url = "%s/#%s" % [src[/^https?:\/\/[^\/]+(.*)(?=\/formatted.xml$)/,1], \
32
+ section.attributes[:id]]
33
+
34
+ h = @xws.scan section.element('details')
35
+
36
+ h.each do |k, v|
37
+
38
+ word, count = k, v
39
+
40
+ keyword = @master[word]
41
+
42
+ if keyword then
43
+
44
+ keyword[url] = count
45
+
46
+ else
47
+
48
+ @master[word] = {}
49
+ @master[word][url] = count
50
+
51
+ end # /keyword
52
+ end # /h
53
+ end # /section
54
+ end # /add_index
55
+
56
+
57
+ def save(filepath=nil)
58
+
59
+ File.write filepath, @master.to_json
60
+ puts 'saved ' + File.basename(filepath)
61
+
62
+ px = Polyrex.new 'words/key[word]/location[url, wordcount]'
63
+
64
+ @master.each do |k,rows|
65
+ px.create.key(word: k) do |create|
66
+ rows.each do |k, v|
67
+ create.location url: k, wordcount: v
68
+ end
69
+ end
70
+ end
71
+ pxfilepath = File.join(File.dirname(filepath), 'search-index.xml')
72
+ px.save pxfilepath, options: {pretty: true}
73
+ puts 'saved ' + File.basename(pxfilepath)
74
+ end
75
+
76
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: liveblog-indexer
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
+ 8ixkARkWAmV1MB4XDTE1MTExMjIxMTkyMVoXDTE2MTExMTIxMTkyMVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADC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36
+ - !ruby/object:Gem::Dependency
37
+ name: xws
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: polyrex
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.0'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.0.11
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '1.0'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.11
76
+ description:
77
+ email: james@r0bertson.co.uk
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/liveblog-indexer.rb
83
+ homepage: https://github.com/jrobertson/liveblog-indexer
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.4.8
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: This gem is under development. Generates a Liveblog indexed file in JSON
107
+ format as well as Polyrex format.
108
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ |�U;\� @�M�hN��3��,��lV�0?�\�if*��+Z'5oX�1�Æ�Ԗ���[�g�*�TE`0 ��aVh�!��C�6�eA�ڒEO-M����Y����2�w�+Q��p��Z��)ɂZV�h2j���b���k�G�CV��\ -������˥���`��� ��[z&�k���Q�����M�p��<��F�q���U�����ػ��3�O��ۙhJ�������?P&����H�MD��{��/