de.danielnaber.languagetool
Class AnalyzedSentence

Object
  extended by AnalyzedSentence

public class AnalyzedSentence
extends Object

A sentence that has been tokenized and analyzed.

Author:
Daniel Naber

Constructor Summary
AnalyzedSentence(AnalyzedTokenReadings[] tokens)
          Sets AnalyzedTokenReadings.
AnalyzedSentence(AnalyzedTokenReadings[] tokens, int[] whPositions)
           
 
Method Summary
 boolean equals(Object obj)
           
 int getOriginalPosition(int nonWhPosition)
          Get a position of a non-whitespace token in the original sentence with whitespace.
 AnalyzedTokenReadings[] getTokens()
          Returns the AnalyzedTokenReadings of the analyzed text.
 AnalyzedTokenReadings[] getTokensWithoutWhitespace()
          Returns the AnalyzedTokenReadings of the analyzed text, with whitespace tokens removed but with the artificial SENT_START token included.
 int[] getWhPositions()
           
 int hashCode()
           
 void setNonBlankTokens(AnalyzedTokenReadings[] nonBlankTokens)
           
 void setWhPositions(int[] whPositions)
           
 String toString()
           
 
Methods inherited from class Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnalyzedSentence

public AnalyzedSentence(AnalyzedTokenReadings[] tokens)
Sets AnalyzedTokenReadings. Whitespace is also a token.


AnalyzedSentence

public AnalyzedSentence(AnalyzedTokenReadings[] tokens,
                        int[] whPositions)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getTokens

public final AnalyzedTokenReadings[] getTokens()
Returns the AnalyzedTokenReadings of the analyzed text. Whitespace is also a token.


getTokensWithoutWhitespace

public final AnalyzedTokenReadings[] getTokensWithoutWhitespace()
Returns the AnalyzedTokenReadings of the analyzed text, with whitespace tokens removed but with the artificial SENT_START token included.


getOriginalPosition

public final int getOriginalPosition(int nonWhPosition)
Get a position of a non-whitespace token in the original sentence with whitespace.

Parameters:
nonWhPosition - Position of a non-whitespace token
Returns:
int position in the original sentence.

toString

public final String toString()
Overrides:
toString in class Object

setWhPositions

public void setWhPositions(int[] whPositions)
Parameters:
whPositions - the whPositions to set

getWhPositions

public int[] getWhPositions()
Returns:
the whPositions

setNonBlankTokens

public void setNonBlankTokens(AnalyzedTokenReadings[] nonBlankTokens)
Parameters:
nonBlankTokens - the nonBlankTokens to set


Copyright © 2005-2009 Daniel Naber