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

Standardize and refactor doc extensions #352

Merged
merged 14 commits into from
Dec 4, 2021
Merged

Conversation

bdewilde
Copy link
Collaborator

@bdewilde bdewilde commented Dec 4, 2021

Description

  • consolidates all spaCy Doc extension-handling in spacier.extensions module, which includes functionality for "registering" functions that return sets of doc extensions using explosion's catalogue pkg
  • refactors doc extension handling in extract and text_stats subpkgs to leverage the new setup
    • a given set of extensions are now set (or removed) by importing the relevant subpkg then calling textacy.set_doc_extensions(NAME), where NAME is a string like "extract" or, optionally, a specific subset like "extract.basics" which registers the corresponding subset of extensions
  • refactors pkg-level extensions module
    • general functionality moved to spacier.extensions, core extensions (Doc._.preview and Doc._.meta) moved to spacier.core, and a couple of bag-oriented functions moved to extract.bags, with corresponding extensions settable via textacy.set_doc_extensions("extract") or textacy.set_doc_extensions("extract.bags")
    • removes to_tokenized_text() function + method extension, which was a bit of an odd-ball and was originally meant for interoperability w/ gensim

Motivation and Context

This aspect of textacy was inconsistent and awkward. It had been developed in pieces over multiple major versions of spacy, and never really reconsidered. The current setup is more explicit and configurable from a user's perspective, rather than implicit / one-size-fits-all.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation, and I have updated it accordingly.

@bdewilde bdewilde merged commit 16da0a0 into develop Dec 4, 2021
@bdewilde bdewilde deleted the refactor-doc-extensions branch December 4, 2021 20:09
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.

1 participant