Package edu.upenn.seas.mstparser
Class DependencyPipe
- java.lang.Object
-
- edu.upenn.seas.mstparser.DependencyPipe
-
- Direct Known Subclasses:
DependencyPipe2O
public class DependencyPipe extends Object
-
-
Field Summary
Fields Modifier and Type Field Description AlphabetdataAlphabetbooleanlabeledinttestintAlphabettypeAlphabetString[]typesint[]typesInt
-
Constructor Summary
Constructors Constructor Description DependencyPipe(ParserOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String feat, double val, FeatureVector fv)voidadd(String feat, FeatureVector fv)voidaddCoreFeatures(DependencyInstance instance, int small, int large, boolean attR, FeatureVector fv)protected voidaddExtendedFeatures(DependencyInstance instance, FeatureVector fv)voidaddLabeledFeatures(DependencyInstance instance, int word, String type, boolean attR, boolean childFeatures, FeatureVector fv)voidclose()voidcloseAlphabets()FeatureVectorcreateFeatureVector(DependencyInstance instance)int[]createInstances(String file, File featFileName, boolean fileAccess)voidfillFeatureVectors(DependencyInstance instance, FeatureVector[][][] fvs, double[][][] probs, FeatureVector[][][][] nt_fvs, double[][][][] nt_probs, Parameters params)StringgetType(int typeIndex)voidinitInputFile(String file, boolean fileAccess)voidinitOutputFile(String file)protected DependencyInstancenextInstance()StringoutputInstance(DependencyInstance instance, boolean fileAccess)DependencyInstancereadInstance(ObjectInputStream in, int length, FeatureVector[][][] fvs, double[][][] probs, FeatureVector[][][][] nt_fvs, double[][][][] nt_probs, Parameters params)Read an instance from an input stream.protected voidwriteExtendedFeatures(DependencyInstance instance, ObjectOutputStream out)Override this method if you have extra features that need to be written to disk.protected voidwriteInstance(DependencyInstance instance, ObjectOutputStream out)Write an instance to an output stream for later reading.
-
-
-
Constructor Detail
-
DependencyPipe
public DependencyPipe(ParserOptions options) throws IOException
- Throws:
IOException
-
-
Method Detail
-
initInputFile
public void initInputFile(String file, boolean fileAccess) throws IOException
- Throws:
IOException
-
initOutputFile
public void initOutputFile(String file) throws IOException
- Throws:
IOException
-
outputInstance
public String outputInstance(DependencyInstance instance, boolean fileAccess) throws IOException
- Throws:
IOException
-
close
public void close() throws IOException- Throws:
IOException
-
getType
public String getType(int typeIndex)
-
nextInstance
protected final DependencyInstance nextInstance() throws IOException
- Throws:
IOException
-
createInstances
public int[] createInstances(String file, File featFileName, boolean fileAccess) throws IOException
- Throws:
IOException
-
closeAlphabets
public void closeAlphabets()
-
add
public final void add(String feat, FeatureVector fv)
-
add
public final void add(String feat, double val, FeatureVector fv)
-
createFeatureVector
public FeatureVector createFeatureVector(DependencyInstance instance)
-
addExtendedFeatures
protected void addExtendedFeatures(DependencyInstance instance, FeatureVector fv)
-
addCoreFeatures
public void addCoreFeatures(DependencyInstance instance, int small, int large, boolean attR, FeatureVector fv)
-
addLabeledFeatures
public void addLabeledFeatures(DependencyInstance instance, int word, String type, boolean attR, boolean childFeatures, FeatureVector fv)
-
fillFeatureVectors
public void fillFeatureVectors(DependencyInstance instance, FeatureVector[][][] fvs, double[][][] probs, FeatureVector[][][][] nt_fvs, double[][][][] nt_probs, Parameters params)
-
writeInstance
protected void writeInstance(DependencyInstance instance, ObjectOutputStream out)
Write an instance to an output stream for later reading.
-
writeExtendedFeatures
protected void writeExtendedFeatures(DependencyInstance instance, ObjectOutputStream out) throws IOException
Override this method if you have extra features that need to be written to disk. For the basic DependencyPipe, nothing happens.- Throws:
IOException
-
readInstance
public DependencyInstance readInstance(ObjectInputStream in, int length, FeatureVector[][][] fvs, double[][][] probs, FeatureVector[][][][] nt_fvs, double[][][][] nt_probs, Parameters params) throws IOException
Read an instance from an input stream.- Throws:
IOException
-
-