edu.mit.jwi.data.parse
Class DataLineParser

java.lang.Object
  extended by edu.mit.jwi.data.parse.DataLineParser
All Implemented Interfaces:
ILineParser<ISynset>

public class DataLineParser
extends java.lang.Object
implements ILineParser<ISynset>

Parser for Wordnet data files (e.g., data.adv or adv.dat). This parser produces an ISynset object.

This class follows a singleton design pattern, and is not intended to be instantiated directly; rather, call the getInstance() method to get the singleton instance.

Since:
JWI 1.0
Version:
2.4.0
Author:
Mark A. Finlayson

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.mit.jwi.data.parse.ILineParser
ILineParser.MisformattedLineException
 
Constructor Summary
protected DataLineParser()
          This constructor is marked protected so that the class may be sub-classed, but not directly instantiated.
 
Method Summary
static DataLineParser getInstance()
          Returns the singleton instance of this class, instantiating it if necessary.
 ISynset parseLine(java.lang.String line)
          Given the line of data, this method produces an object of class T.
protected  ILexFile resolveLexicalFile(int lexFileNum)
           Retrieves the lexical file objects for the parseLine(String) method.
protected  IPointer resolvePointer(java.lang.String symbol, POS pos)
           Retrieves the pointer objects for the parseLine(String) method.
protected  IVerbFrame resolveVerbFrame(int frameNum)
           Retrieves the verb frames for the parseLine(String) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataLineParser

protected DataLineParser()
This constructor is marked protected so that the class may be sub-classed, but not directly instantiated. Obtain instances of this class via the static getInstance() method.

Since:
JWI 2.0.0
Method Detail

getInstance

public static DataLineParser getInstance()
Returns the singleton instance of this class, instantiating it if necessary. The singleton instance will not be null.

Returns:
the non-null singleton instance of this class, instantiating it if necessary.
Since:
JWI 2.0.0

parseLine

public ISynset parseLine(java.lang.String line)
Description copied from interface: ILineParser
Given the line of data, this method produces an object of class T.

Specified by:
parseLine in interface ILineParser<ISynset>
Parameters:
line - the line to be parsed
Returns:
the object resulting from the parse

resolveVerbFrame

protected IVerbFrame resolveVerbFrame(int frameNum)

Retrieves the verb frames for the parseLine(String) method.

This is implemented in its own method for ease of subclassing.

Parameters:
frameNum - the number of the frame to return
Returns:
the verb frame corresponding to the specified frame number, or null if there is none
Since:
JWI 2.1.0

resolveLexicalFile

protected ILexFile resolveLexicalFile(int lexFileNum)

Retrieves the lexical file objects for the parseLine(String) method. If the lexical file number does correspond to a known lexical file, the method returns a singleton placeholder 'unknown' lexical file object.

This is implemented in its own method for ease of subclassing.

Parameters:
lexFileNum - the number of the lexical file to return
Returns:
the lexical file corresponding to the specified frame number
Since:
JWI 2.1.0

resolvePointer

protected IPointer resolvePointer(java.lang.String symbol,
                                  POS pos)

Retrieves the pointer objects for the parseLine(String) method.

This is implemented in its own method for ease of subclassing.

Parameters:
symbol - the symbol of the pointer to return
pos - the part of speech of the pointer to return, can be null unless the pointer symbol is ambiguous
Returns:
the pointer corresponding to the specified symbol and part of speech combination
Throws:
java.lang.NullPointerException - if the symbol is null
java.lang.IllegalArgumentException - if the symbol and part of speech combination does not correspond to a known pointer
Since:
JWI 2.1.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.