Commit Graph

75 Commits

Author SHA1 Message Date
Raphael Mitsch
d6c7636069 Update docstring and type usage. 2024-02-07 10:01:21 +01:00
Raphael Mitsch
6401856594 Format. 2024-02-01 14:53:46 +01:00
Raphael Mitsch
7d6ae1b960 Fix type aliases. 2024-02-01 14:51:49 +01:00
Raphael Mitsch
4c7bd3026d Fix typedef import. 2024-02-01 13:02:33 +01:00
Raphael Mitsch
1d2994affe Add typedefs.pyx. 2024-02-01 12:52:11 +01:00
Raphael Mitsch
aa87845be0 Lint. 2024-02-01 12:42:18 +01:00
Raphael Mitsch
d778da3c04 isort. 2024-02-01 12:40:41 +01:00
Raphael Mitsch
c174ebf880 isort. 2024-02-01 12:38:37 +01:00
Raphael Mitsch
f169614c53 Use type alias. 2024-02-01 12:36:41 +01:00
Raphael Mitsch
78c72d3ab7
Merge branch 'main' into feature/docwise-generator-batching 2024-01-30 21:00:22 +01:00
Daniël de Kok
81beaea70e Merge remote-tracking branch 'upstream/master' into maintenance/v4-merge-master-20240119 2024-01-19 12:34:29 +01:00
Sofie Van Landeghem
699dd8b3b7
Update __all__ fields (#13063)
* update all for pipeline.init

* add all in training.init

* add all in kb.init

* alphabetically
2023-10-16 10:17:47 +02:00
Adriane Boyd
538304948e Remove profile=True from currently profiled cython 2023-09-28 17:09:41 +02:00
Raphael Mitsch
5bad3d2118 Format. 2023-07-27 16:36:15 +02:00
Raphael Mitsch
a2585333a9 Fix merge errors. 2023-07-27 16:27:59 +02:00
Raphael Mitsch
8aa59c4f65 Merge branch 'v4' into feature/docwise-generator-batching
# Conflicts:
#	spacy/kb/kb.pyx
#	spacy/kb/kb_in_memory.pyx
#	spacy/ml/models/entity_linker.py
#	spacy/pipeline/entity_linker.py
#	spacy/tests/pipeline/test_entity_linker.py
#	website/docs/api/entitylinker.mdx
2023-07-27 14:28:06 +02:00
svlandeg
0e3b6a87d6 Merge branch 'upstream_master' into sync_v4 2023-07-19 16:37:31 +02:00
Basile Dura
b0228d8ea6
ci: add cython linter (#12694)
* chore: add cython-linter dev dependency

* fix: lexeme.pyx

* fix: morphology.pxd

* fix: tokenizer.pxd

* fix: vocab.pxd

* fix: morphology.pxd (line length)

* ci: add cython-lint

* ci: fix cython-lint call

* Fix kb/candidate.pyx.

* Fix kb/kb.pyx.

* Fix kb/kb_in_memory.pyx.

* Fix kb.

* Fix training/ partially.

* Fix training/. Ignore trailing whitespaces and too long lines.

* Fix ml/.

* Fix matcher/.

* Fix pipeline/.

* Fix tokens/.

* Fix build errors. Fix vocab.pyx.

* Fix cython-lint install and run.

* Fix lexeme.pyx, parts_of_speech.pxd, vectors.pyx. Temporarily disable cython-lint execution.

* Fix attrs.pyx, lexeme.pyx, symbols.pxd, isort issues.

* Make cython-lint install conditional. Fix tokenizer.pyx.

* Fix remaining files. Reenable cython-lint check.

* Readded parentheses.

* Fix test_build_dependencies().

* Add explanatory comment to cython-lint execution.

---------

Co-authored-by: Raphael Mitsch <r.mitsch@outlook.com>
2023-07-19 12:03:31 +02:00
Daniël de Kok
bf92ca4f10 Merge remote-tracking branch 'upstream/master' into v4-isort 2023-06-26 12:43:00 +02:00
Daniël de Kok
2468742cb8 isort all the things 2023-06-26 11:41:03 +02:00
Daniël de Kok
e2b70df012
Configure isort to use the Black profile, recursively isort the spacy module (#12721)
* Use isort with Black profile

* isort all the things

* Fix import cycles as a result of import sorting

* Add DOCBIN_ALL_ATTRS type definition

* Add isort to requirements

* Remove isort from build dependencies check

* Typo
2023-06-14 17:48:41 +02:00
Raphael Mitsch
10ddefa686
Update spacy/kb/kb_in_memory.pyx
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-04-24 20:44:37 +02:00
Raphael Mitsch
9b677adb7a
Update spacy/kb/kb.pyx
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-04-24 20:43:56 +02:00
Raphael Mitsch
571eaf6238
Update spacy/kb/kb.pyx
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-04-24 20:42:59 +02:00
Raphael Mitsch
49747697a2 Merge branch 'v4' into feature/docwise-generator-batching
# Conflicts:
#	spacy/kb/kb.pyx
#	spacy/ml/models/entity_linker.py
#	spacy/pipeline/entity_linker.py
#	website/docs/api/inmemorylookupkb.mdx
#	website/docs/api/kb.mdx
2023-04-17 16:28:09 +02:00
Raphael Mitsch
3102e2e27a
Entity linking: use SpanGroup instead of Iterable[Span] for mentions (#12344)
* Convert Candidate from Cython to Python class.

* Format.

* Fix .entity_ typo in _add_activations() usage.

* Change type for mentions to look up entity candidates for to SpanGroup from Iterable[Span].

* Update docs.

* Update spacy/kb/candidate.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Update doc string of BaseCandidate.__init__().

* Update spacy/kb/candidate.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Rename Candidate to InMemoryCandidate, BaseCandidate to Candidate.

* Adjust Candidate to support and mandate numerical entity IDs.

* Format.

* Fix docstring and docs.

* Update website/docs/api/kb.mdx

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Rename alias -> mention.

* Refactor Candidate attribute names. Update docs and tests accordingly.

* Refacor Candidate attributes and their usage.

* Format.

* Fix mypy error.

* Update error code in line with v4 convention.

* Reverse erroneous changes during merge.

* Update return type in EL tests.

* Re-add Candidate to setup.py.

* Format updated docs.

---------

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-03-20 12:25:18 +01:00
Raphael Mitsch
e5be5d6092 Merge branch 'v4' into feature/docwise-generator-batching
# Conflicts:
#	spacy/kb/kb.pyx
#	spacy/kb/kb_in_memory.pyx
#	spacy/ml/models/entity_linker.py
#	spacy/pipeline/entity_linker.py
#	spacy/tests/pipeline/test_entity_linker.py
#	website/docs/api/inmemorylookupkb.mdx
#	website/docs/api/kb.mdx
2023-03-20 10:50:54 +01:00
Raphael Mitsch
cb79af3a10 Fix merge leftovers. 2023-03-20 10:31:11 +01:00
Raphael Mitsch
73bdeb01e4 Merge branch 'refactor/el-candidates' into feature/docwise-generator-batching
# Conflicts:
#	spacy/kb/candidate.py
#	spacy/kb/kb.pyx
#	spacy/kb/kb_in_memory.pyx
#	spacy/ml/models/entity_linker.py
#	spacy/pipeline/entity_linker.py
#	spacy/tests/pipeline/test_entity_linker.py
#	website/docs/api/inmemorylookupkb.mdx
#	website/docs/api/kb.mdx
2023-03-20 10:24:17 +01:00
Raphael Mitsch
9340eb8ad2
Introduce hierarchy for EL Candidate objects (#12341)
* Convert Candidate from Cython to Python class.

* Format.

* Fix .entity_ typo in _add_activations() usage.

* Update spacy/kb/candidate.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Update doc string of BaseCandidate.__init__().

* Update spacy/kb/candidate.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Rename Candidate to InMemoryCandidate, BaseCandidate to Candidate.

* Adjust Candidate to support and mandate numerical entity IDs.

* Format.

* Fix docstring and docs.

* Update website/docs/api/kb.mdx

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Rename alias -> mention.

* Refactor Candidate attribute names. Update docs and tests accordingly.

* Refacor Candidate attributes and their usage.

* Format.

* Fix mypy error.

* Update error code in line with v4 convention.

* Update spacy/kb/candidate.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Updated error code.

* Simplify interface for int/str representations.

* Update website/docs/api/kb.mdx

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Rename 'alias' to 'mention'.

* Port Candidate and InMemoryCandidate to Cython.

* Remove redundant entry in setup.py.

* Add abstract class check.

* Drop storing mention.

* Update spacy/kb/candidate.pxd

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Fix entity_id refactoring problems in docstrings.

* Drop unused InMemoryCandidate._entity_hash.

* Update docstrings.

* Move attributes out of Candidate.

* Partially fix alias/mention terminology usage. Convert Candidate to interface.

* Remove prior_prob from supported properties in Candidate. Introduce KnowledgeBase.supports_prior_probs().

* Update docstrings related to prior_prob.

* Update alias/mention usage in doc(strings).

* Update spacy/ml/models/entity_linker.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Update spacy/ml/models/entity_linker.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Mention -> alias renaming. Drop Candidate.mentions(). Drop InMemoryLookupKB.get_alias_candidates() from docs.

* Update docstrings.

* Fix InMemoryCandidate attribute names.

* Update spacy/kb/kb.pyx

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Update spacy/ml/models/entity_linker.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Update W401 test.

* Update spacy/errors.py

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Update spacy/kb/kb.pyx

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Use Candidate output type for toy generators in the test suite to mimick best practices

* fix docs

* fix import

---------

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-03-20 00:34:35 +01:00
Raphael Mitsch
faede7155c
Update spacy/kb/kb.pyx
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-03-17 11:32:41 +01:00
Raphael Mitsch
978fbdcee1
Update spacy/kb/kb.pyx
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-03-17 08:58:17 +01:00
Raphael Mitsch
830939ee64 Fix InMemoryCandidate attribute names. 2023-03-15 10:51:34 +01:00
Raphael Mitsch
80fb0666b9 Update docstrings. 2023-03-15 09:25:41 +01:00
Raphael Mitsch
3cfc1c6acc Mention -> alias renaming. Drop Candidate.mentions(). Drop InMemoryLookupKB.get_alias_candidates() from docs. 2023-03-15 09:23:31 +01:00
Raphael Mitsch
28dbed64cb Update alias/mention usage in doc(strings). 2023-03-14 13:33:05 +01:00
Raphael Mitsch
be858981e6 Update docstrings related to prior_prob. 2023-03-13 17:01:20 +01:00
Raphael Mitsch
4a921766f1 Remove prior_prob from supported properties in Candidate. Introduce KnowledgeBase.supports_prior_probs(). 2023-03-13 16:54:38 +01:00
Raphael Mitsch
6adc15178f Partially fix alias/mention terminology usage. Convert Candidate to interface. 2023-03-13 14:26:14 +01:00
Raphael Mitsch
649c146e2c Move attributes out of Candidate. 2023-03-13 09:21:08 +01:00
Raphael Mitsch
ce23942320 Merge branch 'refactor/el-candidates' of github.com:rmitsch/spaCy into refactor/el-candidates 2023-03-10 09:04:10 +01:00
Raphael Mitsch
348dd1c87e Update docstrings. 2023-03-10 09:03:41 +01:00
Raphael Mitsch
27053912da Drop unused InMemoryCandidate._entity_hash. 2023-03-10 09:00:30 +01:00
Raphael Mitsch
6fc7997c06 Fix entity_id refactoring problems in docstrings. 2023-03-10 08:55:32 +01:00
Raphael Mitsch
34e092e4e5
Update spacy/kb/candidate.pxd
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-03-09 16:15:39 +01:00
Raphael Mitsch
c61654eef8 Drop storing mention. 2023-03-09 15:04:10 +01:00
Raphael Mitsch
b0ee34185d Add abstract class check. 2023-03-09 14:56:44 +01:00
Raphael Mitsch
b476041417 Port Candidate and InMemoryCandidate to Cython. 2023-03-09 14:44:41 +01:00
Raphael Mitsch
1c937db3af Rename 'alias' to 'mention'. 2023-03-09 12:06:15 +01:00
Raphael Mitsch
cea58ade89 Simplify interface for int/str representations. 2023-03-07 14:35:38 +01:00