Package org.languagetool.markup
Class AnnotatedText
- java.lang.Object
-
- org.languagetool.markup.AnnotatedText
-
public class AnnotatedText extends java.lang.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
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>
customMetaData
private java.util.Map<java.lang.Integer,MappingValue>
mapping
private java.util.Map<AnnotatedText.MetaDataKey,java.lang.String>
metaData
private 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.String
getGlobalMetaData(java.lang.String key, java.lang.String defaultValue)
java.lang.String
getGlobalMetaData(AnnotatedText.MetaDataKey key, java.lang.String defaultValue)
java.lang.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.java.lang.String
getPlainText()
Get the plain text, without markup but with content frominterpretAs
.java.lang.String
getTextWithMarkup()
java.lang.String
toString()
-
-
-
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:
toString
in classjava.lang.Object
-
-