File size: 650 Bytes
097488c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Example usage of id_nergrit_indonesian_spacy

import spacy

# Load the model
nlp = spacy.load("id_nergrit_indonesian_spacy")

# Example texts
texts = [
    "Presiden Joko Widodo mengunjungi Jakarta pada tanggal 17 Agustus 2023.",
    "Bank Indonesia mengumumkan suku bunga sebesar 5.75 persen.",
    "Menteri Keuangan Sri Mulyani menyatakan APBN 2023 mencapai Rp 3000 triliun.",
    "Universitas Indonesia terletak di Depok, Jawa Barat.",
]

# Process texts
for text in texts:
    doc = nlp(text)
    print(f"\nText: {text}")
    print("Entities:")
    for ent in doc.ents:
        print(f"  - {ent.text:30} -> {ent.label_}")