Home | Trees | Index | Help |
|
---|
Package nltk_lite :: Package contrib :: Module marshalbrill :: Class ProximateTokensRule |
|
object
--+ |BrillRuleI
--+ | ProximateTokensRule
ProximateTagsRule
,
ProximateWordsRule
An abstract base class for brill rules whose condition checks for the presence of tokens with given properties at given ranges of positions, relative to the token.
Each subclass of proximate tokens brill rule defines a method extract_property, which extracts a specific property from the the token, such as its text or tag. Each instance is parameterized by a set of tuples, specifying ranges of positions and property values to check for in those ranges:Method Summary | |
---|---|
Construct a new brill rule that changes a token's tag from original_tag to replacement_tag if all of the
properties specified in conditions hold. | |
__eq__(self,
other)
| |
__hash__(self)
| |
__repr__(self)
| |
__str__(self)
| |
Boolean |
Return true if the rule would change the tag of tokens[index] ,
False otherwise |
int
|
Apply this rule at every position in positions where it
applies to the corpus. |
any |
Returns some property characterizing this token, such as its base lexical item or its tag. (Static method) |
any |
Return the tag which this BrillRuleI may cause to be
replaced. |
any |
Return the tag with which this BrillRuleI may replace another
tag. |
Return a string representation of the given condition. | |
Return a string representation for the given range. | |
Inherited from BrillRuleI :
apply_to
Inherited from object :
__delattr__ ,
__getattribute__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|
Instance Method Details |
---|
__init__(self,
original_tag,
replacement_tag,
*conditions)
Construct a new brill rule that changes a token's tag from
|
applies(self, tokens, index)
|
apply_at(self, tokens, positions)Apply this rule at every position inpositions where it
applies to the corpus. I.e., for each position p in
positions , if tokens[p]
is tagged with this rule's original tag, and satisfies this rule's
condition, then set its tag to be this rule's replacement tag.
|
original_tag(self)
|
replacement_tag(self)
|
_condition_to_str(self, condition)Return a string representation of the given condition. This helper method is used by__str__ .
|
_range_to_str(self, start, end)Return a string representation for the given range. This helper method is used by__str__ .
|
Static Method Details |
---|
extract_property(token)Returns some property characterizing this token, such as its base lexical item or its tag. Each implentation of this method should correspond to an implementation of the method with the same name in a subclass ofProximateTokensTemplate .
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 | http://epydoc.sf.net |