info.ephyra.questionanalysis
Class TermExtractor

java.lang.Object
  extended by info.ephyra.questionanalysis.TermExtractor

public class TermExtractor
extends java.lang.Object

Extracts single- and multi-token terms from a sentence. Multi-token terms are named entities or compound terms found in dictionaries.

Version:
2007-05-28
Author:
Nico Schlaefer

Field Summary
private static int MAX_TERM_LENGTH
          Maximum length of a term in tokens.
 
Constructor Summary
TermExtractor()
           
 
Method Summary
static java.lang.String[][] getNes(java.lang.String sentence)
          Extracts named entities from the given sentence.
static java.lang.String[][] getNes(java.lang.String sentence, java.lang.String context)
          Extracts named entities from the given sentence and context string.
private static java.lang.String[] getNeTypes(java.lang.String term, java.lang.String[][] nes)
          Checks if the given term is among the named entities and returns the types of the entities that match it.
static Term[] getSingleTokenTerms(java.lang.String sentence)
          Extracts single-token terms from the given sentence.
static Term[] getTerms(java.lang.String sentence, Dictionary[] dicts)
          Extracts terms from the given sentence.
static Term[] getTerms(java.lang.String sentence, java.lang.String[][] nes, Dictionary[] dicts)
          Extracts terms from the given sentence, reusing named entities that have been extracted before.
static Term[] getTerms(java.lang.String sentence, java.lang.String context, java.lang.String[][] nes, Dictionary[] dicts)
          Extracts terms from the given sentence and context string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_TERM_LENGTH

private static final int MAX_TERM_LENGTH
Maximum length of a term in tokens.

See Also:
Constant Field Values
Constructor Detail

TermExtractor

public TermExtractor()
Method Detail

getNeTypes

private static java.lang.String[] getNeTypes(java.lang.String term,
                                             java.lang.String[][] nes)
Checks if the given term is among the named entities and returns the types of the entities that match it.

Parameters:
term - a term, potentially a named entity
nes - named entities
Returns:
types of matching entities

getNes

public static java.lang.String[][] getNes(java.lang.String sentence)
Extracts named entities from the given sentence.

Parameters:
sentence - sentence to analyze
Returns:
named entities in the sentence

getNes

public static java.lang.String[][] getNes(java.lang.String sentence,
                                          java.lang.String context)
Extracts named entities from the given sentence and context string.

Parameters:
sentence - sentence to analyze
context - context string
Returns:
named entities in the sentence and context string

getTerms

public static Term[] getTerms(java.lang.String sentence,
                              Dictionary[] dicts)
Extracts terms from the given sentence.

Parameters:
sentence - sentence to analyze
dicts - dictionaries with compound terms
Returns:
terms in the sentence

getTerms

public static Term[] getTerms(java.lang.String sentence,
                              java.lang.String[][] nes,
                              Dictionary[] dicts)
Extracts terms from the given sentence, reusing named entities that have been extracted before.

Parameters:
sentence - sentence to analyze
nes - named entities in the sentence
dicts - dictionaries with compound terms
Returns:
terms in the sentence

getTerms

public static Term[] getTerms(java.lang.String sentence,
                              java.lang.String context,
                              java.lang.String[][] nes,
                              Dictionary[] dicts)
Extracts terms from the given sentence and context string.

Parameters:
sentence - sentence to analyze
context - context string
nes - named entities in the sentence and context string
dicts - dictionaries with compound terms
Returns:
terms in the sentence and context string

getSingleTokenTerms

public static Term[] getSingleTokenTerms(java.lang.String sentence)
Extracts single-token terms from the given sentence.

Parameters:
sentence - sentence to analyze
Returns:
single-token terms in the sentence