O'Reilly logo

Text Processing with Ruby by Rob Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example: Fuzzy Searching

At this point, we’ve extracted article text from web pages and then created keyword indexes of those articles based on the nouns that occurred most frequently within them.

Now let’s explore how we could search our new database for articles that match a given query. More usefully, you’ll learn how you can perform a fuzzy search—a search that matches not just the exact query you give it, but also things that are similar to it.

Our first step is to write a simple and exact search. Then we can look at how to improve both the storage of the index and the querying process to broaden the text that is matched by it.

A Simple Search

The simplest search we could write would be to, given a search term, list all the articles that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required