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
.private
AnalyzedSentence
(AnalyzedTokenReadings[] tokens, int[] mapping, AnalyzedTokenReadings[] nonBlankTokens, AnalyzedTokenReadings[] nonBlankPreDisambigTokens) AnalyzedSentence
(AnalyzedTokenReadings[] tokens, AnalyzedTokenReadings[] preDisambigTokens) -
Method Summary
Modifier and TypeMethodDescriptioncopy
(AnalyzedSentence sentence) The method copiesAnalyzedSentence
and returns the copy.boolean
Get 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) int
getOriginalPosition
(int nonWhPosition) Get a position of a non-whitespace token in the original sentence with whitespace.getText()
Return the original text.Returns theAnalyzedTokenReadings
of the analyzed text.Get the lowercase tokens of this sentence in a set.getTokenSet
(AnalyzedTokenReadings[] tokens) Returns theAnalyzedTokenReadings
of the analyzed text, with whitespace tokens removed but with the artificialSENT_START
token included.int
hashCode()
boolean
hasParagraphEndMark
(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) String
Return 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 copiesAnalyzedSentence
and returns the copy. Useful for performing local immunization (for example).- Parameters:
sentence
-AnalyzedSentence
to be copied- Returns:
- a new object which is a copy
- Since:
- 2.5
-
getTokens
Returns theAnalyzedTokenReadings
of the analyzed text. Whitespace is also a token. -
getPreDisambigTokens
- Since:
- 4.5
-
getTokensWithoutWhitespace
Returns theAnalyzedTokenReadings
of the analyzed text, with whitespace tokens removed but with the artificialSENT_START
token 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
-