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

Allowed properties overloading for CoreNLPParser tag, Authors.md #2789

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

BatMrE
Copy link
Contributor

@BatMrE BatMrE commented Aug 29, 2021

This is a fix to #2112
Added the overloading properties in code as per the standards

before fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111\xa01111\xa01111', 'O')]
after fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111', 'DATE'), ('1111', 'DATE'), ('1111', 'DATE')]

@tomaarsen
Copy link
Member

For those interested in the reasoning behind the changes in this PR, feel free to have a look at #2112 itself, where all the changes are already described and laid out.

@@ -339,9 +339,11 @@ def tag_sents(self, sentences):
"""
# Converting list(list(str)) -> list(str)
sentences = (" ".join(words) for words in sentences)
return [sentences[0] for sentences in self.raw_tag_sents(sentences)]
if properties is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a description for the properties argument in the docstring, also mention that "tokenize.whitespace" is set to True by default (but it won't if properties are specified.

@dimazest
Copy link
Contributor

dimazest commented Aug 31, 2021

before fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111\xa01111\xa01111', 'O')]
after fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111', 'DATE'), ('1111', 'DATE'), ('1111', 'DATE')]

would it be possible to make a test out of this example?

@BatMrE
Copy link
Contributor Author

BatMrE commented Sep 2, 2021

before fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111\xa01111\xa01111', 'O')]
after fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111', 'DATE'), ('1111', 'DATE'), ('1111', 'DATE')]

would it be possible to make a test out of this example?

Sure , bit busy, will add over weekend

@BatMrE
Copy link
Contributor Author

BatMrE commented Sep 5, 2021

before fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111\xa01111\xa01111', 'O')]
after fix : [('my', 'O'), ('phone', 'O'), ('number', 'O'), ('is', 'O'), ('1111', 'DATE'), ('1111', 'DATE'), ('1111', 'DATE')]

would it be possible to make a test out of this example?

@tomaarsen @dimazest
any idea how to create 'api_return_value' dictionary for a sample?? like in:
https://github.com/nltk/nltk/blob/develop/nltk/test/unit/test_corenlp.py#L261

@dimazest
Copy link
Contributor

dimazest commented Sep 7, 2021

you should be able to manually use CoreNLP Rest API and intercept returned result

@tomaarsen
Copy link
Member

Keep in mind that the CoreNLP tests are being skipped, because our GitHub Actions CI doesn't currently support downloading third party tools such as the Stanford models. Preferably we would still have tests for this PR though, as we likely want to support third party tools eventually.

@dimazest
Copy link
Contributor

dimazest commented Sep 7, 2021

The actual call to corenlp should be mock, then tests won't need corenlp running.

@tomaarsen
Copy link
Member

tomaarsen commented Oct 12, 2021

Since #2820 there are automated tests for CoreNLP. We would like to see some tests to back up these changes, is possible.

@@ -339,9 +339,11 @@ def tag_sents(self, sentences):
"""
# Converting list(list(str)) -> list(str)
sentences = (" ".join(words) for words in sentences)
return [sentences[0] for sentences in self.raw_tag_sents(sentences)]
if properties is None:
properties = {"tokenize.whitespace": "true"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've merged develop into this PR. Because the CoreNLP tests now run on the CI, we can see that some tests fail due to this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomaarsen apart from automated tests for CoreNLP is there any other test that needs to be added

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR should have some tests that show that the new behaviour works like intended, so you would only need to add tests for the functionality that you added. So, just for these functions.

@stevenbird
Copy link
Member

@BatMrE: just wondering if there's interest in wrapping this up. I think it's just a question of adding a test or two.

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

Successfully merging this pull request may close these issues.

None yet

4 participants