Views
No views yet
1>>> from transformers import pipeline
2>>>
3>>> model = pipeline(
4>>> 'token-classification',
5>>> model='rmihaylov/bert-base-pos-theseus-bg',
6>>> tokenizer='rmihaylov/bert-base-pos-theseus-bg',
7>>> device=0,
8>>> revision=None)
9>>> output = model('Здравей, аз се казвам Иван.')
10>>> print(output)
11
12[{'end': 7,
13 'entity': 'INTJ',
14 'index': 1,
15 'score': 0.9640711,
16 'start': 0,
17 'word': '▁Здравей'},
18 {'end': 8,
19 'entity': 'PUNCT',
20 'index': 2,
21 'score': 0.9998927,
22 'start': 7,
23 'word': ','},
24 {'end': 11,
25 'entity': 'PRON',
26 'index': 3,
27 'score': 0.9998872,
28 'start': 8,
29 'word': '▁аз'},
30 {'end': 14,
31 'entity': 'PRON',
32 'index': 4,
33 'score': 0.99990034,
34 'start': 11,
35 'word': '▁се'},
36 {'end': 21,
37 'entity': 'VERB',
38 'index': 5,
39 'score': 0.99989736,
40 'start': 14,
41 'word': '▁казвам'},
42 {'end': 26,
43 'entity': 'PROPN',
44 'index': 6,
45 'score': 0.99990785,
46 'start': 21,
47 'word': '▁Иван'},
48 {'end': 27,
49 'entity': 'PUNCT',
50 'index': 7,
51 'score': 0.9999685,
52 'start': 26,
53 'word': '.'}]