本文整理汇总了Java中edu.stanford.nlp.dcoref.SieveCoreferenceSystem类的典型用法代码示例。如果您正苦于以下问题:Java SieveCoreferenceSystem类的具体用法?Java SieveCoreferenceSystem怎么用?Java SieveCoreferenceSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SieveCoreferenceSystem类属于edu.stanford.nlp.dcoref包,在下文中一共展示了SieveCoreferenceSystem类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: skipThisMention
import edu.stanford.nlp.dcoref.SieveCoreferenceSystem; //导入依赖的package包/类
/** Skip this mention? (search pruning) */
public boolean skipThisMention(Document document, Mention m1, CorefCluster c, Dictionaries dict) {
boolean skip = false;
// only do for the first mention in its cluster
if(!flags.USE_EXACTSTRINGMATCH && !flags.USE_ROLEAPPOSITION && !flags.USE_PREDICATENOMINATIVES
&& !flags.USE_ACRONYM && !flags.USE_APPOSITION && !flags.USE_RELATIVEPRONOUN
&& !c.getFirstMention().equals(m1)) {
return true;
}
if(Constants.USE_DISCOURSE_SALIENCE) {
SieveCoreferenceSystem.logger.finest("DOING COREF FOR:\t" + m1.spanToString());
if(m1.appositions == null && m1.predicateNominatives == null
&& (m1.spanToString().toLowerCase().startsWith("a ") || m1.spanToString().toLowerCase().startsWith("an "))
&& !flags.USE_EXACTSTRINGMATCH) {
skip = true; // A noun phrase starting with an indefinite article - unlikely to have an antecedent (e.g. "A commission" was set up to .... )
}
if(dict.indefinitePronouns.contains(m1.spanToString().toLowerCase())) {
skip = true; // An indefinite pronoun - unlikely to have an antecedent (e.g. "Some" say that... )
}
for(String indef : dict.indefinitePronouns){
if(m1.spanToString().toLowerCase().startsWith(indef + " ")) {
skip = true; // A noun phrase starting with an indefinite adjective - unlikely to have an antecedent (e.g. "Another opinion" on the topic is...)
break;
}
}
if(skip) {
SieveCoreferenceSystem.logger.finest("MENTION SKIPPED:\t" + m1.spanToString() + "(" + m1.sentNum + ")"+"\toriginalRef: "+m1.originalRef + " in discourse "+m1.headWord.get(CoreAnnotations.UtteranceAnnotation.class));
}
}
return skip;
}
示例2: sortMentionsForPronoun
import edu.stanford.nlp.dcoref.SieveCoreferenceSystem; //导入依赖的package包/类
/** Divides a sentence into clauses and sort the antecedents for pronoun matching */
private static List<Mention> sortMentionsForPronoun(List<Mention> l, Mention m1, boolean sameSentence) {
List<Mention> sorted = new ArrayList<Mention>();
Tree tree = m1.contextParseTree;
Tree current = m1.mentionSubTree;
if(sameSentence){
while(true){
current = current.ancestor(1, tree);
if(current.label().value().startsWith("S")){
for(Mention m : l){
if(!sorted.contains(m) && current.dominates(m.mentionSubTree)) sorted.add(m);
}
}
if(current.label().value().equals("ROOT") || current.ancestor(1, tree)==null) break;
}
if(l.size()!=sorted.size()) {
SieveCoreferenceSystem.logger.finest("sorting failed!!! -> parser error?? \tmentionID: "+m1.mentionID+" " + m1.spanToString());
sorted=l;
} else if(!l.equals(sorted)){
SieveCoreferenceSystem.logger.finest("sorting succeeded & changed !! \tmentionID: "+m1.mentionID+" " + m1.spanToString());
for(int i=0; i<l.size(); i++){
Mention ml = l.get(i);
Mention msorted = sorted.get(i);
SieveCoreferenceSystem.logger.finest("\t["+ml.spanToString()+"]\t["+msorted.spanToString()+"]");
}
} else {
SieveCoreferenceSystem.logger.finest("no changed !! \tmentionID: "+m1.mentionID+" " + m1.spanToString());
}
}
return sorted;
}
示例3: DeterministicCorefAnnotator
import edu.stanford.nlp.dcoref.SieveCoreferenceSystem; //导入依赖的package包/类
public DeterministicCorefAnnotator(Properties props) {
try {
corefSystem = new SieveCoreferenceSystem(props);
mentionExtractor = new MentionExtractor(corefSystem.dictionaries(), corefSystem.semantics());
OLD_FORMAT = Boolean.parseBoolean(props.getProperty("oldCorefFormat", "false"));
} catch (Exception e) {
System.err.println("ERROR: cannot create DeterministicCorefAnnotator!");
e.printStackTrace();
throw new RuntimeException(e);
}
}
示例4: StanbolDeterministicCorefAnnotator
import edu.stanford.nlp.dcoref.SieveCoreferenceSystem; //导入依赖的package包/类
public StanbolDeterministicCorefAnnotator(Properties props) {
try {
corefSystem = new SieveCoreferenceSystem(props);
mentionExtractor = new MentionExtractor(corefSystem.dictionaries(), corefSystem.semantics());
OLD_FORMAT = Boolean.parseBoolean(props.getProperty("oldCorefFormat", "false"));
allowReparsing = PropertiesUtils.getBool(props, Constants.ALLOW_REPARSING_PROP, Constants.ALLOW_REPARSING);
} catch (Exception e) {
System.err.println("ERROR: cannot create DeterministicCorefAnnotator!");
e.printStackTrace();
throw new RuntimeException(e);
}
}
示例5: signature
import edu.stanford.nlp.dcoref.SieveCoreferenceSystem; //导入依赖的package包/类
public static String signature(Properties props) {
return SieveCoreferenceSystem.signature(props);
}