Examples of FNLPDoc


Examples of org.fnlp.nlp.corpus.fnlp.FNLPDoc

      IOException {
    BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
        new FileOutputStream(file ), "UTF-8"));
    Iterator<FNLPDoc> it1 = corpus.docs.iterator();
    while(it1.hasNext()){
      FNLPDoc doc = it1.next();
      Iterator<FNLPSent> it2 = doc.sentences.iterator();
      while(it2.hasNext()){
        FNLPSent sent = it2.next();
        for(String w:sent.words){
       
View Full Code Here

Examples of org.fnlp.nlp.corpus.fnlp.FNLPDoc

      IOException {
    BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
        new FileOutputStream(file ), "UTF-8"));
    Iterator<FNLPDoc> it1 = corpus.docs.iterator();
    while(it1.hasNext()){
      FNLPDoc doc = it1.next();
      Iterator<FNLPSent> it2 = doc.sentences.iterator();
      while(it2.hasNext()){
        FNLPSent sent = it2.next();
        String s = Tags.genSequence4Tags(sent.words);
        bout.write(s);
View Full Code Here

Examples of org.fnlp.nlp.corpus.fnlp.FNLPDoc

        bfr = new BufferedReader(new InputStreamReader(in,charset));
      } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      FNLPDoc docs = new FNLPDoc();
      docs.name = file.getName();
      String line = null;
      carrier.clear();
      while ((line = bfr.readLine()) != null) {
       
        line = line.trim();
       
        if (line.matches("^$")){
          if(carrier.size()>0){
            FNLPSent sent = new FNLPSent();           
            sent.parse(carrier,1,HASID); //TODO: 需要根据不同语料修改
            //归一化
            for(int i=0;i<sent.words.length;i++){
              sent.words[i] = ct.normalize(sent.words[i]);
            }
            correct(sent);
            docs.add(sent);
            carrier.clear();
          }
        }else
          carrier.add(line);
      }
      if(!carrier.isEmpty()){
        FNLPSent sent = new FNLPSent();
       
        sent.parse(carrier,1,HASID); //TODO: 需要根据不同语料修改
        correct(sent);
        docs.add(sent);
        carrier.clear();
      }
      corpus.add(docs);
    }
  }
View Full Code Here

Examples of org.fnlp.nlp.corpus.fnlp.FNLPDoc

   
    System.out.println(corpus.getDocumenNum());
    System.out.println(corpus.getSentenceNum());
    System.out.println(corpus.getAllPOS());
   
    FNLPDoc doc = corpus.docs.get(0);
    List<FNLPSent> train = doc.sentences.subList(0, 3000);
    List<FNLPSent> test = doc.sentences.subList(3000,doc.sentences.size());
   
    doc.sentences =  new LinkedList<FNLPSent>();
    doc.sentences.addAll(train);
View Full Code Here

Examples of org.fnlp.nlp.corpus.fnlp.FNLPDoc

    BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
        new FileOutputStream(toPath ), "UTF-8"));
    Iterator<FNLPDoc> it1 = corpus.docs.iterator();
    while(it1.hasNext()){
      FNLPDoc doc = it1.next();
      Iterator<FNLPSent> it2 = doc.sentences.iterator();
      while(it2.hasNext()){
        FNLPSent sent = it2.next();
        if(!sent.hasTag())
          continue;
View Full Code Here

Examples of org.fnlp.nlp.corpus.fnlp.FNLPDoc

    BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
        new FileOutputStream(toPath ), "UTF-8"));
    Iterator<FNLPDoc> it1 = corpus.docs.iterator();
    while(it1.hasNext()){
      FNLPDoc doc = it1.next();
      Iterator<FNLPSent> it2 = doc.sentences.iterator();
      while(it2.hasNext()){
        FNLPSent sent = it2.next();
        if(!sent.hasTag())
          continue;
View Full Code Here

Examples of org.fnlp.nlp.corpus.fnlp.FNLPDoc

    ArrayList<FNLPSent> sents = new ArrayList<FNLPSent> ();
   
   
    Iterator<FNLPDoc> dit = corpus.docs.iterator();
    while(dit.hasNext()){
      FNLPDoc doc = dit.next();
      Iterator<FNLPSent> sit = doc.sentences.iterator();
      while(sit.hasNext()){
        FNLPSent sent = sit.next();
        String s = sent.getSentenceString();
        Matcher m = p.matcher(s);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.