delphin.mrs.compare

delphin.mrs.compare.compare_bags(testbag, goldbag, count_only=True)[source]

Compare two bags of Xmrs objects, returning a triple of (unique in test, shared, unique in gold).

Parameters:
  • testbag – An iterable of Xmrs objects to test.
  • goldbag – An iterable of Xmrs objects to compare against.
  • count_only – If True, the returned triple will only have the counts of each; if False, a list of Xmrs objects will be returned for each (using the ones from testbag for the shared set)
Returns:

A triple of (unique in test, shared, unique in gold), where each of the three items is an integer count if the count_only parameter is True, or a list of Xmrs objects otherwise.

delphin.mrs.compare.isomorphic(q, g, check_varprops=True)[source]

Return True if Xmrs objects q and g are isomorphic.

Isomorphicity compares the predicates of an Xmrs, the variable properties of their predications (if check_varprops=True), constant arguments, and the argument structure between predications. Node IDs and Lnk values are ignored.

Parameters:
  • q – the left Xmrs to compare
  • g – the right Xmrs to compare
  • check_varprops – if True, make sure variable properties are equal for mapped predications