delphin.mrs.mrx¶
MRX (XML for MRS) serialization and deserialization.
-
delphin.mrs.mrx.
dump
(destination, ms, single=False, properties=True, encoding='unicode', pretty_print=False, **kwargs)[source]¶ Serialize Xmrs objects to MRX 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 - encoding – the character encoding of the string prior
writing to a file (generally
“unicode”
is desired) - pretty_print – if
True
, add newlines and indentation
-
delphin.mrs.mrx.
dumps
(ms, single=False, properties=True, encoding='unicode', pretty_print=False, **kwargs)[source]¶ Serialize an Xmrs object to a MRX 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 - encoding – the character encoding of the string (
“unicode”
returns a regular (unicode) string in Python 3 and a unicode string in Python 2) - pretty_print – if
True
, add newlines and indentation
Returns: a MRX string representation of a corpus of Xmrs
- ms – an iterator of Xmrs objects to serialize (unless the
single option is