info.ephyra.search.searchers
Class WikipediaKA

java.lang.Object
  extended by java.lang.Thread
      extended by info.ephyra.search.searchers.Searcher
          extended by info.ephyra.search.searchers.KnowledgeAnnotator
              extended by info.ephyra.search.searchers.WikipediaKA
All Implemented Interfaces:
java.lang.Runnable

public class WikipediaKA
extends KnowledgeAnnotator

A KnowledgeAnnotator for the Wikipedia online encyclopedia. It answers a question for a definition by returning a sentence from the corresponding Wikipedia web page.

It runs as a separate thread, so several queries can be performed in parallel.

This class extends the class KnowledgeAnnotator.

Version:
2005-09-28
Author:
Nico Schlaefer

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private static java.lang.String URL
          The URL of the Wikipedia search page.
 
Fields inherited from class info.ephyra.search.searchers.KnowledgeAnnotator
index, matcher, name, qContents, qPatterns
 
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
  WikipediaKA(java.lang.String filename)
          Creates a WikipediaKA and calls the constructor of the superclass that reads the question patterns from a file.
protected WikipediaKA(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  Result[] doSearch()
          Queries Wikipedia for a definition and returns an array containing a single Result object or an empty array, if the search failed.
 KnowledgeAnnotator getCopy()
          Returns a new instance of WikipediaKA.
 
Methods inherited from class info.ephyra.search.searchers.KnowledgeAnnotator
getContent, getKAName, getResult, matches, start
 
Methods inherited from class info.ephyra.search.searchers.Searcher
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

URL

private static final java.lang.String URL
The URL of the Wikipedia search page.

See Also:
Constant Field Values
Constructor Detail

WikipediaKA

protected WikipediaKA(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.

Parameters:
name - name of the KnowledgeAnnotator
qPatterns - question patterns
qContents - descriptors of the relevant content of a question

WikipediaKA

public WikipediaKA(java.lang.String filename)
            throws java.io.IOException
Creates a WikipediaKA and calls the constructor of the superclass that reads the question patterns from a file.

Parameters:
filename - file containing the question patterns
Throws:
java.io.IOException
Method Detail

doSearch

protected Result[] doSearch()
Queries Wikipedia for a definition and returns an array containing a single Result object or an empty array, if the search failed.

Specified by:
doSearch in class Searcher
Returns:
array containing a single Result or an empty array

getCopy

public KnowledgeAnnotator getCopy()
Returns a new instance of WikipediaKA. A new instance is created for each query.

Specified by:
getCopy in class KnowledgeAnnotator
Returns:
new instance of WikipediaKA