Skip to content

Commit

Permalink
Merge branch 'master' of jamie.stanford.edu:/u/nlp/git/javanlp
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Angeli authored and Stanford NLP committed Mar 18, 2017
1 parent 16e9822 commit c976a51
Show file tree
Hide file tree
Showing 15 changed files with 2,331 additions and 1,469 deletions.
Expand Up @@ -63,7 +63,7 @@ protected Annotation mkLargeAnnotation() {
return ann;
}

@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "ConstantConditions"})
public static void sameAsRead(Annotation doc, Annotation readDoc) {
// Run the original document through the number normalizer
if (doc.containsKey(CoreAnnotations.SentencesAnnotation.class)) {
Expand Down
Expand Up @@ -53,7 +53,7 @@
public class NaiveBayesClassifierFactory<L, F> implements ClassifierFactory<L, F, NaiveBayesClassifier<L, F>> {

/** A logger for this class */
private static Redwood.RedwoodChannels log = Redwood.channels(NaiveBayesClassifierFactory.class);
private static final Redwood.RedwoodChannels logger = Redwood.channels(NaiveBayesClassifierFactory.class);

private static final long serialVersionUID = -8164165428834534041L;
public static final int JL = 0;
Expand All @@ -67,8 +67,6 @@ public class NaiveBayesClassifierFactory<L, F> implements ClassifierFactory<L, F
private Index<L> labelIndex;
private Index<F> featureIndex;

final static Redwood.RedwoodChannels logger = Redwood.channels(NaiveBayesClassifierFactory.class);

public NaiveBayesClassifierFactory() {
}

Expand Down
3 changes: 2 additions & 1 deletion src/edu/stanford/nlp/coref/data/DocumentMaker.java
Expand Up @@ -56,7 +56,8 @@ private static DocReader getDocumentReader(Properties props) {
if (!PropertiesUtils.getBool(props,"coref.printConLLLoadingMessage",true))
options.printConLLLoadingMessage = false;
options.annotateTokenCoref = false;
options.setFilter(".*_auto_conll$");
String conllFileFilter = props.getProperty("coref.conllFileFilter", ".*_auto_conll$");
options.setFilter(conllFileFilter);
options.lang = CorefProperties.getLanguage(props);
return new CoNLLDocumentReader(corpusPath, options);
}
Expand Down
Expand Up @@ -920,7 +920,8 @@ public static <E extends CoreMap> String singleEntityToString(List<E> l) {
StringBuilder sb = new StringBuilder();
for (E w : l) {
if(!w.get(CoreAnnotations.NamedEntityTagAnnotation.class).equals(entityType)) {
log.fatal("Incontinuous NER tags detected in entity: " + l);
log.error("differing NER tags detected in entity: " + l);
throw new Error("Error with entity construction, two tokens had inconsistent NER tags");
}
sb.append(w.get(CoreAnnotations.TextAnnotation.class));
}
Expand Down
1 change: 0 additions & 1 deletion src/edu/stanford/nlp/ie/NERClassifierCombiner.java
Expand Up @@ -192,7 +192,6 @@ public NERClassifierCombiner(ObjectInputStream ois, Properties props) throws IOE
this.gazetteMapping = readRegexnerGazette(DefaultPaths.DEFAULT_NER_GAZETTE_MAPPING);
} else {
this.gazetteMapping = Collections.emptyMap();
log.fatal("Property ner.language not recognized: " + nerLanguage);
}
}

Expand Down
Expand Up @@ -200,7 +200,8 @@ private static boolean rightScanFindsMoneyWord(List<CoreLabel> pl, int i) {
@Override
public List<CoreLabel> classifyWithGlobalInformation(List<CoreLabel> tokenSequence, CoreMap document, CoreMap sentence) {
if(useSUTime) {
log.fatal("ChineseNumberSequenceClassifier does not have SUTime implementation.");
log.error("ChineseNumberSequenceClassifier does not have SUTime implementation.");
throw new Error("Error: no SUTime implementation for ChineseNumberSequenceClassifier");
}
return classify(tokenSequence);
}
Expand Down
11 changes: 11 additions & 0 deletions src/edu/stanford/nlp/naturalli/NaturalLogicAnnotations.java
Expand Up @@ -46,6 +46,17 @@ public Class<Collection<SentenceFragment>> getType() {
}
}

/**
* A set of clauses contained in and entailed by this sentence.
*/
public static final class EntailedClausesAnnotation implements CoreAnnotation<Collection<SentenceFragment>> {
@SuppressWarnings("unchecked")
@Override
public Class<Collection<SentenceFragment>> getType() {
return (Class<Collection<SentenceFragment>>) ((Object) Collection.class);
}
}

/**
* The set of relation triples extracted from this sentence.
*/
Expand Down
1 change: 1 addition & 0 deletions src/edu/stanford/nlp/naturalli/OpenIE.java
Expand Up @@ -494,6 +494,7 @@ public void annotateSentence(CoreMap sentence, Map<CoreLabel, List<CoreLabel>> c
extractions.addAll(relationsInFragments(fragments, sentence));

// Set the annotations
sentence.set(NaturalLogicAnnotations.EntailedClausesAnnotation.class, new HashSet<>(clauses));
sentence.set(NaturalLogicAnnotations.EntailedSentencesAnnotation.class, fragments);
sentence.set(NaturalLogicAnnotations.RelationTriplesAnnotation.class,
new ArrayList<>(new HashSet<>(extractions))); // uniq the extractions
Expand Down
1 change: 1 addition & 0 deletions src/edu/stanford/nlp/pipeline/CoreNLP.proto
Expand Up @@ -75,6 +75,7 @@ message Sentence {
repeated RelationTriple openieTriple = 14; // The OpenIE triples in the sentence
repeated RelationTriple kbpTriple = 16; // The KBP triples in this sentence
repeated SentenceFragment entailedSentence = 15; // The entailed sentences, by natural logic
repeated SentenceFragment entailedClause = 35; // The entailed clauses, by natural logic
optional DependencyGraph enhancedDependencies = 17;
optional DependencyGraph enhancedPlusPlusDependencies = 18;
repeated Token character = 19;
Expand Down

0 comments on commit c976a51

Please sign in to comment.