edu.stanford.nlp.ie.regexp
Class RegexpExtractor

java.lang.Object
  |
  +--edu.stanford.nlp.ie.AbstractFieldExtractor
        |
        +--edu.stanford.nlp.ie.SingleFieldExtractor
              |
              +--edu.stanford.nlp.ie.regexp.RegexpExtractor
All Implemented Interfaces:
FieldExtractor, RankedExtractor, Serializable

public class RegexpExtractor
extends SingleFieldExtractor

SingleFieldExtractor that matches text using a regular expression. The Regexp is assumed to be Concept-neutral, i.e. it returns the same Relation using the same RE for all Concepts. This class is implemented using the java.util.regex.* classes from J2SE 1.4.

See Also:
Serialized Form

Constructor Summary
RegexpExtractor(String fieldName, String regexp)
          Constructs a new RegexpExtractor to extract the given relation name using the given regular expression string.
 
Method Summary
 String extractField(edu.unika.aifb.kaon.Instance i, String text)
          Returns the first matching stretch of text in the given text, or null, if none is found.
 String getDescription()
          Returns a description of this RegexpExtractor specifying the field name and regexp.
 String getExtractableField(edu.unika.aifb.kaon.Concept c)
          Returns the name of the relation (field) extracted by FieldExtractor.
 
Methods inherited from class edu.stanford.nlp.ie.SingleFieldExtractor
extractField, extractFields, extractFields, getExtractableFields
 
Methods inherited from class edu.stanford.nlp.ie.AbstractFieldExtractor
isFieldExtractable, storeExtractor, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegexpExtractor

public RegexpExtractor(String fieldName,
                       String regexp)
Constructs a new RegexpExtractor to extract the given relation name using the given regular expression string.

Parameters:
fieldName - Name of field to extract
regexp - Regexp to identify that field
Method Detail

getExtractableField

public String getExtractableField(edu.unika.aifb.kaon.Concept c)
Returns the name of the relation (field) extracted by FieldExtractor.

Specified by:
getExtractableField in class SingleFieldExtractor

extractField

public String extractField(edu.unika.aifb.kaon.Instance i,
                           String text)
Returns the first matching stretch of text in the given text, or null, if none is found.

Specified by:
extractField in class SingleFieldExtractor

getDescription

public String getDescription()
Returns a description of this RegexpExtractor specifying the field name and regexp.



Stanford NLP Group