/
README
72 lines (46 loc) · 2.06 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
= pms - Poor Man's Search
== VERSION
This documentation refers to pms version 0.0.4
== DESCRIPTION
Provides a simple searching facility for (nearly) arbitrary input. It allows
searching by Strings (exact match) or Regexps (full control, but slower).
Boolean operators AND, OR, and NOT are supported, as well as proximity
operators NEAR (with configurable distance) and ADJACENT (taking order into
account). You can chain operators and also group them into sub-queries.
Inspiration came from a discussion on ruby-talk, starting with message
ruby-talk:322014[http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/322014],
but PMS has a more document-centric attitude (everything that <tt>input#each</tt>
yields is considered a document of its own).
Example:
require 'pms/ext'
text = <<EOT
Hello world, how are you today? I said "Hello"
to the other guy but he would not answer although
all the world could hear me.
EOT
search = text.search('hello').near('world', 3)
p search.results
#=> [0]
p search.results_with_positions
#=> {0=>[0, 8]}
p search.matches
#=> ["Hello world, how are you today? I said \"Hello\"\n"]
You can find more examples in the <tt>spec/</tt> directory.
== LINKS
<b></b>
Documentation:: <http://pms.rubyforge.org/>
Source code:: <http://github.com/blackwinter/pms>
Rubyforge project:: <http://rubyforge.org/projects/pms>
== AUTHORS
* Jens Wille <mailto:jens.wille@uni-koeln.de>
== LICENSE AND COPYRIGHT
Copyright (C) 2008-2010 Jens Wille
pms is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
pms is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
pms. If not, see <http://www.gnu.org/licenses/>.