Views
No views yet
nag)pipeline:1from transformers import pipeline
2
3# Load the pipeline
4# Note: Aggregation strategy 'simple' merges sub-tokens into words
5pos_pipeline = pipeline(
6 "token-classification",
7 model="agnivamaiti/naganlp-pos-annotated-corpus",
8 aggregation_strategy="simple"
9)
10
11# Inference
12text = "moi etiya school jai ase."
13results = pos_pipeline(text)
14
15# Print results
16for entity in results:
17 print(f"{entity['word']}: {entity['entity_group']} ({entity['score']:.2f})")1moi: PRON (0.22)
2etiya: ADV (0.52)
3school: NOUN (0.92)
4jai ase: VERB (0.95)
5.: PUNCT (0.95)