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. Use AnnotatedTextBuilder to create objects of this type.
Since:
2.3
  • Field Details

  • Constructor Details

  • Method Details

    • getOriginalText

      public String getOriginalText()
      Get the plain text, without markup and content from interpretAs.
      Since:
      4.3
    • getPlainText

      public String getPlainText()
      Get the plain text, without markup but with content from interpretAs.
    • 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 checked
      isToPos - the from/to position needed
      Returns:
      an adjusted position of the same location in the text with markup
    • getGlobalMetaData

      public String getGlobalMetaData(String key, String defaultValue)
      Since:
      3.9
    • getGlobalMetaData

      public String getGlobalMetaData(AnnotatedText.MetaDataKey key, String defaultValue)
      Since:
      3.9
    • toString

      public String toString()
      Overrides:
      toString in class Object