com.aliasi.corpus
Class StringParser<H extends Handler>

java.lang.Object
  extended by com.aliasi.corpus.Parser<H>
      extended by com.aliasi.corpus.StringParser<H>
Type Parameters:
H - the type of handler to which this parser sends events
Direct Known Subclasses:
AbstractMedTagParser, BrownPosParser, BrownTextParser, GeneTagChunkParser, GeniaPosParser, GigawordTextParser, LineTaggingParser, RegexLineTagParser, Reuters21578Parser

public abstract class StringParser<H extends Handler>
extends Parser<H>

A StringParser is an abstract parser based on an abstract method for parsing from a character slice. All parsing methods will eventually call Parser.parseString(char[],int,int).

Since:
LingPipe2.1
Version:
3.0
Author:
Bob Carpenter

Constructor Summary
protected StringParser()
          Construct a string parser with no handler specified.
protected StringParser(H handler)
          Construct a string parser with the specified handler.
 
Method Summary
 void parse(InputSource in)
          Parse the specified input source.
 
Methods inherited from class com.aliasi.corpus.Parser
getHandler, parse, parse, parseString, parseString, setHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringParser

protected StringParser()
Construct a string parser with no handler specified.


StringParser

protected StringParser(H handler)
Construct a string parser with the specified handler.

Parameters:
handler - Handler for input events.
Method Detail

parse

public void parse(InputSource in)
           throws IOException
Parse the specified input source.

The implementation here converts the input source to a character slice using Streams.toCharArray(InputSource) and passes the result to Parser.parseString(char[],int,int).

Specified by:
parse in class Parser<H extends Handler>
Parameters:
in - Input source from which to read.
Throws:
IOException - If there is an I/O error reading from the input source.