delphin.mrs.dmrx

DMRX (XML for DMRS) serialization and deserialization.

delphin.mrs.dmrx.dump(destination, ms, single=False, properties=True, pretty_print=False, **kwargs)[source]

Serialize Xmrs objects to DMRX and write to a file

Parameters:
  • destination – filename or file object where data will be written
  • ms – an iterator of Xmrs objects to serialize (unless the single option is True)
  • single – if True, treat ms as a single Xmrs object instead of as an iterator
  • properties – if False, suppress variable properties
  • pretty_print – if True, add newlines and indentation
delphin.mrs.dmrx.dumps(ms, single=False, properties=True, pretty_print=False, **kwargs)[source]

Serialize an Xmrs object to a DMRX representation

Parameters:
  • ms – an iterator of Xmrs objects to serialize (unless the single option is True)
  • single – if True, treat ms as a single Xmrs object instead of as an iterator
  • properties – if False, suppress variable properties
  • pretty_print – if True, add newlines and indentation
Returns:

a DMRX string representation of a corpus of Xmrs

delphin.mrs.dmrx.load(fh, single=False)[source]

Deserialize DMRX from a file (handle or filename)

Parameters:
  • fh (str, file) – input filename or file object
  • single – if True, only return the first read Xmrs object
Returns:

a generator of Xmrs objects (unless the single option is True)

delphin.mrs.dmrx.loads(s, single=False)[source]

Deserialize DMRX string representations

Parameters:
  • s (str) – a DMRX string
  • single (bool) – if True, only return the first Xmrs object
Returns:

a generator of Xmrs objects (unless single is True)