Package nltk :: Package sem :: Module boxer :: Class Boxer
[hide private]
[frames] | no frames]

type Boxer

source code

object --+
         |
        Boxer

This class is an interface to Johan Bos's program Boxer, a wide-coverage semantic parser that produces Discourse Representation Structures (DRSs).

Instance Methods [hide private]
 
__init__(self, boxer_drs_interpreter=None, elimeq=False, bin_dir=None, verbose=False) source code
 
set_bin_dir(self, bin_dir, verbose=False) source code
 
interpret(self, input, discourse_id=None, question=False, verbose=False)
Use Boxer to give a first order representation.
source code
 
interpret_multisentence(self, input, discourse_id=None, question=False, verbose=False)
Use Boxer to give a first order representation.
source code
 
batch_interpret(self, inputs, discourse_ids=None, question=False, verbose=False)
Use Boxer to give a first order representation.
source code
 
batch_interpret_multisentence(self, inputs, discourse_ids=None, question=False, verbose=False)
Use Boxer to give a first order representation.
source code
 
_call_candc(self, inputs, discourse_ids, question, filename, verbose=False)
Call the candc binary with the given input.
source code
 
_call_boxer(self, filename, verbose=False)
Call the boxer binary with the given input.
source code
 
_find_binary(self, name, bin_dir, verbose=False) source code
 
_call(self, input_str, binary, args=[], verbose=False)
Call the binary with the given input.
source code
 
_parse_to_drs_dict(self, boxer_out, use_disc_id) source code
 
_parse_drs(self, drs_string, discourse_id, use_disc_id) source code
Method Details [hide private]

__init__(self, boxer_drs_interpreter=None, elimeq=False, bin_dir=None, verbose=False)
(Constructor)

source code 
Parameters:
  • boxer_drs_interpreter - A class that converts from the AbstractBoxerDrs object hierarchy to a different object. The default is NltkDrtBoxerDrsInterpreter, which converts to the NLTK DRT hierarchy.
  • elimeq - When set to true, Boxer removes all equalities from the DRSs and discourse referents standing in the equality relation are unified, but only if this can be done in a meaning-preserving manner.
Overrides: object.__init__

interpret(self, input, discourse_id=None, question=False, verbose=False)

source code 

Use Boxer to give a first order representation.

Parameters:
  • input - str Input sentence to parse
  • occur_index - boolean Should predicates be occurrence indexed?
  • discourse_id - str An identifier to be inserted to each occurrence-indexed predicate.
Returns:
drt.AbstractDrs

interpret_multisentence(self, input, discourse_id=None, question=False, verbose=False)

source code 

Use Boxer to give a first order representation.

Parameters:
  • input - list of str Input sentences to parse as a single discourse
  • occur_index - boolean Should predicates be occurrence indexed?
  • discourse_id - str An identifier to be inserted to each occurrence-indexed predicate.
Returns:
drt.AbstractDrs

batch_interpret(self, inputs, discourse_ids=None, question=False, verbose=False)

source code 

Use Boxer to give a first order representation.

Parameters:
  • inputs - list of str Input sentences to parse as individual discourses
  • occur_index - boolean Should predicates be occurrence indexed?
  • discourse_ids - list of str Identifiers to be inserted to each occurrence-indexed predicate.
Returns:
list of drt.AbstractDrs

batch_interpret_multisentence(self, inputs, discourse_ids=None, question=False, verbose=False)

source code 

Use Boxer to give a first order representation.

Parameters:
  • inputs - list of list of str Input discourses to parse
  • occur_index - boolean Should predicates be occurrence indexed?
  • discourse_ids - list of str Identifiers to be inserted to each occurrence-indexed predicate.
Returns:
drt.AbstractDrs

_call_candc(self, inputs, discourse_ids, question, filename, verbose=False)

source code 

Call the candc binary with the given input.

Parameters:
  • inputs - list of list of str Input discourses to parse
  • discourse_ids - list of str Identifiers to be inserted to each occurrence-indexed predicate.
  • filename - str A filename for the output file
Returns:
stdout

_call_boxer(self, filename, verbose=False)

source code 

Call the boxer binary with the given input.

Parameters:
  • filename - str A filename for the input file
Returns:
stdout

_call(self, input_str, binary, args=[], verbose=False)

source code 

Call the binary with the given input.

Parameters:
  • input_str - A string whose contents are used as stdin.
  • binary - The location of the binary to call
  • args - A list of command-line arguments.
Returns:
stdout