Class DependencyPipe

  • Direct Known Subclasses:
    DependencyPipe2O

    public class DependencyPipe
    extends java.lang.Object
    • Field Detail

      • dataAlphabet

        public Alphabet dataAlphabet
      • typeAlphabet

        public Alphabet typeAlphabet
      • types

        public java.lang.String[] types
      • typesInt

        public int[] typesInt
      • labeled

        public boolean labeled
      • testint

        public int testint
    • Constructor Detail

      • DependencyPipe

        public DependencyPipe​(ParserOptions options)
                       throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • initInputFile

        public void initInputFile​(java.lang.String file,
                                  boolean fileAccess)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • initOutputFile

        public void initOutputFile​(java.lang.String file)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • outputInstance

        public java.lang.String outputInstance​(DependencyInstance instance,
                                               boolean fileAccess)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getType

        public java.lang.String getType​(int typeIndex)
      • nextInstance

        protected final DependencyInstance nextInstance()
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • createInstances

        public int[] createInstances​(java.lang.String file,
                                     java.io.File featFileName,
                                     boolean fileAccess)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • closeAlphabets

        public void closeAlphabets()
      • add

        public final void add​(java.lang.String feat,
                              FeatureVector fv)
      • add

        public final void add​(java.lang.String feat,
                              double val,
                              FeatureVector fv)
      • addLabeledFeatures

        public void addLabeledFeatures​(DependencyInstance instance,
                                       int word,
                                       java.lang.String type,
                                       boolean attR,
                                       boolean childFeatures,
                                       FeatureVector fv)
      • writeInstance

        protected void writeInstance​(DependencyInstance instance,
                                     java.io.ObjectOutputStream out)
        Write an instance to an output stream for later reading.
      • writeExtendedFeatures

        protected void writeExtendedFeatures​(DependencyInstance instance,
                                             java.io.ObjectOutputStream out)
                                      throws java.io.IOException
        Override this method if you have extra features that need to be written to disk. For the basic DependencyPipe, nothing happens.
        Throws:
        java.io.IOException
      • readInstance

        public DependencyInstance readInstance​(java.io.ObjectInputStream in,
                                               int length,
                                               FeatureVector[][][] fvs,
                                               double[][][] probs,
                                               FeatureVector[][][][] nt_fvs,
                                               double[][][][] nt_probs,
                                               Parameters params)
                                        throws java.io.IOException
        Read an instance from an input stream.
        Throws:
        java.io.IOException