Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compute smatch directly from triplets #38

Open
Wangpeiyi9979 opened this issue Jun 12, 2021 · 9 comments
Open

How to compute smatch directly from triplets #38

Wangpeiyi9979 opened this issue Jun 12, 2021 · 9 comments

Comments

@Wangpeiyi9979
Copy link

Hi, thanks for your nice work.
For some reason, I need to compute the smatch directly from the triples such as

[('b', ':instance', 'believe-01'),
 ('b', ':ARG1', 'c8'),
 ('c8', ':instance', 'capable-01'),
 ('c8', ':ARG2', 'i'),
 ('i', ':instance', 'innovate-01'),
 ('i', ':ARG0', 'p'),
 ('p', ':instance', 'person'),
 ('p', ':mod', 'e2'),
 ('e2', ':instance', 'each'),
 ('c8', ':ARG1', 'p'),
 ('b', ':ARG0', 'p2'),
 ('p2', ':instance', 'person')]

Could you tell me how to do this using smatch.
Thanks a lot!

@snowblink14
Copy link
Owner

You might need some customization. Depending on your input format, you may want to add some wrappers around get_best_match() function (which get the highest triple match number between two sets of triples), then compute the metrics similar to the score_amr_pairs() function in smatch.py.

@Wangpeiyi9979
Copy link
Author

Hi, when I use the function get_best_match(), I meet a strange problem as follows:
image
As we can see, the best_match_num(21) > the pred_triplet_num(16).

@Wangpeiyi9979
Copy link
Author

Also, I find that even though I fix the random seed in smatch.py, I also get different smatch scores when different runs.

@snowblink14
Copy link
Owner

Can you post the code you use to call the function? I cannot reproduce your results.
See below:

Screen Shot 2021-06-22 at 9 59 26 PM

@Wangpeiyi9979
Copy link
Author

image

@Wangpeiyi9979
Copy link
Author

When I run smatch.get_best_match for the single case, it's OK
image

@Wangpeiyi9979
Copy link
Author

Wangpeiyi9979 commented Jun 23, 2021

So strange, the same case output different results

@snowblink14
Copy link
Owner

match_triple_dict is a global variable. It is cleared in score_amr_pairs() function. Since you are calling get_best_match() directly without using score_amr_pairs() as the wrapper, you need to clear this variable before computing every pair of triples.

@Wangpeiyi9979
Copy link
Author

Thanks for your help!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants