LBJ2.nlp
Class POSBracketToVector
java.lang.Object
LBJ2.parse.LineByLine
LBJ2.nlp.POSBracketToVector
- All Implemented Interfaces:
- Parser
- Direct Known Subclasses:
- POSBracketToToken, POSBracketToWord
public class POSBracketToVector
- extends LineByLine
Use this parser to return LinkedVector objects representing
sentences given file names of POS bracket form files to parse. These
files are expected to have one sentence per line, and the format of each
line is as follows:
(pos1 spelling1) (pos2 spelling2) ... (posN spellingN)
It is also expected that there will be exactly one space between a part of
speech and the corresponding spelling and between a closing parenthesis
and an opening parenthesis.
|
Method Summary |
java.lang.Object |
next()
Retrieves the next LinkedVector from the files being
parsed. |
static LinkedVector |
parsePOSBracketForm(java.lang.String line)
Given a single line of textual input (containing all and only the words
in a single sentence) in the format shown above, this method parses and
returns a LinkedVector. |
static Word |
parsePOSBracketForm(java.lang.String text,
Word previous)
Given textual input in the format shown below, this method parses and
returns the Word that the text represents. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
POSBracketToVector
public POSBracketToVector(java.lang.String file)
- Creates the parser.
- Parameters:
file - The file to parse.
next
public java.lang.Object next()
- Retrieves the next
LinkedVector from the files being
parsed.
- Returns:
- The next object parsed from the input data.
parsePOSBracketForm
public static LinkedVector parsePOSBracketForm(java.lang.String line)
- Given a single line of textual input (containing all and only the words
in a single sentence) in the format shown above, this method parses and
returns a
LinkedVector.
- Parameters:
line - A single line of text.
- Returns:
- A
LinkedVector representing the input text.
parsePOSBracketForm
public static Word parsePOSBracketForm(java.lang.String text,
Word previous)
- Given textual input in the format shown below, this method parses and
returns the
Word that the text represents. Expected
format:
(pos spelling)
- Parameters:
text - Text representing a word in POS bracket form.previous - The word that came before this word in the sentence.
- Returns:
- A
Word represented by the input text or
null if the input does not represent a
Word.