Forum: Ferret Searching for terms in free-form text

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sonia Lyris (Guest)
on 2007-02-19 21:15
(Received via mailing list)
What is the best way to search a (possibly long) string of free-form
text (like, say, an email) for occurrances of some set of key phrases
of interest?  Fuzzy or not; I'll take what I can get.

Thanks in advance!

--
Sonia Lyris  | removed_email_address@domain.invalid
Jens K. (Guest)
on 2007-02-20 15:16
(Received via mailing list)
Hi!

On Mon, Feb 19, 2007 at 10:44:07AM -0800, Sonia Lyris wrote:
> What is the best way to search a (possibly long) string of free-form
> text (like, say, an email) for occurrances of some set of key phrases
> of interest?  Fuzzy or not; I'll take what I can get.

could you be a little bit more specific in what you want to do? For
finding out if a phrase occurs in a single piece of text a regex
could be sufficient, but I doubt that's what you're asking for :-)

of course you can do this with ferret, too:

require 'rubygems'
require 'ferret'
index = Ferret::I.new
index << 'your text here'
top_docs = index.search 'text'
puts 'found text' if top_docs.total_hits > 0


Jens

--
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
removed_email_address@domain.invalid | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
This topic is locked and can not be replied to.