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

Module pcfg

source code

Special bindings to the music_halfspan formalism required by the PCFG parser.


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

Classes [hide private]
  HalfspanPcfgModel
A simple implementation of the PcfgModel interface.
Functions [hide private]
 
model_category_repr(category, base_category=None)
Given a syntactic category, generates a representation that will be used by the model.
source code
 
base_pitch(cat)
Arbitrarily picks a root out of the category, so that we can take the rest of the category and other categories relative to this consistently picked root.
source code
 
category_relative_chord(chord, category=None)
Returns a version of the Chord object that's relative to the base pitch of the category.
source code
Variables [hide private]
  __package__ = 'jazzparser.formalisms.music_halfspan'
Function Details [hide private]

model_category_repr(category, base_category=None)

source code 

Given a syntactic category, generates a representation that will be used by the model. The result should be a string and must uniquely identify all of the features of the category that the model should distinguish.

If base_category is given, it may be used as a base to compare the category to. In this case, observations of generated categories always take their parent as a base category and syntactic pitches are all relative to it.

If base_category is not given, the category itself will be considered the base category.

category_relative_chord(chord, category=None)

source code 

Returns a version of the Chord object that's relative to the base pitch of the category. If no category is given, the chord returned will be rooted at I (i.e. relative to itself).