|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor<T>
public class CoreMapExpressionExtractor<T extends MatchedExpression>
Represents a list of assignment and extraction rules over sequence patterns.
See SequenceMatchRules for syntax of rules.
Assignment rules are used to assign value to variable for later use in extraction rules or for expansions in patterns.
Extraction rules are used to extract text/tokens matching regular expressions. Extraction rules are grouped into stages, with each stage consisting of the following.
CoreMap
SequenceMatchRules| Nested Class Summary | |
|---|---|
static class |
CoreMapExpressionExtractor.Stage<T>
Describes one stage of extraction |
| Constructor Summary | |
|---|---|
CoreMapExpressionExtractor()
Creates an empty instance with no rules |
|
CoreMapExpressionExtractor(Env env)
Creates a default instance with the specified environment. |
|
CoreMapExpressionExtractor(Env env,
java.util.List<SequenceMatchRules.Rule> rules)
Creates an instance with the specified environment and list of rules |
|
| Method Summary | |
|---|---|
void |
appendRules(java.util.List<SequenceMatchRules.Rule> rules)
Add specified rules to this extractor |
Pair<java.util.List<? extends CoreMap>,java.util.List<T>> |
applyCompositeRule(SequenceMatchRules.ExtractRule<java.util.List<? extends CoreMap>,T> compositeExtractRule,
java.util.List<? extends CoreMap> merged,
java.util.List<T> matchedExpressions,
int limit)
|
static CoreMapExpressionExtractor |
createExtractorFromFile(Env env,
java.lang.String filename)
Creates an extractor using the specified environment, and reading the rules from the given filename |
static CoreMapExpressionExtractor |
createExtractorFromFiles(Env env,
java.util.List<java.lang.String> filenames)
Creates an extractor using the specified environment, and reading the rules from the given filenames |
static CoreMapExpressionExtractor |
createExtractorFromFiles(Env env,
java.lang.String... filenames)
Creates an extractor using the specified environment, and reading the rules from the given filenames |
static CoreMapExpressionExtractor |
createExtractorFromString(Env env,
java.lang.String str)
Creates an extractor using the specified environment, and reading the rules from the given string |
java.util.List<CoreMap> |
extractCoreMaps(CoreMap annotation)
Returns list of coremaps that matches the specified rules |
java.util.List<CoreMap> |
extractCoreMapsMergedWithTokens(CoreMap annotation)
Returns list of merged tokens and original tokens |
java.util.List<CoreMap> |
extractCoreMapsToList(java.util.List<CoreMap> res,
CoreMap annotation)
|
java.util.List<T> |
extractExpressions(CoreMap annotation)
|
java.util.List<CoreMap> |
flatten(java.util.List<CoreMap> cms)
|
java.util.List<CoreMap> |
flatten(java.util.List<CoreMap> cms,
java.lang.Class key)
|
Env |
getEnv()
|
Value |
getValue(java.lang.String varname)
|
void |
setExtractRules(SequenceMatchRules.ExtractRule<CoreMap,T> basicExtractRule,
SequenceMatchRules.ExtractRule<java.util.List<? extends CoreMap>,T> compositeExtractRule,
Filter<T> filterRule)
|
void |
setLogger(java.util.logging.Logger logger)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CoreMapExpressionExtractor()
public CoreMapExpressionExtractor(Env env)
env - Environment to use for binding variables and applying rules
public CoreMapExpressionExtractor(Env env,
java.util.List<SequenceMatchRules.Rule> rules)
env - Environment to use for binding variables and applying rulesrules - List of rules for this extractor| Method Detail |
|---|
public void appendRules(java.util.List<SequenceMatchRules.Rule> rules)
rules - public Env getEnv()
public void setLogger(java.util.logging.Logger logger)
public void setExtractRules(SequenceMatchRules.ExtractRule<CoreMap,T> basicExtractRule,
SequenceMatchRules.ExtractRule<java.util.List<? extends CoreMap>,T> compositeExtractRule,
Filter<T> filterRule)
public static CoreMapExpressionExtractor createExtractorFromFiles(Env env,
java.lang.String... filenames)
throws java.lang.RuntimeException
env - filenames -
java.lang.RuntimeException
public static CoreMapExpressionExtractor createExtractorFromFiles(Env env,
java.util.List<java.lang.String> filenames)
throws java.lang.RuntimeException
env - filenames -
java.lang.RuntimeException
public static CoreMapExpressionExtractor createExtractorFromFile(Env env,
java.lang.String filename)
throws java.lang.RuntimeException
env - filename -
java.lang.RuntimeException
public static CoreMapExpressionExtractor createExtractorFromString(Env env,
java.lang.String str)
throws java.io.IOException,
ParseException
env - str -
IOException, - ParseException
java.io.IOException
ParseExceptionpublic Value getValue(java.lang.String varname)
public java.util.List<CoreMap> extractCoreMapsToList(java.util.List<CoreMap> res,
CoreMap annotation)
public java.util.List<CoreMap> extractCoreMaps(CoreMap annotation)
annotation - public java.util.List<CoreMap> extractCoreMapsMergedWithTokens(CoreMap annotation)
annotation - public java.util.List<CoreMap> flatten(java.util.List<CoreMap> cms)
public java.util.List<CoreMap> flatten(java.util.List<CoreMap> cms,
java.lang.Class key)
public Pair<java.util.List<? extends CoreMap>,java.util.List<T>> applyCompositeRule(SequenceMatchRules.ExtractRule<java.util.List<? extends CoreMap>,T> compositeExtractRule,
java.util.List<? extends CoreMap> merged,
java.util.List<T> matchedExpressions,
int limit)
public java.util.List<T> extractExpressions(CoreMap annotation)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||