Package edu.stanford.nlp.io

Examples of edu.stanford.nlp.io.OutDataStreamFile


  /** Currently unused */
  @SuppressWarnings({"UnusedDeclaration","unused"})
  private void save(String filename) {
    try {
      OutDataStreamFile rF = new OutDataStreamFile(filename);
      rF.writeInt(xSize);
      rF.writeInt(ySize);
      rF.writeInt(vArray.length);
      for (int i = 0; i < xSize; i++) {
        rF.writeInt(px[i]);
      }
      for (int j = 0; j < ySize; j++) {
        rF.writeInt(py[j]);
      }
      for (int i = 0; i < xSize; i++) {
        for (int j = 0; j < dim; j++) {
          rF.writeInt(pxy[i][j]);
        }
      }

      rF.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


  }
  -------------- */

  protected static void saveModel(String filename, TaggerConfig config) {
    try {
      OutDataStreamFile file = new OutDataStreamFile(filename);
      config.saveConfig(file);
      file.writeInt(xSize);
      file.writeInt(ySize);
      dict.save(file);
      tags.save(file);

      saveExtractors(file);

      file.writeInt(fAssociations.size());
      for (Map.Entry<FeatureKey,Integer> item : fAssociations.entrySet()) {
        int numF = item.getValue();
        file.writeInt(numF);
        FeatureKey fk = item.getKey();
        fk.save(file);
      }

      LambdaSolve.save_lambdas(file, prob.lambda);
      file.close();
    } catch (IOException ioe) {
      System.err.println("Error saving tagger to file " + filename);
      ioe.printStackTrace();
    }
  }
View Full Code Here

  static int[] xIndexed;

  @Override
  public void save(String filename) {
    try {
      OutDataStreamFile rF = new OutDataStreamFile(filename);
      rF.writeInt(xIndexed.length);
      for (int aXIndexed : xIndexed) {
        rF.writeInt(aXIndexed);
      }
      rF.writeInt(size());
      for (int i = 0; i < size(); i++) {
        get(i).save(rF);
      }
      rF.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

  }

  public void save(String filename) {
    try {
      OutDataStreamFile rF = new OutDataStreamFile(filename);
      rF.writeInt(size());
      for (int i = 0; i < size(); i++) {
        (get(i)).save(rF);
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      }
  }
   
  protected void save(String filename) {
    try {
      DataOutputStream out = new OutDataStreamFile(filename);

      out.writeInt(index.size());
      for (String item : index) {
        out.writeUTF(item);
        if (learnClosedTags) {
          if(GlobalHolder.tagTokens.get(item).size() < closedTagThreshold) {
            markClosed(item);
          }
        }
        out.writeBoolean(isClosed(item));
      }

      out.close();
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
  }
View Full Code Here

   *
   * @param filename The file to write the weights to.
   */
  public void save_lambdas(String filename) {
    try {
      OutDataStreamFile rf = new OutDataStreamFile(filename);
      save_lambdas(rf, lambda);
      rf.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.io.OutDataStreamFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.