smile.nlp
Class NGram
- java.lang.Object
-
- smile.nlp.NGram
-
- All Implemented Interfaces:
- java.lang.Comparable<NGram>
public class NGram extends java.lang.Object implements java.lang.Comparable<NGram>
An n-gram is a contiguous sequence of n words from a given sequence of text. An n-gram of size 1 is referred to as a unigram; size 2 is a bigram; size 3 is a trigram.
-
-
Field Summary
Fields Modifier and Type Field and Description intfreqFrequency of n-gram in the corpus.java.lang.String[]wordsImmutable word sequences.
-
Constructor Summary
Constructors Constructor and Description NGram(java.lang.String[] words)Constructor.NGram(java.lang.String[] words, int freq)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompareTo(NGram o)booleanequals(java.lang.Object obj)inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
words
public final java.lang.String[] words
Immutable word sequences.
-
freq
public int freq
Frequency of n-gram in the corpus.
-
-
Constructor Detail
-
NGram
public NGram(java.lang.String[] words)
Constructor.- Parameters:
words- the n-gram word sequence.
-
NGram
public NGram(java.lang.String[] words, int freq)Constructor.- Parameters:
words- the n-gram word sequence.freq- the frequency of n-gram in the corpus.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG