Class StanfordPTBTokenizer

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, Serializable

    public class StanfordPTBTokenizer
    extends AbstractTokenizer
    Uses Stanford's PTBTokenizer.

    For more details on the options see:
    http://nlp.stanford.edu/software/tokenizer.shtml

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -tokenizer-options <java.lang.String> (property: tokenizerOptions)
        The tokenizer options to use.
        default: americanize=false,unicodeQuotes=true,unicodeEllipsis=true
     
    Version:
    $Revision: 11956 $
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected edu.stanford.nlp.process.TokenizerFactory m_TokenizerFactory
      the tokenizer factory to use.
      protected String m_TokenizerOptions
      the options for the tokenizer.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Field Detail

      • m_TokenizerOptions

        protected String m_TokenizerOptions
        the options for the tokenizer.
      • m_TokenizerFactory

        protected transient edu.stanford.nlp.process.TokenizerFactory m_TokenizerFactory
        the tokenizer factory to use.
    • Constructor Detail

      • StanfordPTBTokenizer

        public StanfordPTBTokenizer()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class adams.core.option.AbstractOptionHandler
      • setTokenizerOptions

        public void setTokenizerOptions​(String value)
        Sets the tokenizer options to use.
        Parameters:
        value - the options
      • getTokenizerOptions

        public String getTokenizerOptions()
        Returns the tokenizer options to use.
        Returns:
        the options
      • tokenizerOptionsTipText

        public String tokenizerOptionsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getTokenizerFactory

        protected edu.stanford.nlp.process.TokenizerFactory getTokenizerFactory()
        Returns the tokenizer factory to use.
        Returns:
        the factory
      • doTokenize

        protected List<String> doTokenize​(String str)
        Performs the actual tokenization.
        Specified by:
        doTokenize in class AbstractTokenizer
        Parameters:
        str - the string to tokenize
        Returns:
        the list of sentence words