Class NIFPositionHelper

java.lang.Object
org.aksw.gerbil.io.nif.utils.NIFPositionHelper

public class NIFPositionHelper extends Object
The positions in NIF are measured in codepoints, while Java counts in terms of characters. This class offers methods to handle that problem.
Author:
Michael Röder (roeder@informatik.uni-leipzig.de)
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
  • Constructor Details

    • NIFPositionHelper

      public NIFPositionHelper()
  • Method Details

    • correctAnnotationPositions

      public static void correctAnnotationPositions(Document document)
      The positions in NIF are measured in codepoints, while Java counts in terms of characters. So we have to correct the positions of the annotations.
      Parameters:
      document - the Document for which the positions should be checked and corrected if necessary
    • checkPositionsForConspicuity

      public static void checkPositionsForConspicuity(List<Span> spans, String text)
      This method checks the given Span instances for simple errors, e.g., markings that start or end with a whitespace instead of an alphanumeric character. If errors are found, a waring is printed.
      Parameters:
      spans - the list of Span instances that should be checked
      text - the text on which the Span instances rely on
    • printWarning

      private static void printWarning(String text, int start, int end, String warningMsg)