datamodel
Class Text

java.lang.Object
  extended by datamodel.Text

public class Text
extends java.lang.Object

Class representing a text. This entity contains the text and the specific terms in it.

Author:
Kjell-Inge Skogstad and Trond Řivind Eriksen

Constructor Summary
Text(int tid, java.lang.String text)
          Constructor creating a new text.
 
Method Summary
 void addTerm(java.lang.String term, int frequency, double weight)
          Method for adding a term to the text model.
 void appendText(java.lang.String text)
           
 void changeText(java.lang.String text)
           
 int getCluster()
           
 int getNoOfTokens()
           
 java.lang.String getPrintableTerms()
          Method returning a printable report of the terms in the text.
 java.util.ArrayList getTerms()
          Method returning all terms in the text.
 int getTid()
          Method returning the timestamp.
 boolean hasTerms()
          Method for getting wether terms are extracted or not.
 void removeAllTerms()
          Method used to reset the terms.
 Term removeTerm(Term term)
          Method for removing a term from the text.
 void setCluster(int cluster)
           
 java.lang.String toString()
          Method returning a string representation of the text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Text

public Text(int tid,
            java.lang.String text)
Constructor creating a new text. The specific terms are not produced and therefore only a empty list of terms are available.

Parameters:
tid - The timestamp
text - The text
Method Detail

changeText

public void changeText(java.lang.String text)

appendText

public void appendText(java.lang.String text)

getNoOfTokens

public int getNoOfTokens()

addTerm

public void addTerm(java.lang.String term,
                    int frequency,
                    double weight)
Method for adding a term to the text model. If term already exists, the new frequency is added. Weights are set to new weight.

Parameters:
term - The term

removeTerm

public Term removeTerm(Term term)
Method for removing a term from the text.

Parameters:
term - The term to be removed
Returns:
The term instance

removeAllTerms

public void removeAllTerms()
Method used to reset the terms. Empties the list of terms.


getTid

public int getTid()
Method returning the timestamp.

Returns:
The timestamp

getTerms

public java.util.ArrayList getTerms()
Method returning all terms in the text.

Returns:
Terms in the text

hasTerms

public boolean hasTerms()
Method for getting wether terms are extracted or not.

Returns:
True if has terms

getPrintableTerms

public java.lang.String getPrintableTerms()
Method returning a printable report of the terms in the text. The report includes information about frequency and weight.

Returns:
The report

toString

public java.lang.String toString()
Method returning a string representation of the text.

Overrides:
toString in class java.lang.Object

getCluster

public int getCluster()

setCluster

public void setCluster(int cluster)