Package jazzparser :: Package formalisms :: Package music_halfspan :: Module syntax
[hide private]
[frames] | no frames]

Module syntax

source code

Syntactic categories module for the music_halfspan formalism.

Syntactic classes for the halfspan formalism. Atomic categories in this formalism carry information about the start and end keys of the span and some cadence features. The formalism also uses modalities.

It's similar to music_keyspan, but simpler.

The old music_keyspan formalism used to have loads of unification stuff. At the moment, this formalism avoids the need for unification altogether. It may be that we need some (milder) form of unification, at which point we can use the same framework that keyspan used. For now, this is much neater for not needing this stuff.


Author: Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>

Classes [hide private]
  Slash
  Sign
A CCG category and its associated semantics: a CCG sign.
  ComplexCategory
In the halfspan formalism, complex categories are made up of an argument half category, a slash and a result half category.
  HalfCategory
One half of an atomic category, or the argument or result of a complex category.
  AtomicCategory
An atomic category is of the form A-B, where A and B are half categories.
  DummyCategory
hash(x)
  UnificationResult
Dummy unification results which allows us to use the unification formalism without actually unifying any variables.
  SyntaxStringBuildError
  SignStringBuildError
Functions [hide private]
 
merge_equal_signs(existing_sign, new_sign)
Used when adding equal signs to the same edge in the chart.
source code
 
unify(category1, category2, grammar=None)
Dummy unification procedure.
source code
 
make_absolute_category_from_relative(relative_cat, base_root)
Given a CCGCategory and an absolute chord root in integer form, alters the category to that given by considering chord roots in the input category to be relative to the root of base_chord.
source code
 
pre_generalize_category(category)
When abstracting categories to something general that just represents the structure of the category, we have to do something special with half categories, since the standard abstraction routine expects the children of a complex category to be atomic or complex categories themselves.
source code
 
syntax_from_string(string)
Builds a Category instance from a string representation of the syntactic category.
source code
 
sign_from_string(string)
Simple combination of syntax_from_string and jazzparser.formalisms.music_halfspan.semantics.semantics_from_string to build a full sign from a string.
source code
Variables [hide private]
  logger = logging.getLogger("main_logger")
  __package__ = 'jazzparser.formalisms.music_halfspan'
Function Details [hide private]

merge_equal_signs(existing_sign, new_sign)

source code 

Used when adding equal signs to the same edge in the chart. Currently does nothing.

unify(category1, category2, grammar=None)

source code 

Dummy unification procedure.

Unification succeeds if and only if the two categories are equal (using their own definition of equality). The unification constraints do nothing to the categories when applied.

make_absolute_category_from_relative(relative_cat, base_root)

source code 

Given a CCGCategory and an absolute chord root in integer form, alters the category to that given by considering chord roots in the input category to be relative to the root of base_chord. E.g. a V category when considered relative to a IV chord would render a I chord.

pre_generalize_category(category)

source code 

When abstracting categories to something general that just represents the structure of the category, we have to do something special with half categories, since the standard abstraction routine expects the children of a complex category to be atomic or complex categories themselves.

syntax_from_string(string)

source code 

Builds a Category instance from a string representation of the syntactic category. This is mainly for testing and debugging and shouldn't be used in the wild (in the parser, for example). This is not how we construct categories out of the lexicon: they're specified in XML, which is a safer way to build them, though more laborious to write.

The strings may be constructed as follows.

Full atomic category: A-B. A and B are half categories (see below).

Slash category. Forward slash: A/B; optionally with a slash modality, A/{m}B. Backward slash: A\B or A\{m}B. A and B are half categories.

Half category: part of the above types. X^Y. X must be a roman numeral chord root. Y must be a function character (T, D or S), or multiple function characters. E.g. I^T or VI^TD