Package org.languagetool.markup
Class AnnotatedText
- java.lang.Object
-
- org.languagetool.markup.AnnotatedText
-
public class AnnotatedText extends java.lang.ObjectA 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. UseAnnotatedTextBuilderto create objects of this type.- Since:
- 2.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnnotatedText.MetaDataKey
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>customMetaDataprivate java.util.Map<java.lang.Integer,MappingValue>mappingprivate java.util.Map<AnnotatedText.MetaDataKey,java.lang.String>metaDataprivate java.util.List<TextPart>parts
-
Constructor Summary
Constructors Constructor Description AnnotatedText(java.util.List<TextPart> parts, java.util.Map<java.lang.Integer,MappingValue> mapping, java.util.Map<AnnotatedText.MetaDataKey,java.lang.String> metaData, java.util.Map<java.lang.String,java.lang.String> customMetaData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetGlobalMetaData(java.lang.String key, java.lang.String defaultValue)java.lang.StringgetGlobalMetaData(AnnotatedText.MetaDataKey key, java.lang.String defaultValue)java.lang.StringgetOriginalText()Get the plain text, without markup and content frominterpretAs.intgetOriginalTextPositionFor(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.java.lang.StringgetPlainText()Get the plain text, without markup but with content frominterpretAs.java.lang.StringgetTextWithMarkup()java.lang.StringtoString()
-
-
-
Field Detail
-
parts
private final java.util.List<TextPart> parts
-
mapping
private final java.util.Map<java.lang.Integer,MappingValue> mapping
-
metaData
private final java.util.Map<AnnotatedText.MetaDataKey,java.lang.String> metaData
-
customMetaData
private final java.util.Map<java.lang.String,java.lang.String> customMetaData
-
-
Constructor Detail
-
AnnotatedText
AnnotatedText(java.util.List<TextPart> parts, java.util.Map<java.lang.Integer,MappingValue> mapping, java.util.Map<AnnotatedText.MetaDataKey,java.lang.String> metaData, java.util.Map<java.lang.String,java.lang.String> customMetaData)
-
-
Method Detail
-
getOriginalText
public java.lang.String getOriginalText()
Get the plain text, without markup and content frominterpretAs.- Since:
- 4.3
-
getPlainText
public java.lang.String getPlainText()
Get the plain text, without markup but with content frominterpretAs.
-
getTextWithMarkup
public java.lang.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 java.lang.String getGlobalMetaData(java.lang.String key, java.lang.String defaultValue)- Since:
- 3.9
-
getGlobalMetaData
public java.lang.String getGlobalMetaData(AnnotatedText.MetaDataKey key, java.lang.String defaultValue)
- Since:
- 3.9
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-