Package jazzparser :: Package data :: Package input :: Class DbInput
[hide private]
[frames] | no frames]

Class DbInput

source code

 object --+        
          |        
InputReader --+    
              |    
          Input --+
                  |
                 DbInput
Known Subclasses:

Wrapper for input from the database, rather than the command line. No point in reducing db input to a string, then reinterpreting it.

If only one of times and durations is given, the other will be computed from it. Computing times from durations involves assuming that the first chord occurs at time 0. Computing durations from times involves assuming that the last chord has a length of 1.

At least one of times and durations must be given.

We also store the id of the chord sequence that this came from (id) and the sequence representation itself (sequence). This may be None in some cases.

Confusingly (for historical reasons!), inputs contains string chord labels. chords contains the db_mirrors representation of the chords.

Instance Methods [hide private]
 
__init__(self, inputs, durations=None, times=None, id=None, chords=None, sequence=None, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
get_gold_analysis(self)
Parses the annotations, if present, to get a gold analysis.
source code
 
__str__(self)
str(x)
source code
 
__len__(self) source code
 
__getitem__(self, item) source code
 
slice(self, start=None, end=None)
Subclasses should provide a way of slicing (taking a subsequence of) the input that returns an input of the original type.
source code

Inherited from Input (private): _get_string_name

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

Class Methods [hide private]

Inherited from InputReader: process_option_dict

Static Methods [hide private]
 
from_sequence(seq)
Creates a DbInput from a database representation of a sequence.
source code
 
from_file(filename, options={}) source code
Class Variables [hide private]
  FILE_INPUT_OPTIONS = [ModuleOption('index', filter= int, help_...

Inherited from InputReader: SHELL_TOOLS

Properties [hide private]

Inherited from Input: string_name

Inherited from object: __class__

Method Details [hide private]

__init__(self, inputs, durations=None, times=None, id=None, chords=None, sequence=None, *args, **kwargs)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

get_gold_analysis(self)

source code 

Parses the annotations, if present, to get a gold analysis. Unlike AnnotatedDbInput, this input type cannot be assumed to have annotations. It will therefore not raise an error if annotations are missing or incomplete, but just return None.

Overrides: Input.get_gold_analysis

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__len__(self)
(Length operator)

source code 
Overrides: Input.__len__

__getitem__(self, item)
(Indexing operator)

source code 
Overrides: Input.__getitem__

slice(self, start=None, end=None)

source code 

Subclasses should provide a way of slicing (taking a subsequence of) the input that returns an input of the original type.

Overrides: Input.slice
(inherited documentation)

from_file(filename, options={})
Static Method

source code 
Overrides: InputReader.from_file

Class Variable Details [hide private]

FILE_INPUT_OPTIONS

Value:
[ModuleOption('index', filter= int, help_text= "read the sequence with\
 index (not id) X", usage= "index=X, where X is an int", required= Tru\
e),]