N-grams and N-logs with Ruby

N-grams are useful, in spell-checking, for example. I've been working on a project where I need to extract the word-level equivalent of n-grams from phrases. Lacking a better name, I call them n-logs. As one might expect, Ruby makes this easy. Here is a pipe-friendly script:

Modifying this script to create n-grams instead is trivial.

0 comments: