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
ConstructorDescriptionSimpleText
(String id, String title, String body, String[] words) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdds a link label to the anchor text.boolean
Returns the anchor text if any.int
hashCode()
int
maxtf()
Returns the maximum term frequency over all terms in the document.Sets the anchor text.int
size()
Returns the number of words.int
Returns 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:TextTerms
Returns the number of words. -
words
Description copied from interface:TextTerms
Returns the iterator of the words of the document. The stop words and punctuations may be removed. -
unique
Description copied from interface:TextTerms
Returns the iterator of unique words. -
tf
Description copied from interface:TextTerms
Returns the term frequency. -
maxtf
public int maxtf()Description copied from interface:TextTerms
Returns 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:
getAnchor
in 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:
setAnchor
in interfaceAnchorText
- Parameters:
anchor
- the anchor text.- Returns:
- this object.
-
addAnchor
Description copied from interface:AnchorText
Adds a link label to the anchor text.- Specified by:
addAnchor
in interfaceAnchorText
- Parameters:
linkLabel
- the link label.- Returns:
- this object.
-
toString
-
equals
-
hashCode
public int hashCode()
-