Package opennlp.tools.coref.mention

Examples of opennlp.tools.coref.mention.DefaultParse


        parses.clear();
      }
      else {
        Parse p = Parse.parseParse(line);
        parses.add(p);
        Mention[] extents = treebankLinker.getMentionFinder().getMentions(new DefaultParse(p,sentenceNumber));
        //construct new parses for mentions which don't have constituents.
        for (int ei=0,en=extents.length;ei<en;ei++) {
          //System.err.println("PennTreebankLiner.main: "+ei+" "+extents[ei]);

          if (extents[ei].getParse() == null) {
            //not sure how to get head index, but its not used at this point.
            Parse snp = new Parse(p.getText(),extents[ei].getSpan(),"NML",1.0,0);
            p.insert(snp);
            extents[ei].setParse(new DefaultParse(snp,sentenceNumber));
          }

        }
        document.addAll(Arrays.asList(extents));
        sentenceNumber++;
View Full Code Here


        parses.clear();
      }
      else {
        Parse p = Parse.parseParse(line);
        parses.add(p);
        Mention[] extents = treebankLinker.getMentionFinder().getMentions(new DefaultParse(p,sentenceNumber));
        //construct new parses for mentions which don't have constituents.
        for (int ei=0,en=extents.length;ei<en;ei++) {
          //System.err.println("PennTreebankLiner.main: "+ei+" "+extents[ei]);
         
          if (extents[ei].getParse() == null) {
            Parse snp = new Parse(p.getText(),extents[ei].getSpan(),"NML",1.0);
            p.insert(snp);
            extents[ei].setParse(new DefaultParse(snp,sentenceNumber));
          }
         
        }
        document.addAll(Arrays.asList(extents));
        sentenceNumber++;
View Full Code Here

          while (!nodes.isEmpty()) {
           
            Parse node = nodes.pop();
           
            if (node.getSpan().equals(extents[ei].getSpan()) && node.getType().startsWith("NML")) {
              DefaultParse corefParseNode = new DefaultParse(node, corefParse.getSentenceNumber());
              extents[ei].setParse(corefParseNode);
              extents[ei].setId(corefParseNode.getEntityId());
              break;
            }
           
            nodes.addAll(Arrays.asList(node.getChildren()));
          }
View Full Code Here

            parses.clear();
          }
          else {
            Parse p = Parse.parseParse(line);
            parses.add(p);
            Mention[] extents = treebankLinker.getMentionFinder().getMentions(new DefaultParse(p,sentenceNumber));
            //construct new parses for mentions which don't have constituents.
            for (int ei=0,en=extents.length;ei<en;ei++) {
              //System.err.println("PennTreebankLiner.main: "+ei+" "+extents[ei]);

              if (extents[ei].getParse() == null) {
                //not sure how to get head index, but its not used at this point.
                Parse snp = new Parse(p.getText(),extents[ei].getSpan(),"NML",1.0,0);
                p.insert(snp);
                extents[ei].setParse(new DefaultParse(snp,sentenceNumber));
              }

            }
            document.addAll(Arrays.asList(extents));
            sentenceNumber++;
View Full Code Here

     
      for (int si = 0; si < allMentions.size(); si++) {
        CorefMention mentions[] = allMentions.get(si);
        Parse p = allParses.get(si);
       
        for (Mention extent : mentionFinder.getMentions(new DefaultParse(p, si))) {
          if (extent.getParse() == null) {
            // not sure how to get head index
            Parse snp = new Parse(p.getText(),extent.getSpan(),"NML",1.0,0);
            p.insert(snp);
          }
View Full Code Here

    List<opennlp.tools.coref.mention.Parse> corefParses =
        new ArrayList<opennlp.tools.coref.mention.Parse>();
   
    int sentNumber = 0;
    for (Parse parse : parses) {
      corefParses.add(new DefaultParse(parse, sentNumber++));
    }
   
    return corefParses;
  }
View Full Code Here

        parses.clear();
      }
      else {
        Parse p = Parse.parseParse(line);
        parses.add(p);
        Mention[] extents = treebankLinker.getMentionFinder().getMentions(new DefaultParse(p,sentenceNumber));
        //construct new parses for mentions which don't have constituents.
        for (int ei=0,en=extents.length;ei<en;ei++) {
          //System.err.println("PennTreebankLiner.main: "+ei+" "+extents[ei]);

          if (extents[ei].getParse() == null) {
            //not sure how to get head index, but its not used at this point.
            Parse snp = new Parse(p.getText(),extents[ei].getSpan(),"NML",1.0,0);
            p.insert(snp);
            extents[ei].setParse(new DefaultParse(snp,sentenceNumber));
          }

        }
        document.addAll(Arrays.asList(extents));
        sentenceNumber++;
View Full Code Here

        parses.clear();
      }
      else {
        Parse p = Parse.parseParse(line);
        parses.add(p);
        Mention[] extents = treebankLinker.getMentionFinder().getMentions(new DefaultParse(p,sentenceNumber));
        //construct new parses for mentions which don't have constituents.
        for (int ei=0,en=extents.length;ei<en;ei++) {
          //System.err.println("PennTreebankLiner.main: "+ei+" "+extents[ei]);

          if (extents[ei].getParse() == null) {
            //not sure how to get head index, but its not used at this point.
            Parse snp = new Parse(p.getText(),extents[ei].getSpan(),"NML",1.0,0);
            p.insert(snp);
            extents[ei].setParse(new DefaultParse(snp,sentenceNumber));
          }

        }
        document.addAll(Arrays.asList(extents));
        sentenceNumber++;
View Full Code Here

             //Note: I tried LinkerMode.EVAL for a long time
             // before realizing that this was the problem
             "models/coref", LinkerMode.TEST);
    int sentenceNumber = 0;
    Mention[] extents = treebankLinker.getMentionFinder().getMentions(
        new DefaultParse(chosen_parse, sentenceNumber));

    // construct new parses for mentions which don't have constituents.
    // for (int ei = 0, en = extents.length; ei < en; ei++) {
    for (final Mention mention : extents) {
      // System.err.println("PennTreebankLiner.main: "+ei+" "+extents[ei]);

      // if (extents[ei].getParse() == null) {
      if (mention.getParse() == null) {
        Parse snp = new Parse(p.getText(), mention.getSpan(), "NML",
            1.0, null);
        p.insert(snp);
        mention.setParse(new DefaultParse(snp, sentenceNumber));
      }

    }

    document.addAll(Arrays.asList(extents));
View Full Code Here

TOP

Related Classes of opennlp.tools.coref.mention.DefaultParse

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.