-
Notifications
You must be signed in to change notification settings - Fork 164
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
Refactoring ideas #125
Comments
Hi Ozan, I agree with the function signature part (as you might have guessed :-). Lists as arguments instead of Iterables: I am not sure why you would like to require lists explicitly. Separating out tokenization for significance testing: in my opinion, that is a good idea as well, but what would need to be separated out / cached is not only tokenization, but everything that can be reused, such as ngram statistics. |
Sorry, when I say lists, I meant Iterables :) |
Hi, I agree there was/is a mess with the various accepted inputs and
C is the number of references and N is the number of sentences, am I right?.
but with the suggested API, we would need to run
(or use the legacy API, which would do this conversion automatically). As for reusing the tokenization and |
Hi, Sorry, I made a mistake and assumed that the current API was like that for reference stream organization. So you can ignore that part i.e. I don't propose changing it, we can keep it as it is. |
Hi all,
I would like to do another round of refactoring that would basically target the way hypotheses and references are read. Right now, corpus and sentence-level methods of each metric make some assumptions, fixes wrong inputs using
isinstance()
checks, and bail out if nothing can be done. IMHO, this creates a lot of confusion especially with the introduction of standalone metric classes vs. the compatibility API. I remember that we encountered a few issues regarding these and those were fixed here and there.I think the metrics should just stick to one signature (i.e. no
Union
type annotation for sys and ref streams) and the isinstance checks should be moved to the compatibility layer if required.I would suggest the following and throw an exception if this is not the case:
hyp: str, refs: [str, str2, ..., strC]
for sentence-level scorershyps: [str1, str2, ..., strN] refs: [[str1, str2, ..., strC]_1, ..., [str1, str2, ..., strC]_N]
(EDIT: This is wrong, see below)Another option is to explicitly implement classes:
Hypothesis, HypothesisList, Reference
What do you think?
The text was updated successfully, but these errors were encountered: