Class StandardsExtractingContentHandler

    • Constructor Detail

      • StandardsExtractingContentHandler

        public StandardsExtractingContentHandler​(ContentHandler handler,
                                                 Metadata metadata)
        Creates a decorator for the given SAX event handler and Metadata object.
        Parameters:
        handler - SAX event handler to be decorated.
        metadata - Metadata object.
      • StandardsExtractingContentHandler

        protected StandardsExtractingContentHandler()
        Creates a decorator that by default forwards incoming SAX events to a dummy content handler that simply ignores all the events. Subclasses should use the ContentHandlerDecorator.setContentHandler(ContentHandler) method to switch to a more usable underlying content handler. Also creates a dummy Metadata object to store phone numbers in.
    • Method Detail

      • getThreshold

        public double getThreshold()
        Gets the threshold to be used for selecting the standard references found within the text based on their score.
        Returns:
        the threshold to be used for selecting the standard references found within the text based on their score.
      • setThreshold

        public void setThreshold​(double score)
        Sets the score to be used as threshold.
        Parameters:
        score - the score to be used as threshold.
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
                        throws SAXException
        The characters method is called whenever a Parser wants to pass raw characters to the ContentHandler. However, standard references are often split across different calls to characters, depending on the specific Parser used. Therefore, we simply add all characters to a StringBuilder and analyze it once the document is finished.
        Specified by:
        characters in interface ContentHandler
        Overrides:
        characters in class ContentHandlerDecorator
        Throws:
        SAXException