Views
No views yet
OICE-LePOS-XLM-R-UD| Category | Accuracy |
|---|---|
| POS | 0.9928 |
| Lemma | 0.9394 |
| MENOTA Tag | UD Tag | Notes |
|---|---|---|
| xVB | VERB | |
| xNC | NOUN | |
| xCU | CCONJ | Can be either CCONJ or SCONJ! |
| xAV | ADV | |
| xAP | ADP | |
| xPE | PRON | |
| xDD | DET | |
| xNP | PROPN | |
| xAJ | ADJ | |
| xRP | PART | |
| xDP | DET | |
| xVP | PART | |
| xCC | CCONJ | |
| xPI | PRON | |
| xIM | PART | |
| xNA | NUM | |
| xCS | SCONJ | |
| xPQ | PRON | |
| xNO | NUM | |
| xUA | — | Rarely used |
| xIT | INTJ | |
| xPA | — | Occurs < 30 times |
| xEX | — | Occurs once |
1# Install
2pip install torch transformers huggingface_hub scikit-learn tqdm pandas
3
4# Import packages
5from huggingface_hub import snapshot_download
6import os
7os.mkdir("oice_lepos")
8
9# Download model
10snapshot_download("NKCZ/old-icelandic-lemma-pos-xlm-r-ud", local_dir="oice_lepos")
11
12# Change to the dir with model
13os.chdir("/content/oice_lepos")
14
15# Import utils from the script
16from OICE_LePOS_XLM_R_UD import OldIcelandicNLPTrainer
17
18# Initialize the mode
19oice = OldIcelandicNLPTrainer.from_pretrained("oi_model")
20
21# Predict from a word list
22results = oice.predict(["Almáttigr", "guð", "skapaði", "himin", "ok", "jǫrð", "."]) #Example from Prose Edda
23for result in results:
24 print(result)
25
26#{'word': 'Almáttigr', 'upos': 'ADJ', 'lemma': 'almáttigr'}
27#{'word': 'guð', 'upos': 'NOUN', 'lemma': 'guð'}
28#...
29
30# Predict from a raw string
31results = trainer.predict_text("Almáttigr guð skapaði himin ok jǫrð ok alla þá hluti er þeim fylgja")