Package opennlp.ccg.synsem

Examples of opennlp.ccg.synsem.Sign


            // parse it
            System.out.println(line);
      parser.parse(line);
      int numParses = Math.min(nbestListSize, parser.getResult().size());
      for (int i=0; i < numParses; i++) {
          Sign thisParse = parser.getResult().get(i);
          // convert lf
          Category cat = thisParse.getCategory();
          LF convertedLF = null;
          String predInfo = null;
          if (cat.getLF() != null) {
        // convert LF
        LF flatLF = cat.getLF();
        cat = cat.copy();
        Nominal index = cat.getIndexNominal();
        convertedLF = HyloHelper.compactAndConvertNominals(flatLF, index, thisParse);
        // get pred info
        predInfoMap.clear();
        Testbed.extractPredInfo(flatLF, predInfoMap);
        predInfo = Testbed.getPredInfo(predInfoMap);
          }
          // add test item, sign
          Element item = RegressionInfo.makeTestItem(grammar, line, 1, convertedLF);
          String actualID = (nbestListSize == 1) ? id : id + "-" + (i+1);
          item.setAttribute("info", actualID);
          outRoot.addContent(item);
          signMap.put(actualID, thisParse);
          // Add parsed words as a separate LF element
          Element fullWordsElt = new Element("full-words");
          fullWordsElt.addContent(tokenizer.format(thisParse.getWords()));
          item.addContent(fullWordsElt);
          if (predInfo != null) {
        Element predInfoElt = new Element("pred-info");
        predInfoElt.setAttribute("data", predInfo);
        item.addContent(predInfoElt);
View Full Code Here


        String whPrn=dep.lexDep.getOrthography();
        if((dep.rel.equals("GenRel")||dep.rel.equals("whApposRel")) && (whPrn.equals("that")||whPrn.equals("who")||whPrn.equals("which")||whPrn.equals("whose"))){
         
          //Make sure relative clause is linked to head of the quoted NP
          //(and not the quotation mark itself)
          Sign sib=this.getSibling(sign.getSiblingFilledDeps(),"Arg");
          if(sib!=null){
            this.headSign=sib;
          }
         
          //Simple WH-pronoun features
View Full Code Here

    storeFeatureMap(sign);
  }
 
  public Sign getOfComplSign(){
 
    Sign retval=null;
   
    return retval;
  }
View Full Code Here

  }
 
  //returns sibling sign of a given head given a relation label
  private Sign getSibling(List<LexDependency> sdeps,String rel){
   
    Sign retval=null;
    if(sdeps!=null){
      for(LexDependency dep: sdeps){
        if(dep.rel.equals(rel)){
          retval=dep.lexDep;
          break;
View Full Code Here

        float logProbTotal = 0;
        int numCached = 0;
        if (!tagsAdded && signToScore != null) { // check cache for initial words
            Sign[] inputs = signToScore.getDerivationHistory().getInputs();
            if (inputs != null) {
                Sign initialSign = (!reverse) ? inputs[0] : inputs[inputs.length-1];
                List<Word> initialWords = initialSign.getWords();
                Float logprob = getCachedLogProb(initialWords);
                if (logprob != null) {
                    logProbTotal = logprob.floatValue();
                    numCached = initialWords.size();
                }
View Full Code Here

TOP

Related Classes of opennlp.ccg.synsem.Sign

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.