Package jazzparser :: Package data :: Module parsing :: Class ParseResults
[hide private]
[frames] | no frames]

Class ParseResults

source code

object --+
         |
        ParseResults

A simple wrapper object to store the results of a parse, plus the gold standard result, so that they can easily be dumped out to a file using pickle.

The gold parse may be omitted if it's not available. Alternatively, you may store an annotated sequence as your gold standard: this should go in gold_sequence. You may, of course, store both.


Note: this used to store a list of logical forms. Now it can store signs as well: in this case, the logical form can be found in sign.semantics for any sign and signs should be True.

Nested Classes [hide private]
  LoadError
Instance Methods [hide private]
 
__init__(self, parses, gold_parse=None, signs=False, gold_sequence=None, timed_out=None, cpu_time=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__get_sorted_results(self)
The list of results (TS interpretations or signs) ordered by descending probability.
source code
 
__get_semantics(self)
Always returns a list of (probability,semantics) pairs, whether or not the results were stored as signs.
source code
 
get_gold_semantics(self)
Tries to return a gold standard semantics.
source code
pair
get_top_result(self)
Loads the top parse result and the gold standard result.
source code
 
get_name(self)
Returns a name for the input if one is available, otherwise None.
source code
 
save(self, filename) source code

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

Static Methods [hide private]
 
from_file(filename) source code
Instance Variables [hide private]
  parses
List of (probability,interpretation) tuples, where the interpretation is a sign parse result, or a logical form.
  gold_parse
The interpretation (tonal space semantics) given by the gold standard.
  signs
True is the stored parses are signs and not logical forms.
  gold_sequence
Gold standard interpretation in the form of an annotated chord sequence.
  timed_out
True if the parse timed out (might still have results from a backoff model).
  cpu_time
Time taken for the parse, measured in CPU time (not wall clock).
Properties [hide private]
  sorted_results
The list of results (TS interpretations or signs) ordered by descending probability.
  semantics
Always returns a list of (probability,semantics) pairs, whether or not the results were stored as signs.

Inherited from object: __class__

Method Details [hide private]

__init__(self, parses, gold_parse=None, signs=False, gold_sequence=None, timed_out=None, cpu_time=None)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

__get_semantics(self)

source code 

Always returns a list of (probability,semantics) pairs, whether or not the results were stored as signs. The results are sorted by descending probability.

get_gold_semantics(self)

source code 

Tries to return a gold standard semantics. In some cases this is stored along with the results in gold_parse. In others this is not available, but a gold annotated chord sequence is: then we can get the gold semantics by parsing the annotations. Note that this might take a little bit of time.

In other cases neither is available. Then None will be returned.

get_top_result(self)

source code 

Loads the top parse result and the gold standard result. Both a None if there are no results.

Returns: pair
top parser semantics and gold standard semantics

Instance Variable Details [hide private]

parses

List of (probability,interpretation) tuples, where the interpretation is a sign parse result, or a logical form. Which is used should be reflected in signs.


Property Details [hide private]

sorted_results

The list of results (TS interpretations or signs) ordered by descending probability.

Get Method:
__get_sorted_results(self) - The list of results (TS interpretations or signs) ordered by descending probability.

semantics

Always returns a list of (probability,semantics) pairs, whether or not the results were stored as signs. The results are sorted by descending probability.

Get Method:
__get_semantics(self) - Always returns a list of (probability,semantics) pairs, whether or not the results were stored as signs.