# What does mrs-compare actually compare?

**URL:** <https://delphinqa.ling.washington.edu/t/what-does-mrs-compare-actually-compare/113>\
**Category:** Grammar Matrix\
**Created:** [February 2, 2018, 9:57pm UTC](https://delphinqa.ling.washington.edu/t/what-does-mrs-compare-actually-compare/113 "2018-02-02T21:57:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ekayen](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/838e76/32.png) [@ekayen](https://delphinqa.ling.washington.edu/u/ekayen)\
**Post date:** [February 2, 2018, 9:57pm UTC](https://delphinqa.ling.washington.edu/t/what-does-mrs-compare-actually-compare/113/1 "2018-02-02T21:57:34Z")

</div>

I’ve got some regression tests failing after my latest edits in my branch because of MRS differences. After staring at the gold and current MRSs for a while, the only differences I can see are the order of the things on the RELS list and the exact variable names (e.g. x2 vs x7). All the same things seems to be coindexed in both cases, and the same rels are present. It seems like ordering in the RELS list and variable names shouldn’t cause mrs-compare to declare these MRSs different, but I can’t see what it’s actually doing because it’s a binary file whose documentation I can’t locate. Anyone know if these differences would actually be considered diffs? Or is it more likely I missed spotting some other difference?

---

<div class="post-metadata">

**Author:** ![ekayen](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/838e76/32.png) [@ekayen](https://delphinqa.ling.washington.edu/u/ekayen)\
**Post date:** [February 2, 2018, 10:21pm UTC](https://delphinqa.ling.washington.edu/t/what-does-mrs-compare-actually-compare/113/2 "2018-02-02T22:21:25Z")

</div>

Also, if there’s a way to take the unadorned text MRSs and generate the pretty, interactive MRSs, I’d be very interested to know about it 🙂

---

<div class="post-metadata">

**Author:** ![goodmami](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/g/b5e925/32.png) [@goodmami](https://delphinqa.ling.washington.edu/u/goodmami)\
**Post date:** [February 2, 2018, 10:37pm UTC](https://delphinqa.ling.washington.edu/t/what-does-mrs-compare-actually-compare/113/3 "2018-02-02T22:37:24Z")

</div>

I haven’t checked the code, but I seem to recall Woodley (the author of `mrs-compare`) saying that he does a string comparison of the two MRSs after doing a deterministic relabeling of the variables. If he doesn’t reorder the MRSs, that could cause differences. I could be wrong about this, because this seems overly brittle.

**— edit:** I was misremembering a comment in the mrs-compare.c code. It’s actually compared by doing `mrs_subsumes(x, y) && mrs_subsumes(y, x)`, which I think is the same as calculating a variable bijection, but I’m not sure of the details. **:end edit—**

We’ve talked about replacing it with PyDelphin’s `delphin.mrs.compare.isomorphic()` function (see [https://github.com/delph-in/pydelphin/wiki/delphin.mrs.compare#isomorphic](https://github.com/delph-in/pydelphin/wiki/delphin.mrs.compare#isomorphic)), which calculates a bijection of variables (if one exists, they are isomorphic), but I don’t think such a change has been committed yet.

---

<div class="post-metadata">

**Author:** ![goodmami](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/g/b5e925/32.png) [@goodmami](https://delphinqa.ling.washington.edu/u/goodmami)\
**Post date:** [February 2, 2018, 10:44pm UTC](https://delphinqa.ling.washington.edu/t/what-does-mrs-compare-actually-compare/113/4 "2018-02-02T22:44:29Z")

</div>

As for browser-based MRS visualization, see here: [GitHub - delph-in/delphin-viz: JavaScript visualizations of various DELPH-IN structures.](https://github.com/delph-in/delphin-viz)

There may be ways to send a stored MRS to LUI, if you want the visualization like in the LKB or ACE.

And if you just want syntax highlighting at the commandline, try PyDelphin’s convert subcommand (of the `delphin` or `delphin.sh` command): [GitHub - delph-in/pydelphin: Python libraries for DELPH-IN](https://github.com/delph-in/pydelphin/wiki/Command-line-Tutorial)

For example:

```bash
$ ace -g grm.dat -Tq <<< "test sentence" | delphin convert --pretty-print

```

Note that it looks best if your terminal is in “dark” mode (otherwise the yellow is hard to read).

 ![pprint-mrs](https://delphinqa.ling.washington.edu/uploads/default/original/1X/9d13718a4844b1da43200f223464004eaeaddb9d.png)

---

<div class="post-metadata">

**Author:** ![ekayen](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/e/838e76/32.png) [@ekayen](https://delphinqa.ling.washington.edu/u/ekayen)\
**Post date:** [February 3, 2018, 12:49am UTC](https://delphinqa.ling.washington.edu/t/what-does-mrs-compare-actually-compare/113/5 "2018-02-03T00:49:16Z")

</div>

Thanks for the pointer to all these super useful tools! I’m going to make a lot of use of them. I ended up finding the difference via the time-tested “stare at it a very long time” method – some of the features on one of the arguments were different. So I’m guessing the order of things on the RELS list isn’t an issue, as you’d expect.
