smile.nlp
Class SimpleCorpus
- java.lang.Object
-
- smile.nlp.SimpleCorpus
-
-
Constructor Summary
Constructors Constructor and Description SimpleCorpus()Constructor.SimpleCorpus(SentenceSplitter splitter, Tokenizer tokenizer, StopWords stopWords, Punctuations punctuations)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Textadd(java.lang.String id, java.lang.String title, java.lang.String body)Add a document to the corpus.intgetAverageDocumentSize()Returns the average size of documents in the corpus.intgetBigramFrequency(Bigram bigram)Returns the total frequency of the bigram in the corpus.java.util.Iterator<Bigram>getBigrams()Returns an iterator over the bigrams in the corpus.longgetNumBigrams()Returns the number of bigrams in the corpus.intgetNumDocuments()Returns the number of documents in the corpus.intgetNumTerms()Returns the number of unique terms in the corpus.intgetTermFrequency(java.lang.String term)Returns the total frequency of the term in the corpus.java.util.Iterator<java.lang.String>getTerms()Returns an iterator over the terms in the corpus.java.util.Iterator<Relevance>search(RelevanceRanker ranker, java.lang.String term)Returns an iterator over the set of documents containing the given term in descending order of relevance.java.util.Iterator<Relevance>search(RelevanceRanker ranker, java.lang.String[] terms)Returns an iterator over the set of documents containing (at least one of) the given terms in descending order of relevance.java.util.Iterator<Text>search(java.lang.String term)Returns an iterator over the set of documents containing the given term.longsize()Returns the number of words in the corpus.
-
-
-
Constructor Detail
-
SimpleCorpus
public SimpleCorpus()
Constructor.
-
SimpleCorpus
public SimpleCorpus(SentenceSplitter splitter, Tokenizer tokenizer, StopWords stopWords, Punctuations punctuations)
Constructor.- Parameters:
splitter- the sentence splitter.tokenizer- the word tokenizer.stopWords- the set of stop words to exclude.punctuations- the set of punctuation marks to exclude. Set to null to keep all punctuation marks.
-
-
Method Detail
-
add
public Text add(java.lang.String id, java.lang.String title, java.lang.String body)
Add a document to the corpus.
-
size
public long size()
Description copied from interface:CorpusReturns the number of words in the corpus.
-
getNumDocuments
public int getNumDocuments()
Description copied from interface:CorpusReturns the number of documents in the corpus.- Specified by:
getNumDocumentsin interfaceCorpus
-
getNumTerms
public int getNumTerms()
Description copied from interface:CorpusReturns the number of unique terms in the corpus.- Specified by:
getNumTermsin interfaceCorpus
-
getNumBigrams
public long getNumBigrams()
Description copied from interface:CorpusReturns the number of bigrams in the corpus.- Specified by:
getNumBigramsin interfaceCorpus
-
getAverageDocumentSize
public int getAverageDocumentSize()
Description copied from interface:CorpusReturns the average size of documents in the corpus.- Specified by:
getAverageDocumentSizein interfaceCorpus
-
getTermFrequency
public int getTermFrequency(java.lang.String term)
Description copied from interface:CorpusReturns the total frequency of the term in the corpus.- Specified by:
getTermFrequencyin interfaceCorpus
-
getBigramFrequency
public int getBigramFrequency(Bigram bigram)
Description copied from interface:CorpusReturns the total frequency of the bigram in the corpus.- Specified by:
getBigramFrequencyin interfaceCorpus
-
getTerms
public java.util.Iterator<java.lang.String> getTerms()
Description copied from interface:CorpusReturns an iterator over the terms in the corpus.
-
getBigrams
public java.util.Iterator<Bigram> getBigrams()
Description copied from interface:CorpusReturns an iterator over the bigrams in the corpus.- Specified by:
getBigramsin interfaceCorpus
-
search
public java.util.Iterator<Text> search(java.lang.String term)
Description copied from interface:CorpusReturns an iterator over the set of documents containing the given term.
-
search
public java.util.Iterator<Relevance> search(RelevanceRanker ranker, java.lang.String term)
Description copied from interface:CorpusReturns an iterator over the set of documents containing the given term in descending order of relevance.
-
search
public java.util.Iterator<Relevance> search(RelevanceRanker ranker, java.lang.String[] terms)
Description copied from interface:CorpusReturns an iterator over the set of documents containing (at least one of) the given terms in descending order of relevance.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG