Package smile.nlp
Class SimpleText
java.lang.Object
smile.nlp.Text
smile.nlp.SimpleText
- All Implemented Interfaces:
AnchorText,TextTerms
A list-of-words representation of documents.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleText(String id, String title, String body, String[] words) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdds a link label to the anchor text.booleanReturns the anchor text if any.inthashCode()intmaxtf()Returns the maximum term frequency over all terms in the document.Sets the anchor text.intsize()Returns the number of words.intReturns the term frequency.toString()unique()Returns the iterator of unique words.words()Returns the iterator of the words of the document.
-
Constructor Details
-
SimpleText
Constructor.- Parameters:
id- the id of document.title- the title of document.body- the text body of document.words- the word list of document.
-
-
Method Details
-
size
public int size()Description copied from interface:TextTermsReturns the number of words. -
words
Description copied from interface:TextTermsReturns the iterator of the words of the document. The stop words and punctuations may be removed. -
unique
Description copied from interface:TextTermsReturns the iterator of unique words. -
tf
Description copied from interface:TextTermsReturns the term frequency. -
maxtf
public int maxtf()Description copied from interface:TextTermsReturns the maximum term frequency over all terms in the document. -
getAnchor
Returns the anchor text if any. The anchor text is the visible, clickable text in a hyperlink. The anchor text is all the anchor text in the corpus pointing to this text.- Specified by:
getAnchorin interfaceAnchorText- Returns:
- the anchor text.
-
setAnchor
Sets the anchor text. Note that anchor is all link labels in the corpus pointing to this text. So addAnchor is more appropriate in most cases.- Specified by:
setAnchorin interfaceAnchorText- Parameters:
anchor- the anchor text.- Returns:
- this object.
-
addAnchor
Description copied from interface:AnchorTextAdds a link label to the anchor text.- Specified by:
addAnchorin interfaceAnchorText- Parameters:
linkLabel- the link label.- Returns:
- this object.
-
toString
-
equals
-
hashCode
public int hashCode()
-