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

✨ Add regen wikification #44

Merged
merged 7 commits into from
Dec 28, 2022
Merged

Conversation

GabrielePicco
Copy link
Contributor

@GabrielePicco GabrielePicco commented Dec 23, 2022

Add easy Wikification for the Regen model

Status Type ⚠️ Core Change Issue
Hold Feature No #11

Description

Examples

import spacy

from zshot import PipelineConfig
from zshot.linker.linker_regen.linker_regen import LinkerRegen
from zshot.linker.linker_regen.utils import load_wikipedia_trie, spans_to_wikipedia
from zshot.mentions_extractor import MentionsExtractorSpacy
from zshot.tests.config import EX_DOCS

nlp = spacy.load("en_core_web_sm")
trie = load_wikipedia_trie()
config = PipelineConfig(
    mentions_extractor=MentionsExtractorSpacy(),
    linker=LinkerRegen(trie=trie),
)
nlp.add_pipe("zshot", config=config, last=True)
assert "zshot" in nlp.pipe_names

doc = nlp(EX_DOCS[1])
print(doc.ents)
print(spans_to_wikipedia(doc._.spans))

Issues

Closes #11

@codecov
Copy link

codecov bot commented Dec 27, 2022

Codecov Report

Base: 92.93% // Head: 93.03% // Increases project coverage by +0.10% 🎉

Coverage data is based on head (07f7920) compared to base (b2c2a27).
Patch coverage: 98.48% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #44      +/-   ##
==========================================
+ Coverage   92.93%   93.03%   +0.10%     
==========================================
  Files          67       67              
  Lines        2773     2830      +57     
==========================================
+ Hits         2577     2633      +56     
- Misses        196      197       +1     
Impacted Files Coverage Δ
zshot/linker/linker_regen/utils.py 78.04% <96.55%> (+44.71%) ⬆️
zshot/linker/linker_regen/linker_regen.py 98.30% <100.00%> (+0.05%) ⬆️
zshot/linker/linker_regen/trie.py 100.00% <100.00%> (ø)
zshot/tests/linker/test_regen_linker.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@GabrielePicco GabrielePicco merged commit 07c9893 into main Dec 28, 2022
@GabrielePicco GabrielePicco deleted the feature/add-regen-wikification branch December 28, 2022 09:20
marmg pushed a commit that referenced this pull request Mar 24, 2023
* ✨ Add regen wikification

* 🐛 Fix Wikification

* 🐛 Reduce tests complexity

* 🐛 Reduce test resources

* 🐛 Fix test

* ➖ Remove test file

* ✏️ Remove too expensive test

Signed-off-by: Marcos Martinez <Marcos.Martinez.Galindo@ibm.com>
marmg pushed a commit that referenced this pull request Mar 24, 2023
* ✨ Add regen wikification

* 🐛 Fix Wikification

* 🐛 Reduce tests complexity

* 🐛 Reduce test resources

* 🐛 Fix test

* ➖ Remove test file

* ✏️ Remove too expensive test

Signed-off-by: Marcos Martinez <Marcos.Martinez.Galindo@ibm.com>
marmg pushed a commit that referenced this pull request Mar 28, 2023
* ✨ Add regen wikification

* 🐛 Fix Wikification

* 🐛 Reduce tests complexity

* 🐛 Reduce test resources

* 🐛 Fix test

* ➖ Remove test file

* ✏️ Remove too expensive test

Signed-off-by: Marcos Martinez <Marcos.Martinez.Galindo@ibm.com>
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.

Extend Regen linker to support Wikification providing precomputed prefix-tree
1 participant