Package org.languagetool
Class AnalyzedSentence
java.lang.Object
org.languagetool.AnalyzedSentence
A sentence that has been tokenized and analyzed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AnalyzedTokenReadings[]private final AnalyzedTokenReadings[]private final AnalyzedTokenReadings[]private final AnalyzedTokenReadings[]private final int[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionAnalyzedSentence(AnalyzedTokenReadings[] tokens) Creates an AnalyzedSentence from the givenAnalyzedTokenReadings.privateAnalyzedSentence(AnalyzedTokenReadings[] tokens, int[] mapping, AnalyzedTokenReadings[] nonBlankTokens, AnalyzedTokenReadings[] nonBlankPreDisambigTokens) 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.getLemmaSet(AnalyzedTokenReadings[] tokens) private @NotNull List<AnalyzedTokenReadings> getNonBlankReadings(AnalyzedTokenReadings[] tokens, int whCounter, int nonWhCounter, int[] mapping) 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.getTokenSet(AnalyzedTokenReadings[] tokens) 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.private String(package private) StringReturn string representation without any analysis information, just the original text.
-
Field Details
-
tokens
-
preDisambigTokens
-
nonBlankTokens
-
nonBlankPreDisambigTokens
-
whPositions
private final int[] whPositions -
tokenSet
-
lemmaSet
-
-
Constructor Details
-
AnalyzedSentence
Creates an AnalyzedSentence from the givenAnalyzedTokenReadings. Whitespace is also a token. -
AnalyzedSentence
-
AnalyzedSentence
private AnalyzedSentence(AnalyzedTokenReadings[] tokens, int[] mapping, AnalyzedTokenReadings[] nonBlankTokens, AnalyzedTokenReadings[] nonBlankPreDisambigTokens)
-
-
Method Details
-
getNonBlankReadings
@NotNull private @NotNull List<AnalyzedTokenReadings> getNonBlankReadings(AnalyzedTokenReadings[] tokens, int whCounter, int nonWhCounter, int[] mapping) -
getTokenSet
-
getLemmaSet
-
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
-
toTextString
String toTextString()Return string representation without any analysis information, just the original text.- Since:
- 2.6
-
toString
Return string representation with chunk information. -
toString
-
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
-