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

Create demo notebook for Conllu files #198

Merged
merged 7 commits into from
Jun 10, 2021
Merged

Conversation

ZachEichen
Copy link
Collaborator

Created a demo notebook that shows how the new conllu logic can be used to open and process diverse .conllu files; addresses issue #195

Shows how these can be powerfully used with pandas dataframes, and other text-extensions integrations to quickly manipulate the data and do things like displaying parse trees, and retokenizing with spaCy.

…p the demo notebook to use it to hopefully avoid sticky coyright situations
@ZachEichen ZachEichen requested a review from frreiss June 3, 2021 21:36
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ZachEichen ZachEichen marked this pull request as draft June 4, 2021 20:28
notebooks/Read_CoNLL-U_files.ipynb Outdated Show resolved Hide resolved
@@ -0,0 +1,1116 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the "head" columns ended up as floating point values somehow. They should be ints. Did some nulls sneak into the head pointers?


Reply via ReviewNB

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this actually has to do with 'virtual' tokens where words were omitted from the surface representation and had to be added by the labeller, which have numbers of the form 10.1 or similar

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you have a suggestion of how I should handle this?

Copy link
Member

Choose a reason for hiding this comment

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

The real root cause is upstream in Pandas. There is old code in various parts of Pandas that casts ints to floats for operations that might produce NA values. Pandas should be converting to nullable int types (see https://pandas.pydata.org/pandas-docs/stable/user_guide/integer_na.html) instead. I've been meaning to submit PRs to fix those problems but haven't had time.

For now, the best fix at the application level is to convert the series that Pandas has "floatified" back to an integer dtype. Use int if there aren't supposed to be NAs. Use Int64 (with a capital "I") if there might be NAs.

Copy link
Member

Choose a reason for hiding this comment

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

Follow-up: Looking some more at the code, I think the conversion to a nullable integer dtype should happen inside conll_u_to_dataframes.

notebooks/Read_CoNLL-U_files.ipynb Outdated Show resolved Hide resolved
notebooks/Read_CoNLL-U_files.ipynb Outdated Show resolved Hide resolved
@ZachEichen ZachEichen requested a review from frreiss June 7, 2021 20:16
@ZachEichen ZachEichen marked this pull request as ready for review June 7, 2021 20:16
@frreiss
Copy link
Member

frreiss commented Jun 8, 2021

This is very close to ready to merge. Some minor requests:

  • I see some formatting issues in conll.py. Can you run that file through black?
  • Need an explicit conversion back to an int dtype to get rid of the unintentional float outputs to conll_u_to_dataframes -- see Create demo notebook for Conllu files #198 (comment).
  • Can you please add a precision/recall/F1 score computation after the last cell? Collection-level F1 is fine.

Copy link
Member

@frreiss frreiss left a comment

Choose a reason for hiding this comment

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

LGTM.

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

Successfully merging this pull request may close these issues.

None yet

2 participants