public class FeatureVectorParser extends Object implements edu.illinois.cs.cogcomp.lbjava.parse.Parser
FeatureVector
s deserialized out of the first file passed to the
constructor. In fact, this first file contains only int
s that index the features.
The second file passed to the constructor is the lexicon used to translate from int
s
to Feature
objects.
When run as a stand-alone program, this class takes the names of the example and lexicon files as
input on the command line and simply writes a string representation of every example to
STDOUT
.
Modifier and Type | Field and Description |
---|---|
protected String |
exampleFileName
The name of the file to parse.
|
protected DataInputStream |
in
Reader for file currently being parsed.
|
protected edu.illinois.cs.cogcomp.lbjava.classify.Feature[] |
lexicon
The feature objects corresponding to the
int s in the example file. |
Modifier | Constructor and Description |
---|---|
protected |
FeatureVectorParser(String exampleFile)
For internal use only.
|
|
FeatureVectorParser(String exampleFile,
edu.illinois.cs.cogcomp.lbjava.classify.Feature[] lexicon)
Creates the parser.
|
|
FeatureVectorParser(String exampleFile,
String lexiconFile)
Creates the parser.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Frees any resources this parser may be holding.
|
static void |
main(String[] args)
Takes the names of the example and lexicon files as input on the command line and prints all
the examples to
STDOUT . |
Object |
next()
Returns a
FeatureVector deserialized out of the given file. |
void |
reset()
Resets the example file stream to the beginning.
|
protected DataInputStream in
protected String exampleFileName
protected edu.illinois.cs.cogcomp.lbjava.classify.Feature[] lexicon
int
s in the example file.protected FeatureVectorParser(String exampleFile)
exampleFile
- The name of the file to parse.public FeatureVectorParser(String exampleFile, edu.illinois.cs.cogcomp.lbjava.classify.Feature[] lexicon)
exampleFile
- The name of the file to parse.lexicon
- The lexicon.public Object next()
FeatureVector
deserialized out of the given file.next
in interface edu.illinois.cs.cogcomp.lbjava.parse.Parser
public void reset()
FeatureVectorParser
with the same constructor arguments, but this method avoids
re-reading the lexicon.reset
in interface edu.illinois.cs.cogcomp.lbjava.parse.Parser
public static void main(String[] args)
STDOUT
.public void close()
close
in interface edu.illinois.cs.cogcomp.lbjava.parse.Parser
Copyright © 2017. All rights reserved.