Package org.fnlp.nlp.parser.dep.reader

Examples of org.fnlp.nlp.parser.dep.reader.CoNLLReader


   */
  private void buildInstanceList(String file) throws IOException {

    System.out.print("generating training instances ...");

    CoNLLReader reader = new CoNLLReader(file);

    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
        new FileOutputStream(fp), charset));
   
    LabelAlphabet postagAlphabet = factory.buildLabelAlphabet("postag");

    int count = 0;
    while (reader.hasNext()) {

      Sentence instance = (Sentence) reader.next();
      int[] heads = (int[]) instance.getTarget();
      ParsingState state = new ParsingState(instance,factory);
      while (!state.isFinalState()) {
        // 左右焦点词在句子中的位置
        int[] lr = state.getFocusIndices();
View Full Code Here


    int totsent = 0;
    int errroot = 0;

    System.out.print("Beginning the test ... ");
    // 输入
    CoNLLReader reader = new CoNLLReader(testFile);

    // 输出
    BufferedWriter writer = null;
    if (resultFile != null)
      writer = new BufferedWriter(new OutputStreamWriter(
          new FileOutputStream(resultFile), charset));

    long beginTime = System.currentTimeMillis();
    while (reader.hasNext()) {
      Sentence instance = (Sentence) reader.next();
      // int[] golds = new int[instance.length()];
      int[] heads = (int[]) instance.getTarget();
      // System.arraycopy(heads, 0, golds, 0, golds.length);
      // instance.setSource(heads);
View Full Code Here

TOP

Related Classes of org.fnlp.nlp.parser.dep.reader.CoNLLReader

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.