Class ResultsUtility


  • public class ResultsUtility
    extends java.lang.Object
    Abstract class encapsulating basic results formatter functionality.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int TEXT_WIDTH
      The default TEXT WIDTH.
    • Constructor Summary

      Constructors 
      Constructor Description
      ResultsUtility()  
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String formatConfidence​(double d)
      Format confidence.
      static boolean isDatetime​(TextMatch m)
      Testers for TextMatch: isDatetime macro.
      static boolean isLocation​(TextMatch m)
      Testers for TextMatch: isLocation macro.
      static void setContextFor​(java.lang.String content, TextEntity t, int doc_size)
      Given the annotation or match, set the context on the TextEntity object.
      static void setPrePostContextFor​(java.lang.String content, TextEntity t, int doc_size)
      Given the TextEntity, set the context on that object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TEXT_WIDTH

        public static int TEXT_WIDTH
        The default TEXT WIDTH. ~75 chars per line yields 2 lines of text.
    • Constructor Detail

      • ResultsUtility

        public ResultsUtility()
    • Method Detail

      • setPrePostContextFor

        public static void setPrePostContextFor​(java.lang.String content,
                                                TextEntity t,
                                                int doc_size)
        Given the TextEntity, set the context on that object. The text entity must have span (start, end attributes) set.
        Parameters:
        content - entire text from which entity came from
        t - the entity
        doc_size - the doc_size
      • setContextFor

        public static void setContextFor​(java.lang.String content,
                                         TextEntity t,
                                         int doc_size)
        Given the annotation or match, set the context on the TextEntity object. The text entity must have span (start, end attributes) set.
        Parameters:
        content - the content
        t - the t
        doc_size - the doc_size
      • isLocation

        public static boolean isLocation​(TextMatch m)
        Testers for TextMatch: isLocation macro.
        Parameters:
        m - the m
        Returns:
        true, if is location
      • isDatetime

        public static boolean isDatetime​(TextMatch m)
        Testers for TextMatch: isDatetime macro.
        Parameters:
        m - the m
        Returns:
        true, if is datetime
      • formatConfidence

        public static java.lang.String formatConfidence​(double d)
        Format confidence.
        Parameters:
        d - the d
        Returns:
        the string