phrase_lookup 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: 32b11a0a31d6b4afb590acb15a6f74018bf36537
4
+ data.tar.gz: 170ff1378697e0cf671fea182b792081cfb0b300
5
+ SHA512:
6
+ metadata.gz: 55484bf90fd79d9eb6fb677b14609f551fa7a8d235c87d94ca191de4cdd32fa48242913adc732ddc5bcb330c3a05f9395f82a307430a6bfd087f5a65d506c0b3
7
+ data.tar.gz: 602aa7b23dea6b1fec9d24bfac47048eca53e24efc8dd2c11909cf2b29e44e476024652c5297ef9096256eed9ebb6c93945e17479e431058d0c7c9e728adfc71
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,4 @@
1
+ �<I�͋K����ћ�k Sɟ���\����B��`į�Z��)Z�����ו�Oq��D�Qx���:��8LD
2
+ r�����# t�ŀ*�Yzm�^�@��4s�v(�JQҳ�l�)|
3
+ !��I��H#�o-��;,wENG=y��נ/���*�1߄�xL��I�~^k]V>;�����>�s��t�e2g��
4
+ �S&0z�U�Y��X{.S��nD��ܡ0��om
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: phrase_lookup.rb
4
+
5
+ # description: Returns a list of matching phrases from plain text
6
+ # idea: return the list sorted by rank
7
+
8
+ require 'rxfhelper'
9
+
10
+
11
+ class PhraseLookup
12
+
13
+ def initialize(raw_s=nil)
14
+
15
+ @a = []
16
+
17
+ if raw_s then
18
+
19
+ s, _ = RXFHelper.read(raw_s)
20
+ parse s
21
+
22
+ end
23
+
24
+ end
25
+
26
+ def lookup(s, limit: 10)
27
+
28
+ a1 = @a.grep /^#{s}/i
29
+ a2 = @a.grep /#{s}/i
30
+
31
+ return (a1 + a2).uniq.take 10
32
+ end
33
+
34
+ alias q lookup
35
+
36
+ def parse(s)
37
+
38
+ @a = s.strip.lines.map(&:strip)
39
+
40
+ end
41
+
42
+ end
43
+
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: phrase_lookup
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
+ 8ixkARkWAmV1MB4XDTE3MTAxMTExMzUxNVoXDTE4MTAxMTExMzUxNVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBALxTjEVtvsr1rCCnEdMkyx9b0CYjz3q90IaS8rGklhAO6u90AYfLTahxSTY/
19
+ U6ibpX2HFhu1mi03mq+JiNEkpsuk4w7/+l4lYlP3HtIYmMdssiwZnH+QyB4aP7R4
20
+ isso+Op95NkVNRw0oVTDjtpNl0IvonXB/6yGVRla9J8Erz9MLW89f4sHP0FGexzw
21
+ r/BGLqtVUNxha8hnH/BVyjkkYMKBYNpgOshZ313gmT4sPfavckbNbsUlhWHN+fuZ
22
+ i1yeuU231IihQyo45w8z/OsGhnXheDziHaEQ9KYo2jY2G/smWyfByj0RNQ1szBHj
23
+ H3HrfB401uYqre46iZjGpGP53/UCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUZRNz6mn0Jnt/0zxQhfGhfnHM+zAwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAo+OjhDsb
27
+ I4O7uXvyMprFsmrPxLqJQZiG3Ca4biUSx9dTji5jwPctqzXUxB8shQV6iI0J2G/9
28
+ tghJOAqy18lXhlS0eBqZNuXS9rpDfiKOIeiD4X7GRbtIMmg68HKnW2l72ij5d+ay
29
+ oUN/NTJOCHKrgJ48XxdHG/4eYyQDXWVtduAitqNXvMREeP8eP6j2icBXP15bZpgY
30
+ DUWq9PrW+gmCWIDmnMtW8YTWTR+FnI+uGhcoFYucP1uKUv9J5EQp/B40m1Qoxnz6
31
+ m1kU5vbLTlJYenStfwtXDnHL7ul9y7MaPO+5UyjWWUuz8iRexmjB/HymNMK7NwPv
32
+ YzZJ2MWOCulgfw==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-10-11 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rxfhelper
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.4'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.4.3
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.4'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.4.3
56
+ description:
57
+ email: james@jamesrobertson.eu
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/phrase_lookup.rb
63
+ homepage: https://github.com/jrobertson/phrase_lookup
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.6.13
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Returns a list of matching phrases from plain text
87
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �c�4SI1�>�gBuYU��:�