Views
No views yet
1from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer
2model = AutoModelForTokenClassification.from_pretrained("alierenak/berturk-cased-ner")
3tokenizer = AutoTokenizer.from_pretrained("alierenak/berturk-cased-ner")
4ner_pipeline = pipeline('ner', model=model, tokenizer=tokenizer)
5ner_pipeline("Türkiye'nin başkenti Ankara, ilk cumhurbaşkanı Mustafa Kemal Atatürk'tür.")1[{'entity': 'B-LOCATION',
2 'score': 0.9966415,
3 'index': 1,
4 'word': 'Türkiye',
5 'start': 0,
6 'end': 7},
7 {'entity': 'B-LOCATION',
8 'score': 0.99456763,
9 'index': 5,
10 'word': 'Ankara',
11 'start': 21,
12 'end': 27},
13 {'entity': 'B-PERSON',
14 'score': 0.9958741,
15 'index': 9,
16 'word': 'Mustafa',
17 'start': 47,
18 'end': 54},
19 {'entity': 'I-PERSON',
20 'score': 0.98833394,
21 'index': 10,
22 'word': 'Kemal',
23 'start': 55,
24 'end': 60},
25 {'entity': 'I-PERSON',
26 'score': 0.9837286,
27 'index': 11,
28 'word': 'Atatürk',
29 'start': 61,
30 'end': 68}]1precision recall f1-score support
2
3 LOCATION 0.97 0.96 0.97 960
4ORGANIZATION 0.95 0.92 0.94 863
5 PERSON 0.97 0.97 0.97 1410
6
7 micro avg 0.97 0.95 0.96 3233
8 macro avg 0.96 0.95 0.96 3233
9weighted avg 0.97 0.95 0.96 3233