Package org.languagetool
Class AnalyzedSentence
java.lang.Object
org.languagetool.AnalyzedSentence
A sentence that has been tokenized and analyzed.
- Author:
- Daniel Naber
-
Constructor Summary
ConstructorsConstructorDescriptionAnalyzedSentence(AnalyzedTokenReadings[] tokens) Creates an AnalyzedSentence from the givenAnalyzedTokenReadings.AnalyzedSentence(AnalyzedTokenReadings[] tokens, AnalyzedTokenReadings[] preDisambigTokens) -
Method Summary
Modifier and TypeMethodDescriptioncopy(AnalyzedSentence sentence) The method copiesAnalyzedSentenceand returns the copy.booleanGet disambiguator actions log.Get the lowercase lemmas of this sentence in a set.intgetOriginalPosition(int nonWhPosition) Get a position of a non-whitespace token in the original sentence with whitespace.getText()Return the original text.Returns theAnalyzedTokenReadingsof the analyzed text.Get the lowercase tokens of this sentence in a set.Returns theAnalyzedTokenReadingsof the analyzed text, with whitespace tokens removed but with the artificialSENT_STARTtoken included.inthashCode()booleanhasParagraphEndMark(Language lang) Returns true if sentences ends with a paragraph break.toShortString(String readingDelimiter) Return string representation without chunk information.toString()Return string representation with chunk information.
-
Constructor Details
-
AnalyzedSentence
Creates an AnalyzedSentence from the givenAnalyzedTokenReadings. Whitespace is also a token. -
AnalyzedSentence
-
-
Method Details
-
copy
The method copiesAnalyzedSentenceand returns the copy. Useful for performing local immunization (for example).- Parameters:
sentence-AnalyzedSentenceto be copied- Returns:
- a new object which is a copy
- Since:
- 2.5
-
getTokens
Returns theAnalyzedTokenReadingsof the analyzed text. Whitespace is also a token. -
getPreDisambigTokens
- Since:
- 4.5
-
getTokensWithoutWhitespace
Returns theAnalyzedTokenReadingsof the analyzed text, with whitespace tokens removed but with the artificialSENT_STARTtoken included. -
getPreDisambigTokensWithoutWhitespace
- Since:
- 4.5
-
getOriginalPosition
public 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:
- position in the original sentence.
-
toString
-
toShortString
Return string representation without chunk information.- Since:
- 2.3
-
getText
Return the original text.- Since:
- 2.7
-
toString
Return string representation with chunk information. -
getAnnotations
Get disambiguator actions log. -
getTokenSet
Get the lowercase tokens of this sentence in a set. Used internally for performance optimization.- Since:
- 2.4
-
getLemmaSet
Get the lowercase lemmas of this sentence in a set. Used internally for performance optimization.- Since:
- 2.5
-
equals
-
hashCode
public int hashCode() -
hasParagraphEndMark
Returns true if sentences ends with a paragraph break.- Since:
- 4.3
-