lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl wettin <>
Subject Re: is there any n-gram analyzer available??
Date Fri, 22 Sep 2006 12:59:43 GMT
On Fri, 2006-09-22 at 14:19 +0530, heritrix.lucene wrote:
> i am looking for a analyzer that chops a given string into its n-grams.
> Basically, I want to index 3-grams and more upto the limit of a word. Can
> anybody tell me if there is any analyzer is available for this.

It's not that much to it. But you might want to make it a filter.

  for (int size=3; size<word.length(); size++) {
     for (int pos=0; pos<word.length()-size; pos++) {
        String gram = word.subString(pos, size);
        // do your thing

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message