Package org.languagetool.markup
Class AnnotatedText
- java.lang.Object
-
- org.languagetool.markup.AnnotatedText
-
public class AnnotatedText extends Object
A text with markup and with a mapping so error positions will refer to the original position that includes the markup, even though only the plain text parts are checked. UseAnnotatedTextBuilder
to create objects of this type.- Since:
- 2.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AnnotatedText.MetaDataKey
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getGlobalMetaData(String key, String defaultValue)
String
getGlobalMetaData(AnnotatedText.MetaDataKey key, String defaultValue)
String
getOriginalText()
Get the plain text, without markup and content frominterpretAs
.int
getOriginalTextPositionFor(int plainTextPosition, boolean isToPos)
Internally used by LanguageTool to adjust error positions to point to the original location with markup, even though markup was ignored during text checking.String
getPlainText()
Get the plain text, without markup but with content frominterpretAs
.String
getTextWithMarkup()
String
toString()
-
-
-
Method Detail
-
getOriginalText
public String getOriginalText()
Get the plain text, without markup and content frominterpretAs
.- Since:
- 4.3
-
getPlainText
public String getPlainText()
Get the plain text, without markup but with content frominterpretAs
.
-
getTextWithMarkup
public String getTextWithMarkup()
- Since:
- 4.3
-
getOriginalTextPositionFor
public int getOriginalTextPositionFor(int plainTextPosition, boolean isToPos)
Internally used by LanguageTool to adjust error positions to point to the original location with markup, even though markup was ignored during text checking.- Parameters:
plainTextPosition
- the position in the plain text (no markup) that was checkedisToPos
- the from/to position needed- Returns:
- an adjusted position of the same location in the text with markup
-
getGlobalMetaData
public String getGlobalMetaData(AnnotatedText.MetaDataKey key, String defaultValue)
- Since:
- 3.9
-
-