Views
No views yet
1from Baseline_LSTM import Config, build_model
2import tensorflow as tf
3import json
4from tensorflow.keras.preprocessing.sequence import pad_sequences
5
6# Load tokenizer
7with open("tokenizer.json", "r") as f:
8 tokenizer_data = json.load(f)
9
10# Build reverse word-index if needed
11word_index = tokenizer_data.get("word_index", tokenizer_data)
12config = Config()
13
14# Tokenize example sentence
15text = "Mbak Srini mangan pecel ajange pincuk"
16tokens = [word_index.get(word, word_index.get("<unk>", 1)) for word in text.split()]
17tokens_padded = pad_sequences([tokens], maxlen=config.MAX_LEN, padding='post')
18
19# Load model
20model = build_model(config)
21model.load_weights("baseline_lstm_model.h5")
22
23# Predict
24prediction = model.predict(tokens_padded)
25label = prediction.argmax(axis=1)[0]
26print("Predicted class:", label)1@inproceedings{farhansyah-etal-2025-language,
2 title = "Do Language Models Understand Honorific Systems in {J}avanese?",
3 author = "Farhansyah, Mohammad Rifqi and
4 Darmawan, Iwan and
5 Kusumawardhana, Adryan and
6 Winata, Genta Indra and
7 Aji, Alham Fikri and
8 Wijaya, Derry Tanti",
9 editor = "Che, Wanxiang and
10 Nabende, Joyce and
11 Shutova, Ekaterina and
12 Pilehvar, Mohammad Taher",
13 booktitle = "Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
14 month = jul,
15 year = "2025",
16 address = "Vienna, Austria",
17 publisher = "Association for Computational Linguistics",
18 url = "https://aclanthology.org/2025.acl-long.1296/",
19 doi = "10.18653/v1/2025.acl-long.1296",
20 pages = "26732--26754",
21 ISBN = "979-8-89176-251-0",
22 abstract = "The Javanese language features a complex system of honorifics that vary according to the social status of the speaker, listener, and referent. Despite its cultural and linguistic significance, there has been limited progress in developing a comprehensive corpus to capture these variations for natural language processing (NLP) tasks. In this paper, we present Unggah-Ungguh, a carefully curated dataset designed to encapsulate the nuances of Unggah-Ungguh Basa, the Javanese speech etiquette framework that dictates the choice of words and phrases based on social hierarchy and context. Using Unggah-Ungguh, we assess the ability of language models (LMs) to process various levels of Javanese honorifics through classification and machine translation tasks. To further evaluate cross-lingual LMs, we conduct machine translation experiments between Javanese (at specific honorific levels) and Indonesian. Additionally, we explore whether LMs can generate contextually appropriate Javanese honorifics in conversation tasks, where the honorific usage should align with the social role and contextual cues. Our findings indicate that current LMs struggle with most honorific levels, exhibiting a bias toward certain honorific tiers."
23}