Package db_mirrors
source code
Data structures that mirror the database models.
In order to have a data format that can be passed around without
needing a database set up to import the data into, we need mirrors of the
database models that are not themselves dependent on a database. These
classes exactly replicate the data structure of the models in
apps.sequences.models and can be created from those models (see
model.mirror).
The intention of this is not that this data can be imported back into
the database, but simply that all the database's chord sequence data can
be read in (from a pickled file) and output to other formats. These
classes just provide the unified database-independent data models. It is
these exported models that are used for training models, etc.
Use load_pickled_data to read in a file that's been created from the
database models.
Author:
Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>
|
|
Chord
A single instance of a chord in a sequence.
|
|
|
TreeInfo
Additional information about a chord that allows an unambiguous
derivation tree to be built.
|
|
|
ChordSequence
A chord sequence in the corpus.
|
|
|
SequenceIndex
Stores indexes and provides quick access to mirrored sequences.
|
|
|
load_pickled_data(filename)
Data from the database can be converted into the form of the above
models and saved to a file by pickling (see
apps.sequences.datautils). |
source code
|
|
|
|
save_sequences(filename,
sequences)
Given a list of ChordSequence mirror instances, saves them to a file
by pickling. |
source code
|
|
|
|
__package__ = 'jazzparser.data.db_mirrors'
|
|
Data from the database can be converted into the form of the above
models and saved to a file by pickling (see apps.sequences.datautils).
Without any dependence on the database, we can then read in such a file
and access all the sequence data. Returns a list of ChordSequence
mirrors.
|
|
Given a list of ChordSequence mirror instances, saves them to a file
by pickling. This can be done directly from the database using
apps.sequences.datautils.pickle_all_sequences.
|