Class WordTokenFactory

  • All Implemented Interfaces:
    LexedTokenFactory<Word>

    public class WordTokenFactory
    extends Object
    implements LexedTokenFactory<Word>
    Constructs a Word from a String. This is the default TokenFactory for PTBLexer. It discards the positional information.
    Author:
    Jenny Finkel
    • Constructor Detail

      • WordTokenFactory

        public WordTokenFactory()
    • Method Detail

      • makeToken

        public Word makeToken​(String str,
                              int begin,
                              int length)
        Description copied from interface: LexedTokenFactory
        Constructs a token (of arbitrary type) from a String and its position in the underlying text. The int arguments are used just to record token character offsets in an underlying text. This method does not take a substring of str.
        Specified by:
        makeToken in interface LexedTokenFactory<Word>
        Parameters:
        str - The String extracted by the lexer.
        begin - The offset in the document of the first character in this string.
        length - The number of characters the string takes up in the document.
        Returns:
        The token of type T.