java.lang.Object
com.pervasive.datarush.analytics.text.NGram
- All Implemented Interfaces:
Comparable<NGram>
Implementation of an n-gram. An n-gram is a contiguous sequence of n items from a
given sequence of text or speech. An item can consist of characters, words, or strings,
although typically they model word relationships.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
NGram
public NGram()Default constructor for empty NGram -
NGram
Creates an NGram of degree n consisting of a list of words.- Parameters:
n- The degree of the NGramwords- The words of the NGram
-
NGram
Creates an NGram of degree n consisting of the list of words.- Parameters:
n- The degree of the NGramwords- The words of the NGram
-
-
Method Details
-
getN
public int getN()Gets the N used by this NGram.- Returns:
- the N used by this NGram
-
getWords
Gets the words in this NGram.- Returns:
- the words in this NGram
-
getWordN
Get the Nth word in this NGram. Uses 0 for the starting index.- Parameters:
index- the index of the word in the NGram- Returns:
- the word at index in this NGram
-
toString
-
iterator
Get an iterator over the words of the NGram.- Returns:
- iterator over the words of the NGram
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<NGram>
-