Last active
August 16, 2022 06:45
-
-
Save kasperjunge/04d65442d948d0c6b9bc028b9b87b699 to your computer and use it in GitHub Desktop.
Danish SOTA NER
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from transformers import pipeline | |
text = """ | |
Dan Saattrup Nielsen arbejder som AI Specialist hos Alexandra Instituttet | |
og er han næstformand i Dansk Data Science Community. | |
""" | |
ner = pipeline( | |
task="ner", | |
model="saattrupdan/nbailab-base-ner-scandi", | |
aggregation_strategy="first" | |
) | |
result = ner(text) | |
print(pd.DataFrame.from_records(result)) | |
# Output: | |
# entity_group score word start end | |
# 0 PER 0.999734 Dan Saattrup Nielsen 1 21 | |
# 1 ORG 0.998360 Alexandra Instituttet 53 74 | |
# 2 ORG 0.999438 Dansk Data Science Community 104 132 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment