update posttag
This commit is contained in:
parent
90ea0c34f6
commit
a6c269613f
@ -1,8 +1,33 @@
|
||||
|
||||
import stanza
|
||||
stanza.download('id')
|
||||
nlp = stanza.Pipeline('id', processors='tokenize,pos')
|
||||
doc = nlp("Budi sedang membaca buku sejarah di perpustakaan nasional.")
|
||||
# Menampilkan hasil PoS tagging
|
||||
print(f"Kalimat: {doc}\n")
|
||||
print(f"{'Kata':<15} | {'Tag PoS (UPOS)':<15} | {'Deskripsi':<30}")
|
||||
print("-" * 65)
|
||||
|
||||
# Mapping sederhana untuk penjelasan tag UPOS
|
||||
upos_desc = {
|
||||
"ADJ": "Adjective (Kata Sifat)",
|
||||
"ADP": "Adposition (Kata Depan/Preposisi)",
|
||||
"ADV": "Adverb (Kata Keterangan)",
|
||||
"AUX": "Auxiliary (Kata Bantu)",
|
||||
"CCONJ": "Coordinating Conjunction (Kata Hubung Setara)",
|
||||
"DET": "Determiner (Kata Penentu)",
|
||||
"INTJ": "Interjection (Kata Seru)",
|
||||
"NOUN": "Noun (Kata Benda)",
|
||||
"NUM": "Numeral (Kata Bilangan)",
|
||||
"PART": "Particle (Partikel)",
|
||||
"PRON": "Pronoun (Kata Ganti)",
|
||||
"PROPN": "Proper Noun (Nama Diri/Nama Khusus)",
|
||||
"PUNCT": "Punctuation (Tanda Baca)",
|
||||
"SCONJ": "Subordinating Conjunction (Kata Hubung Bertingkat)",
|
||||
"SYM": "Symbol (Simbol)",
|
||||
"VERB": "Verb (Kata Kerja)",
|
||||
"X": "Other (Lain-lain)"
|
||||
}
|
||||
|
||||
for sentence in doc.sentences:
|
||||
for word in sentence.words:
|
||||
print(f"{word.text:<15} | {word.upos:<15}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user