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

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


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

    System.out.print("生成训练数据 ...");

    FNLPReader reader = new FNLPReader(file);
    FNLPReader preReader = new FNLPReader(file);
    InstanceSet instset = new InstanceSet();
   
    LabelAlphabet la = factory.DefaultLabelAlphabet();
    IFeatureAlphabet fa = factory.DefaultFeatureAlphabet();
    int count = 0;
   
    //preReader为了把ysize定下来
    la.lookupIndex("S");
    while(preReader.hasNext()){
      Sentence sent = (Sentence) preReader.next();
      Target targets = (Target)sent.getTarget();
      for(int i=0; i<sent.length(); i++){
        String label;
        if(targets.getHead(i) != -1){
          if(targets.getHead(i) < i){
View Full Code Here


    int totsent = 0;
    int errroot = 0;

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

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

    long beginTime = System.currentTimeMillis();
    int count = 0;
    while (reader.hasNext()) {
//      System.out.println(count++);
      Sentence instance = (Sentence) reader.next();
     
      Target targets = (Target) instance.getTarget();

      int[] heads = targets.getHeads();     
      String[] depClass = targets.getRelations();
View Full Code Here

TOP

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

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.