words = ["ကြီး", "သော", "အိမ်"]
pos_tags = [
frozenset(["ADJ", "N", "V"]),
frozenset(["P_MOD"]),
frozenset(["N"]),
]
# Disambiguate each word individually using surrounding POS context
for i, (word, tags) in enumerate(zip(words, pos_tags)):
prev_pos = None if i == 0 else pos_tags[i - 1]
next_pos = None if i == len(words) - 1 else pos_tags[i + 1]
# Extract single POS string from unambiguous tags for context
prev_pos_str = next(iter(prev_pos)) if prev_pos and len(prev_pos) == 1 else None
next_pos_str = next(iter(next_pos)) if next_pos and len(next_pos) == 1 else None
result = disambiguator.disambiguate_in_context(
word, tags,
prev_word=words[i - 1] if i > 0 else None,
prev_word_pos=prev_pos_str,
next_word=words[i + 1] if i < len(words) - 1 else None,
next_word_pos=next_pos_str,
)
print(f"{word}: {result.resolved_pos} ({result.rule_applied.value})")
# ကြီး: ADJ (R2)
# သော: P_MOD (none - unambiguous)
# အိမ်: N (none - unambiguous)