|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
info.ephyra.search.searchers.Searcher
info.ephyra.search.searchers.KnowledgeAnnotator
public abstract class KnowledgeAnnotator
A KnowledgeAnnotator searches a (semi)structured knowledge
source. It provides a specialized solution to certain classes of questions,
described by a set of question patterns. Only questions that match at least
one of the patterns in the field qPatterns are supported by a
KnowledgeAnnotator.
It runs as a separate thread, so several queries can be performed in parallel.
This class extends the class Searcher and is abstract.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected int |
index
Index of the matching pattern. |
protected java.util.regex.Matcher |
matcher
The Matcher that matched the pattern with the question. |
protected java.lang.String |
name
Name of the knowledge annotator. |
protected java.util.ArrayList<java.lang.String> |
qContents
Strings identifying the relevant content of a question by referring to the groups in the corresponding question patterns. |
protected java.util.ArrayList<java.util.regex.Pattern> |
qPatterns
A question that matches at least one of these patterns can be handled by the KnowledgeAnnotator. |
| Fields inherited from class info.ephyra.search.searchers.Searcher |
|---|
query, results |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
|
KnowledgeAnnotator(java.lang.String filename)
Creates a KnowledgeAnnotator and reads the question
patterns and descriptors of the relevant content of a question from a
file. |
protected |
KnowledgeAnnotator(java.lang.String name,
java.util.ArrayList<java.util.regex.Pattern> qPatterns,
java.util.ArrayList<java.lang.String> qContents)
Protected constructor used by the getCopy() method. |
| Method Summary | |
|---|---|
protected java.lang.String |
getContent()
Extracts the relevant content of a question by resolving the group identifiers of the format [group_no] in the content string
that corresponds to the matching pattern. |
abstract KnowledgeAnnotator |
getCopy()
Returns a new instance of the KnowledgeAnnotator. |
java.lang.String |
getKAName()
Returns the name of the knowledgeAnnotator. |
protected Result[] |
getResult(java.lang.String answer,
java.lang.String docID)
Creates an array of a single Result object form an answer
string and a document ID. |
protected boolean |
matches(Query query)
Tests whether the knowledge annotator is appropriate for a question by applying the patterns in the field qPatterns. |
boolean |
start(Query query)
Sets the query and starts the thread if the knowledge annotator is appropriate for the user question. |
| Methods inherited from class info.ephyra.search.searchers.Searcher |
|---|
doSearch, run |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String name
protected java.util.ArrayList<java.util.regex.Pattern> qPatterns
KnowledgeAnnotator.
protected java.util.ArrayList<java.lang.String> qContents
protected int index
protected java.util.regex.Matcher matcher
Matcher that matched the pattern with the question.
| Constructor Detail |
|---|
protected KnowledgeAnnotator(java.lang.String name,
java.util.ArrayList<java.util.regex.Pattern> qPatterns,
java.util.ArrayList<java.lang.String> qContents)
getCopy() method.
name - name of the KnowledgeAnnotatorqPatterns - question patternsqContents - descriptors of the relevant content of a question
public KnowledgeAnnotator(java.lang.String filename)
throws java.io.IOException
Creates a KnowledgeAnnotator and reads the question
patterns and descriptors of the relevant content of a question from a
file.
The file must have the following format:
KnowledgeAnnotator::
[name of the knowledge annotator]
QuestionPatterns:
[regular expression 1]
[relevant content 1]
...
[regular expression n]
[relevant content n]
The relevant content of a question is described by a string that may
contain group identifiers of the format [group_no] that are
replaced by the capturing groups that occur in the corresponding question
pattern.
filename - file containing the question patterns and descriptors of
the relevant content of a question
java.io.IOException| Method Detail |
|---|
protected boolean matches(Query query)
qPatterns.
query - Query object
qPatternsprotected java.lang.String getContent()
[group_no] in the content string
that corresponds to the matching pattern.
protected Result[] getResult(java.lang.String answer,
java.lang.String docID)
Result object form an answer
string and a document ID.
answer - answer stringdocID - document ID
Result objectpublic java.lang.String getKAName()
public abstract KnowledgeAnnotator getCopy()
Returns a new instance of the KnowledgeAnnotator. A new
instance is created for each query.
It does not necessarily return an exact copy of the current instance.
KnowledgeAnnotatorpublic boolean start(Query query)
Sets the query and starts the thread if the knowledge annotator is appropriate for the user question.
This method should be used instead of the inherited
start() method without arguments.
query - query object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||