public class QuoteAttributionUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
QuoteAttributionUtils.EnhancedSentenceAnnotation |
Constructor and Description |
---|
QuoteAttributionUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addEnhancedSentences(Annotation doc,
DependencyParser parser) |
static void |
annotateForDependencyParse(Annotation doc,
DependencyParser parser) |
static int |
getParagraphBeginNumber(CoreMap quote) |
static int |
getParagraphEndNumber(CoreMap quote) |
static int |
getParagraphRank(Annotation doc,
CoreMap quote) |
static int |
getQuoteParagraphIndex(Annotation doc,
CoreMap quote) |
static Pair<java.lang.Integer,java.lang.Integer> |
getRemainderInSentence(Annotation doc,
CoreMap quote)
Take a context for a quote using the following preferences in order:
(i) prior words in same sentence, if at least two, (ii) following words in same sentence, if at least two,
(iii) pPrevious sentence, if any, (iv) next sentence.
|
static java.util.List<CoreMap> |
getSentsForQuoteParagraphs(Annotation doc,
CoreMap quote) |
static java.util.List<CoreMap> |
getSentsInParagraph(Annotation doc,
int paragraph) |
static Pair<java.lang.Boolean,Pair<java.lang.Integer,java.lang.Integer>> |
getTokenRangeFollowingQuote(Annotation doc,
CoreMap quote)
Gets range of tokens that are in the same sentence as the beginning of the quote that follow it, if they exist,
or the next sentence, if it is in the same paragraph.
|
static Pair<java.lang.Boolean,Pair<java.lang.Integer,java.lang.Integer>> |
getTokenRangePrecedingQuote(Annotation doc,
CoreMap quote)
Gets range of tokens that are in the same sentence as the beginning of the quote that precede it, if they exist,
or the previous sentence, if it is in the same paragraph.
|
static boolean |
isPronominal(java.lang.String potentialPronoun) |
protected static java.util.Map<java.lang.Integer,java.lang.String> |
mapBammanToCharacterMap(java.util.Map<java.lang.Integer,java.util.List<CoreLabel>> BammanTokens,
java.util.Map<java.lang.String,java.util.List<Person>> characterMap) |
static boolean |
rangeContains(Pair<java.lang.Integer,java.lang.Integer> r1,
Pair<java.lang.Integer,java.lang.Integer> r2) |
static java.util.Set<java.lang.String> |
readAnimacyList(java.lang.String filename) |
static java.util.ArrayList<Person> |
readCharacterList(java.lang.String filename) |
static java.util.Set<java.lang.String> |
readFamilyRelations(java.lang.String filename) |
static java.util.Map<java.lang.String,Person.Gender> |
readGenderedNounList(java.lang.String filename) |
static java.util.Map<java.lang.String,java.util.List<Person>> |
readPersonMap(java.util.List<Person> personList) |
static java.util.Map<java.lang.String,java.util.List<Person>> |
readPersonMap(java.lang.String fileName) |
static java.util.Map<java.lang.Integer,java.lang.String> |
setupCoref(java.lang.String bammanFile,
java.util.Map<java.lang.String,java.util.List<Person>> characterMap,
Annotation doc)
Create a map of coreference to canonical entities for pronouns.
|
public static Pair<java.lang.Integer,java.lang.Integer> getRemainderInSentence(Annotation doc, CoreMap quote)
doc
- The document we are analyzingquote
- The particular quote that we are finding a sentence remainder for in which to find speech verbpublic static int getQuoteParagraphIndex(Annotation doc, CoreMap quote)
public static void addEnhancedSentences(Annotation doc, DependencyParser parser)
public static Pair<java.lang.Boolean,Pair<java.lang.Integer,java.lang.Integer>> getTokenRangePrecedingQuote(Annotation doc, CoreMap quote)
public static Pair<java.lang.Boolean,Pair<java.lang.Integer,java.lang.Integer>> getTokenRangeFollowingQuote(Annotation doc, CoreMap quote)
public static void annotateForDependencyParse(Annotation doc, DependencyParser parser)
public static int getParagraphRank(Annotation doc, CoreMap quote)
public static int getParagraphBeginNumber(CoreMap quote)
public static int getParagraphEndNumber(CoreMap quote)
public static java.util.List<CoreMap> getSentsInParagraph(Annotation doc, int paragraph)
public static java.util.List<CoreMap> getSentsForQuoteParagraphs(Annotation doc, CoreMap quote)
public static java.util.Map<java.lang.String,Person.Gender> readGenderedNounList(java.lang.String filename)
public static java.util.Set<java.lang.String> readFamilyRelations(java.lang.String filename)
public static java.util.Set<java.lang.String> readAnimacyList(java.lang.String filename)
public static java.util.Map<java.lang.String,java.util.List<Person>> readPersonMap(java.util.List<Person> personList)
public static java.util.Map<java.lang.String,java.util.List<Person>> readPersonMap(java.lang.String fileName)
public static java.util.ArrayList<Person> readCharacterList(java.lang.String filename)
public static boolean isPronominal(java.lang.String potentialPronoun)
public static java.util.Map<java.lang.Integer,java.lang.String> setupCoref(java.lang.String bammanFile, java.util.Map<java.lang.String,java.util.List<Person>> characterMap, Annotation doc)
bammanFile
- A file giving coreferences derived from analysis of David Bamman's bookNLP.
This may be null, and then CoreNLP coref is usedcharacterMap
- A mapping of names to people.
This is only used for Bamman coreference, otherwise, it can be null.
Or maybe not, maybe it is set up anyway from entity mentions....doc
- The CoreNLP documentprotected static java.util.Map<java.lang.Integer,java.lang.String> mapBammanToCharacterMap(java.util.Map<java.lang.Integer,java.util.List<CoreLabel>> BammanTokens, java.util.Map<java.lang.String,java.util.List<Person>> characterMap)