smile.nlp
Class SimpleText
- java.lang.Object
-
- smile.nlp.Text
-
- smile.nlp.SimpleText
-
- All Implemented Interfaces:
- AnchorText, TextTerms
public class SimpleText extends Text implements TextTerms, AnchorText
A list-of-words representation of documents.
-
-
Constructor Summary
Constructors Constructor and Description SimpleText(java.lang.String id, java.lang.String title, java.lang.String body, java.lang.String[] words)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SimpleTextaddAnchor(java.lang.String linkLabel)Add a link label to the anchor text.booleanequals(java.lang.Object obj)java.lang.StringgetAnchor()Returns the anchor text if any.inthashCode()intmaxtf()Returns the maximum term frequency over all terms in the document.SimpleTextsetAnchor(java.lang.String anchor)Sets the anchor text.intsize()Returns the number of words.inttf(java.lang.String term)Returns the term frequency.java.lang.StringtoString()java.lang.Iterable<java.lang.String>unique()Returns the iterator of unique words.java.lang.Iterable<java.lang.String>words()Returns the iterator of the words of the document.
-
-
-
Constructor Detail
-
SimpleText
public SimpleText(java.lang.String id, java.lang.String title, java.lang.String body, java.lang.String[] words)Constructor.- Parameters:
id- the id of document.words- the word list of document.
-
-
Method Detail
-
size
public int size()
Description copied from interface:TextTermsReturns the number of words.
-
words
public java.lang.Iterable<java.lang.String> words()
Description copied from interface:TextTermsReturns the iterator of the words of the document. The stop words and punctuations may be removed.
-
unique
public java.lang.Iterable<java.lang.String> unique()
Description copied from interface:TextTermsReturns the iterator of unique words.
-
tf
public int tf(java.lang.String term)
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
public java.lang.String 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
-
setAnchor
public SimpleText setAnchor(java.lang.String anchor)
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
-
addAnchor
public SimpleText addAnchor(java.lang.String linkLabel)
Description copied from interface:AnchorTextAdd a link label to the anchor text.- Specified by:
addAnchorin interfaceAnchorText
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG