Package jazzparser :: Package formalisms :: Package base :: Module rules :: Class Rule
[hide private]
[frames] | no frames]

Class Rule

source code

object --+
         |
        Rule
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, formalism, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
apply_rule(self, cat_list)
*** This should be overridden by subclasses.
source code
 
__str__(self)
str(x)
source code
 
apply_rule_semantics(self, cat_list)
Performs the semantic processing involved in applying the rule to these arguments.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  readable_rule = 'Undefined'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, formalism, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

apply_rule(self, cat_list)

source code 

*** This should be overridden by subclasses. *** Applies the rule to combine the categories in cat_list.

Note that the returned semantics should always be in beta-normal form.

Returns:
a list of the possible categories resulting from the application if the rule is valid for the given arguments, otherwise None.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

apply_rule_semantics(self, cat_list)

source code 

Performs the semantic processing involved in applying the rule to these arguments.

This doesn't do any checks on the syntactic type. If it's not used in a situation where you know that the syntactic part of the application will work, it could produce a non-sensical semantics or even raise errors. It's designed for speeding up applying a rule to many signs known to have the same syntactic type (so that the syntactic checks only need to be done once).

Depending on the formalism, this may not be any faster than calling apply_rule and getting the semantics from the results. In fact, this is the default behaviour. Any sensible formalism will provide a faster implementation of this method, though.

Returns:
list of the Semantics objects that would be the logical form parts of the results of the rule application.