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

NER #3

Open
Reyhannaaa opened this issue Dec 14, 2022 · 1 comment
Open

NER #3

Reyhannaaa opened this issue Dec 14, 2022 · 1 comment

Comments

@Reyhannaaa
Copy link

Hi, how can I use ner_results to save words and their labels?

example = 'علی به مدرسه رفت.'
ner_results = nlp(example)
print(ner_results)

it prints: [{'entity': 'B-PER', 'score': 0.9991002, 'index': 1, 'word': 'علی', 'start': 0, 'end': 3}]
while I need it to print : 'علی'

I would be thankful if you answered this.

@poyap
Copy link

poyap commented Aug 4, 2023

Why don't you just use indexing and dictionary key lookup like below:
print(ner_results[0]['word'])

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

No branches or pull requests

2 participants