|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.ephyra.questionanalysis.QuestionPattern
public class QuestionPattern
A QuestionPattern is applied to a question to determine the
TARGET of the question, CONTEXT information and the PROPERTY the question
asks for.
| Field Summary | |
|---|---|
private int[] |
contextIDs
IDs of 0 to n groups that represent the CONTEXT of the question. |
private static int |
MAX_CONTEXT
Maximum length of a CONTEXT object in tokens. |
private static int |
MAX_TARGET
Maximum length of a TARGET object in tokens. |
private java.util.regex.Pattern |
pattern
The Pattern that is applied to a question string. |
private java.lang.String |
property
The PROPERTY that a question which matches this pattern asks for. |
private int |
targetID
ID of the group that represents the TARGET of the question. |
| Constructor Summary | |
|---|---|
QuestionPattern(java.lang.String expr,
java.lang.String prop)
Creates a QuestionPattern from a descriptor that is a
regular expression but additionally contains the following tags:
<TO> - exactly one TARGET tag
<CO> - an arbitrary number of CONTEXT tags
|
|
| Method Summary | |
|---|---|
QuestionInterpretation |
apply(java.lang.String qn,
java.lang.String stemmed)
Applies the pattern to a question. |
private QuestionInterpretation |
ensureNounPhrases(java.lang.String qn,
QuestionInterpretation qi)
Ensures that the TARGET and CONTEXT objects are noun phrases and splits the objects along prepositions and punctuation marks. |
private java.lang.String |
formatObject(java.lang.String object)
Formats the extracted TARGET and CONTEXT objects. |
java.lang.String |
getProperty()
Returns the PROPERTY that a question which matches the pattern asks for. |
private java.lang.String |
replaceContextTags(java.lang.String expr)
Sets the contextIDs field and replaces the CONTEXT tags by
capturing groups. |
private java.lang.String |
replaceTargetTag(java.lang.String expr)
Sets the targetID field and replaces the TARGET tag by a
capturing group. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int MAX_TARGET
private static final int MAX_CONTEXT
private java.util.regex.Pattern pattern
Pattern that is applied to a question string.
private java.lang.String property
private int targetID
private int[] contextIDs
| Constructor Detail |
|---|
public QuestionPattern(java.lang.String expr,
java.lang.String prop)
QuestionPattern from a descriptor that is a
regular expression but additionally contains the following tags:
expr - pattern descriptorprop - PROPERTY that a question which matches the pattern asks for| Method Detail |
|---|
private java.lang.String replaceTargetTag(java.lang.String expr)
targetID field and replaces the TARGET tag by a
capturing group.
expr - pattern descriptor
private java.lang.String replaceContextTags(java.lang.String expr)
contextIDs field and replaces the CONTEXT tags by
capturing groups.
expr - pattern descriptor
private QuestionInterpretation ensureNounPhrases(java.lang.String qn,
QuestionInterpretation qi)
qn - normalized question stringqi - question interpretation
private java.lang.String formatObject(java.lang.String object)
object - TARGET or CONTEXT object
public java.lang.String getProperty()
public QuestionInterpretation apply(java.lang.String qn,
java.lang.String stemmed)
QuestionInterpretation is returned, else
null.
qn - normalized question stringstemmed - stemmed question string
null, if the
question does not match the pattern
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||