n gram generation from a sentence using -'java,lucene,nlp,n-gram'

n gram generation from a sentence  using -'java,lucene,nlp,n-gram'

How to generate an n-gram of a string like:

String Input="This is my car."

I want to generate n-gram with this input:

Input Ngram size = 3

Output should be:


This is
is my
my car

This is my
is my car

Give some idea in Java, how to implement that or if any library is available for it.

I am trying to use this NGramTokenizer but its giving n-gram's of character sequence and I want n-grams of word sequence.

asked Sep 7, 2015 by rajesh
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.