Package edu.stanford.nlp.sempre.paraphrase.rules.RuleApplication

Examples of edu.stanford.nlp.sempre.paraphrase.rules.RuleApplication.ApplicationInfo


  private RuleApplication generateApplications(LanguageInfo antecedent, int i, int j, List<WordInfo> rhsMatch, SubstitutableSyntacticRule rule) {
    LanguageInfo consequent = new LanguageInfo();
    consequent.addSpan(antecedent, 0, i);
    consequent.addWordInfos(rhsMatch);
    consequent.addSpan(antecedent, j, antecedent.numTokens());
    RuleApplication application = new RuleApplication(antecedent, consequent, new ApplicationInfo(SYNT_SUBST, rule.toString()));
    FeatureVector fv = new FeatureVector();
    fv.add(SYNT_SUBST, rule.toString());
    fv.add(SYNT_SUBST, "score" ,rule.count);
    application.addFeatures(fv);
    if(opts.verbose>0)
View Full Code Here


        res.addSpan(antecedent, matchingInterval.start, matchingInterval.end);
      }
      else
        throw new RuntimeException("Rhs should be a list of wordinfo or integer keys to intervals only");
    }
    RuleApplication application = new RuleApplication(antecedent, res, new ApplicationInfo(RULE,""));
    application.addFeatures(featurizeParaphraseRule());
    return Collections.singletonList(application);
  }
View Full Code Here

        res.addSpan(antecedent, matchingInterval.start, matchingInterval.end);
      }
      else
        throw new RuntimeException("Rhs should be a list of wordinfo or integer keys to intervals only");
    }
    RuleApplication application = new RuleApplication(antecedent, res,new ApplicationInfo(DELETE,
        antecedent.lemmaPhrase(match.get(1).start, match.get(1).end)));
    application.addFeatures(featurizeDeletedSpan(new Interval(match.get(1).start,match.get(1).end),antecedent))
    return Collections.singletonList(application);
  }
View Full Code Here

        else { //i==1
          consequent.addSpan(target, targetInterval.start, targetInterval.end);
        }
      }
      RuleApplication application = new RuleApplication(antecedent, consequent,
          new ApplicationInfo(SUBST, antecedent.lemmaPhrase(match.get(1).start, match.get(1).end)+"-->"+
              target.lemmaPhrase(targetInterval.start, targetInterval.end)));
      application.addFeatures(featurizeSubstitutedSpan(match.get(1),targetInterval,antecedent,target));
      res.add(application);
    }
    return res;
View Full Code Here

        consequent.addSpan(antecedent, matchedInterval.end,i);
        consequent.addSpan(antecedent, matchedInterval.start,matchedInterval.end);
        consequent.addSpan(antecedent, i,antecedent.numTokens());
      }
      RuleApplication application = new RuleApplication(antecedent, consequent,
          new ApplicationInfo(MOVE,antecedent.lemmaPhrase(matchedInterval.start, matchedInterval.end)));
      application.addFeatures(featurizeMovedSpan(antecedent,matchedInterval));
      res.add(application);
    }
    return res;
  }
View Full Code Here

        int targetStart = rhsLemmaSpans.get(rhsLemmaSpan).first;
        int targetEnd = rhsLemmaSpans.get(rhsLemmaSpan).second;         
        LanguageInfo consequent = generateConsequent(antecedent,matchStart,matchEnd,
            target, targetStart,targetEnd);
        RuleApplication application = new RuleApplication(antecedent, consequent,
            new ApplicationInfo(PHRASE_TABLE, lhsPhrase+"-->"+rhsLemmaSpan));
        application.addFeatures(featureizePhraseTablespan(lhsPhrase,rhsLemmaSpan,rhsCandidates.get(rhsLemmaSpan),
            antecedent,matchStart,matchEnd,target,targetStart,targetEnd));
        //do not do an identity transformation
        res.add(application);
      }
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.sempre.paraphrase.rules.RuleApplication.ApplicationInfo

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.