Open Reyhannaaa opened 1 year ago
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.
Why don't you just use indexing and dictionary key lookup like below: print(ner_results[0]['word'])
print(ner_results[0]['word'])
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.