List of usage examples for edu.stanford.nlp.trees EnglishGrammaticalRelations MARKER
GrammaticalRelation MARKER
To view the source code for edu.stanford.nlp.trees EnglishGrammaticalRelations MARKER.
Click Source Link
From source file:knu.univ.lingvo.coref.Mention.java
License:Open Source License
public int getReportEmbedding(Dictionaries dict) { if (headIndexedWord == null) return 0; // check adverbial clause with marker "as" Collection<IndexedWord> siblings = dependency.getSiblings(headIndexedWord); for (IndexedWord sibling : siblings) { if (dict.reportVerb.contains(sibling.lemma()) && dependency.hasParentWithReln(sibling, EnglishGrammaticalRelations.ADV_CLAUSE_MODIFIER)) { IndexedWord marker = dependency.getChildWithReln(sibling, EnglishGrammaticalRelations.MARKER); if (marker != null && marker.lemma().equals("as")) { return 1; }/*from w ww . j a va2 s. c o m*/ } } // look at the path to root List<IndexedWord> path = dependency.getPathToRoot(headIndexedWord); if (path == null) return 0; boolean isSubject = false; // if the node itself is a subject, we will not take into account its parent in the path if (dependency.hasParentWithReln(headIndexedWord, EnglishGrammaticalRelations.NOMINAL_SUBJECT)) isSubject = true; for (IndexedWord word : path) { if (!isSubject && (dict.reportVerb.contains(word.lemma()) || dict.reportNoun.contains(word.lemma()))) { return 1; } // check how to put isSubject isSubject = dependency.hasParentWithReln(word, EnglishGrammaticalRelations.NOMINAL_SUBJECT); } return 0; }