delphin.mrs.simplemrs¶
Serialization functions for the SimpleMRS format.
-
delphin.mrs.simplemrs.
dump
(destination, ms, single=False, version=1.1, properties=True, pretty_print=False, color=False, **kwargs)[source]¶ Serialize Xmrs objects to SimpleMRS 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 - color – if
True
, colorize the output with ANSI color codes
-
delphin.mrs.simplemrs.
dumps
(ms, single=False, version=1.1, properties=True, pretty_print=False, color=False, **kwargs)[source]¶ Serialize an Xmrs object to a SimpleMRS 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 - color – if
True
, colorize the output with ANSI color codes
Returns: a SimpleMrs string representation of a corpus of Xmrs
- ms – an iterator of Xmrs objects to serialize (unless the
single option is
-
delphin.mrs.simplemrs.
load
(fh, single=False, version=1.1, strict=False, errors='warn')[source]¶ Deserialize SimpleMRSs 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 - strict – deprecated; a
True
value is the same aserrors=’strict’
, and aFalse
value is the same aserrors=’warn’
- errors – if
‘strict’
, ill-formed MRSs raise an error; if‘warn’
, raise a warning instead; if‘ignore’
, do not warn or raise errors for ill-formed MRSs
Returns: a generator of Xmrs objects (unless the single option is
True
)
-
delphin.mrs.simplemrs.
loads
(s, single=False, version=1.1, strict=False, errors='warn')[source]¶ Deserialize SimpleMRS string representations
Parameters: Returns: a generator of Xmrs objects (unless single is
True
)