mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-14 13:47:13 +03:00
faaa832518
* Generalize handling of tokenizer special cases Handle tokenizer special cases more generally by using the Matcher internally to match special cases after the affix/token_match tokenization is complete. Instead of only matching special cases while processing balanced or nearly balanced prefixes and suffixes, this recognizes special cases in a wider range of contexts: * Allows arbitrary numbers of prefixes/affixes around special cases * Allows special cases separated by infixes Existing tests/settings that couldn't be preserved as before: * The emoticon '")' is no longer a supported special case * The emoticon ':)' in "example:)" is a false positive again When merged with #4258 (or the relevant cache bugfix), the affix and token_match properties should be modified to flush and reload all special cases to use the updated internal tokenization with the Matcher. * Remove accidentally added test case * Really remove accidentally added test * Reload special cases when necessary Reload special cases when affixes or token_match are modified. Skip reloading during initialization. * Update error code number * Fix offset and whitespace in Matcher special cases * Fix offset bugs when merging and splitting tokens * Set final whitespace on final token in inserted special case * Improve cache flushing in tokenizer * Separate cache and specials memory (temporarily) * Flush cache when adding special cases * Repeated `self._cache = PreshMap()` and `self._specials = PreshMap()` are necessary due to this bug: https://github.com/explosion/preshed/issues/21 * Remove reinitialized PreshMaps on cache flush * Update UD bin scripts * Update imports for `bin/` * Add all currently supported languages * Update subtok merger for new Matcher validation * Modify blinded check to look at tokens instead of lemmas (for corpora with tokens but not lemmas like Telugu) * Use special Matcher only for cases with affixes * Reinsert specials cache checks during normal tokenization for special cases as much as possible * Additionally include specials cache checks while splitting on infixes * Since the special Matcher needs consistent affix-only tokenization for the special cases themselves, introduce the argument `with_special_cases` in order to do tokenization with or without specials cache checks * After normal tokenization, postprocess with special cases Matcher for special cases containing affixes * Replace PhraseMatcher with Aho-Corasick Replace PhraseMatcher with the Aho-Corasick algorithm over numpy arrays of the hash values for the relevant attribute. The implementation is based on FlashText. The speed should be similar to the previous PhraseMatcher. It is now possible to easily remove match IDs and matches don't go missing with large keyword lists / vocabularies. Fixes #4308. * Restore support for pickling * Fix internal keyword add/remove for numpy arrays * Add test for #4248, clean up test * Improve efficiency of special cases handling * Use PhraseMatcher instead of Matcher * Improve efficiency of merging/splitting special cases in document * Process merge/splits in one pass without repeated token shifting * Merge in place if no splits * Update error message number * Remove UD script modifications Only used for timing/testing, should be a separate PR * Remove final traces of UD script modifications * Update UD bin scripts * Update imports for `bin/` * Add all currently supported languages * Update subtok merger for new Matcher validation * Modify blinded check to look at tokens instead of lemmas (for corpora with tokens but not lemmas like Telugu) * Add missing loop for match ID set in search loop * Remove cruft in matching loop for partial matches There was a bit of unnecessary code left over from FlashText in the matching loop to handle partial token matches, which we don't have with PhraseMatcher. * Replace dict trie with MapStruct trie * Fix how match ID hash is stored/added * Update fix for match ID vocab * Switch from map_get_unless_missing to map_get * Switch from numpy array to Token.get_struct_attr Access token attributes directly in Doc instead of making a copy of the relevant values in a numpy array. Add unsatisfactory warning for hash collision with reserved terminal hash key. (Ideally it would change the reserved terminal hash and redo the whole trie, but for now, I'm hoping there won't be collisions.) * Restructure imports to export find_matches * Implement full remove() Remove unnecessary trie paths and free unused maps. Parallel to Matcher, raise KeyError when attempting to remove a match ID that has not been added. * Switch to PhraseMatcher.find_matches * Switch to local cdef functions for span filtering * Switch special case reload threshold to variable Refer to variable instead of hard-coded threshold * Move more of special case retokenize to cdef nogil Move as much of the special case retokenization to nogil as possible. * Rewrap sort as stdsort for OS X * Rewrap stdsort with specific types * Switch to qsort * Fix merge * Improve cmp functions * Fix realloc * Fix realloc again * Initialize span struct while retokenizing * Temporarily skip retokenizing * Revert "Move more of special case retokenize to cdef nogil" This reverts commit0b7e52c797
. * Revert "Switch to qsort" This reverts commita98d71a942
. * Fix specials check while caching * Modify URL test with emoticons The multiple suffix tests result in the emoticon `:>`, which is now retokenized into one token as a special case after the suffixes are split off. * Refactor _apply_special_cases() * Use cdef ints for span info used in multiple spots * Modify _filter_special_spans() to prefer earlier Parallel to #4414, modify _filter_special_spans() so that the earlier span is preferred for overlapping spans of the same length. * Replace MatchStruct with Entity Replace MatchStruct with Entity since the existing Entity struct is nearly identical. * Replace Entity with more general SpanC * Replace MatchStruct with SpanC * Add error in debug-data if no dev docs are available (see #4575) * Update azure-pipelines.yml * Revert "Update azure-pipelines.yml" This reverts commited1060cf59
. * Use latest wasabi * Reorganise install_requires * add dframcy to universe.json (#4580) * Update universe.json [ci skip] * Fix multiprocessing for as_tuples=True (#4582) * Fix conllu script (#4579) * force extensions to avoid clash between example scripts * fix arg order and default file encoding * add example config for conllu script * newline * move extension definitions to main function * few more encodings fixes * Add load_from_docbin example [ci skip] TODO: upload the file somewhere * Update README.md * Add warnings about 3.8 (resolves #4593) [ci skip] * Fixed typo: Added space between "recognize" and "various" (#4600) * Fix DocBin.merge() example (#4599) * Replace function registries with catalogue (#4584) * Replace functions registries with catalogue * Update __init__.py * Fix test * Revert unrelated flag [ci skip] * Bugfix/dep matcher issue 4590 (#4601) * add contributor agreement for prilopes * add test for issue #4590 * fix on_match params for DependencyMacther (#4590) * Minor updates to language example sentences (#4608) * Add punctuation to Spanish example sentences * Combine multilanguage examples for lang xx * Add punctuation to nb examples * Always realloc to a larger size Avoid potential (unlikely) edge case and cymem error seen in #4604. * Add error in debug-data if no dev docs are available (see #4575) * Update debug-data for GoldCorpus / Example * Ignore None label in misaligned NER data
107 lines
5.2 KiB
Markdown
107 lines
5.2 KiB
Markdown
# spaCy contributor agreement
|
|
|
|
This spaCy Contributor Agreement (**"SCA"**) is based on the
|
|
[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf).
|
|
The SCA applies to any contribution that you make to any product or project
|
|
managed by us (the **"project"**), and sets out the intellectual property rights
|
|
you grant to us in the contributed materials. The term **"us"** shall mean
|
|
[ExplosionAI GmbH](https://explosion.ai/legal). The term
|
|
**"you"** shall mean the person or entity identified below.
|
|
|
|
If you agree to be bound by these terms, fill in the information requested
|
|
below and include the filled-in version with your first pull request, under the
|
|
folder [`.github/contributors/`](/.github/contributors/). The name of the file
|
|
should be your GitHub username, with the extension `.md`. For example, the user
|
|
example_user would create the file `.github/contributors/example_user.md`.
|
|
|
|
Read this agreement carefully before signing. These terms and conditions
|
|
constitute a binding legal agreement.
|
|
|
|
## Contributor Agreement
|
|
|
|
1. The term "contribution" or "contributed materials" means any source code,
|
|
object code, patch, tool, sample, graphic, specification, manual,
|
|
documentation, or any other material posted or submitted by you to the project.
|
|
|
|
2. With respect to any worldwide copyrights, or copyright applications and
|
|
registrations, in your contribution:
|
|
|
|
* you hereby assign to us joint ownership, and to the extent that such
|
|
assignment is or becomes invalid, ineffective or unenforceable, you hereby
|
|
grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
|
|
royalty-free, unrestricted license to exercise all rights under those
|
|
copyrights. This includes, at our option, the right to sublicense these same
|
|
rights to third parties through multiple levels of sublicensees or other
|
|
licensing arrangements;
|
|
|
|
* you agree that each of us can do all things in relation to your
|
|
contribution as if each of us were the sole owners, and if one of us makes
|
|
a derivative work of your contribution, the one who makes the derivative
|
|
work (or has it made will be the sole owner of that derivative work;
|
|
|
|
* you agree that you will not assert any moral rights in your contribution
|
|
against us, our licensees or transferees;
|
|
|
|
* you agree that we may register a copyright in your contribution and
|
|
exercise all ownership rights associated with it; and
|
|
|
|
* you agree that neither of us has any duty to consult with, obtain the
|
|
consent of, pay or render an accounting to the other for any use or
|
|
distribution of your contribution.
|
|
|
|
3. With respect to any patents you own, or that you can license without payment
|
|
to any third party, you hereby grant to us a perpetual, irrevocable,
|
|
non-exclusive, worldwide, no-charge, royalty-free license to:
|
|
|
|
* make, have made, use, sell, offer to sell, import, and otherwise transfer
|
|
your contribution in whole or in part, alone or in combination with or
|
|
included in any product, work or materials arising out of the project to
|
|
which your contribution was submitted, and
|
|
|
|
* at our option, to sublicense these same rights to third parties through
|
|
multiple levels of sublicensees or other licensing arrangements.
|
|
|
|
4. Except as set out above, you keep all right, title, and interest in your
|
|
contribution. The rights that you grant to us under these terms are effective
|
|
on the date you first submitted a contribution to us, even if your submission
|
|
took place before the date you sign these terms.
|
|
|
|
5. You covenant, represent, warrant and agree that:
|
|
|
|
* Each contribution that you submit is and shall be an original work of
|
|
authorship and you can legally grant the rights set out in this SCA;
|
|
|
|
* to the best of your knowledge, each contribution will not violate any
|
|
third party's copyrights, trademarks, patents, or other intellectual
|
|
property rights; and
|
|
|
|
* each contribution shall be in compliance with U.S. export control laws and
|
|
other applicable export and import laws. You agree to notify us if you
|
|
become aware of any circumstance which would make any of the foregoing
|
|
representations inaccurate in any respect. We may publicly disclose your
|
|
participation in the project, including the fact that you have signed the SCA.
|
|
|
|
6. This SCA is governed by the laws of the State of California and applicable
|
|
U.S. Federal law. Any choice of law rules will not apply.
|
|
|
|
7. Please place an “x” on one of the applicable statement below. Please do NOT
|
|
mark both statements:
|
|
|
|
* [x] I am signing on behalf of myself as an individual and no other person
|
|
or entity, including my employer, has or will have rights with respect to my
|
|
contributions.
|
|
|
|
* [ ] I am signing on behalf of my employer or a legal entity and I have the
|
|
actual authority to contractually bind that entity.
|
|
|
|
## Contributor Details
|
|
|
|
| Field | Entry |
|
|
|------------------------------- | -------------------- |
|
|
| Name | Priscilla Lopes |
|
|
| Company name (if applicable) | |
|
|
| Title or role (if applicable) | |
|
|
| Date | 2019-11-06 |
|
|
| GitHub username | prilopes |
|
|
| Website (optional) | |
|