|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.jmwe.harness.ConcordanceAnswerKey
public class ConcordanceAnswerKey
Default implementation of the IAnswerKey
interface. Searches for
the answer multi-word expressions in an IConcordanceSentence
by using a
Semcor corpus, which has multi-word expressions annotated.
This class requires JSemcor to be on the classpath.
Field Summary | |
---|---|
static Pattern |
condordanceSentenceIDPattern
A compiled regular expression pattern that captures the string representation of a Semcor sentence ID. |
static Pattern |
lexSensePattern
A compiled regular expression pattern that captures the string representation of sense key. |
Constructor Summary | |
---|---|
ConcordanceAnswerKey(edu.mit.jsemcor.main.IConcordance c)
Constructs an answer key from a single concordance |
|
ConcordanceAnswerKey(Iterable<? extends edu.mit.jsemcor.main.IConcordance> i)
Constructs an answer key from the given semcor concordance set. |
|
ConcordanceAnswerKey(Map<String,edu.mit.jsemcor.main.IConcordance> concords)
Constructs an answer key from the given semcor concordance set. |
Method Summary | ||
---|---|---|
protected MWEPOS |
disambiguatePOS(List<edu.mit.jsemcor.element.IWordform> mwe)
Attempts to disambiguate the part of speech of a multi-expression that does not have a semantic tag and whose parts are labeled with different part of speech tags. |
|
|
getAnswers(IMarkedSentence<T> sent)
Gets the answer multi-word expressions from the given sentence. |
|
|
getAnswers(IMarkedSentence<T> sent,
edu.mit.jsemcor.element.ISentence answers)
Extracts a set of MWE answers from a sentence and its corresponding answer sentence. |
|
protected
|
getContinuousMWEs(IMarkedSentence<T> sent,
edu.mit.jsemcor.element.ISentence answer,
Set<edu.mit.jsemcor.element.IWordform> used)
Gets the multi-word expressions from the given sentence that are marked as single tokens. |
|
protected MWEPOS |
getMWEPOS(String lexSense)
Given the lexical sense of a word form, extracts the one digit decimal integer representing the synset type of the sense and returns the corresponding part of speech. |
|
protected
|
getNonContinuousMWEs(IMarkedSentence<T> sent,
edu.mit.jsemcor.element.ISentence answer,
Set<edu.mit.jsemcor.element.IWordform> used)
Gets the multi-word expressions from the given sentence that are non-contiguous (e.g., have a distance value not equal to zero). |
|
static edu.mit.jsemcor.element.ISentence |
getSentence(Map<String,edu.mit.jsemcor.main.IConcordance> concords,
IMarkedSentence<?> sent)
Returns the concordance sentence that corresponds to the specified marked sentence |
|
boolean |
isIgnoringProperNouns()
Returns true if this answer key includes proper nouns in its
results; false otherwise |
|
protected static boolean |
isIllformattedLemma(edu.mit.jsemcor.element.ISemanticTag tag)
Returns true if the semantic tag of a multi-word expression is null, tags a proper noun, or if the lemma encoded in the semantic tag is not formatted properly, that is, with underscores separating the parts of the multi-word expression. |
|
void |
setIgnoreProperNouns(boolean ignoreProperNouns)
Sets the flag that, if true , determines that the answer key
will include proper nouns in its results. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Pattern condordanceSentenceIDPattern
public static final Pattern lexSensePattern
Constructor Detail |
---|
public ConcordanceAnswerKey(edu.mit.jsemcor.main.IConcordance c)
c
- the concordance that backs this answer key. May not be
null
.public ConcordanceAnswerKey(Iterable<? extends edu.mit.jsemcor.main.IConcordance> i)
i
- the set of concordances that backs this answer key. May not be
null
.
NullPointerException
- if the specified concordance set is null
public ConcordanceAnswerKey(Map<String,edu.mit.jsemcor.main.IConcordance> concords)
concords
- the semcor concordance that backs this answer key. May not be
null
.
NullPointerException
- if the specified concordance set is null
Method Detail |
---|
public boolean isIgnoringProperNouns()
true
if this answer key includes proper nouns in its
results; false
otherwise
true
if this answer key includes proper nouns in its
results; false
otherwisepublic void setIgnoreProperNouns(boolean ignoreProperNouns)
true
, determines that the answer key
will include proper nouns in its results.
ignoreProperNouns
- true
if this answer key should include proper
nouns in its results; false
otherwisepublic <T extends IToken> List<IMWE<T>> getAnswers(IMarkedSentence<T> sent)
IAnswerKey
null
.
getAnswers
in interface IAnswerKey
T
- type of tokens that are contained in the sentence.sent
- the sentence for which the answers should be retrieved May not
be null
.
public <T extends IToken> List<IMWE<T>> getAnswers(IMarkedSentence<T> sent, edu.mit.jsemcor.element.ISentence answers)
T
- the token typesent
- the sentence for which answers are neededanswers
- the answers
protected <T extends IToken> List<IMWE<T>> getNonContinuousMWEs(IMarkedSentence<T> sent, edu.mit.jsemcor.element.ISentence answer, Set<edu.mit.jsemcor.element.IWordform> used)
sent
- the unit for which the answers are being constructedanswer
- the semcor sentence from which the multi-token MWEs should be
extracted
NullPointerException
- if either argument is null
protected <T extends IToken> List<IMWE<T>> getContinuousMWEs(IMarkedSentence<T> sent, edu.mit.jsemcor.element.ISentence answer, Set<edu.mit.jsemcor.element.IWordform> used)
sent
- the unit for which the answers are being constructedanswer
- the semcor sentence from which the single-token MWEs should be
extracted
NullPointerException
- if either argument is null
protected MWEPOS getMWEPOS(String lexSense)
lexSense
- the lexical sense of a word form.
protected MWEPOS disambiguatePOS(List<edu.mit.jsemcor.element.IWordform> mwe)
MWEPOS.VERB
. Otherwise, returns
null
.
mwe
- the set of wordforms in the MWE
null
if nonepublic static edu.mit.jsemcor.element.ISentence getSentence(Map<String,edu.mit.jsemcor.main.IConcordance> concords, IMarkedSentence<?> sent)
concords
- the concordances which should be searched for the sentencesent
- the sentence corresponding to the concordance sentence that
should be retrieved
IllegalArgumentException
- if unable to find the sentenceprotected static boolean isIllformattedLemma(edu.mit.jsemcor.element.ISemanticTag tag)
tag
- the semantic tag of a wordform that is a part of a multi-word
expression.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |