Sentence translation with NLTK

Viewed 54

I'm trying to translate an English sentence into a Filipino dialect, how do I go about it? I already constructed two grammars for the English and Filipino dialect.

# Text sentence I want to translate into the Filipino dialect
text = nltk.word_tokenize("hello my name is aurora what is your name")

# English grammar
eng_grammar = nltk.CFG.fromstring("""
S -> NP DC VP AS DC 

AS -> IN VR
NP -> N
DC -> PRP N
VP -> VR N 

PRP -> "my" | "your"
VR -> "is"
N -> "hello" | "name" | "aurora"
IN -> "what"
""")

# Filipino dialect grammar
ilo_grammar = nltk.CFG.fromstring("""
S -> NP DC VP AS DC

AS -> IN VR
NP -> N
DC -> N PRP | PRP N
VP -> VR N 
CD -> N PRP

PRP -> "ko" | "mo"
VR -> "ti" | "ket"
N -> "kablaaw" | "nagan" | "aurora"
IN -> "anya"
""")
0 Answers
Related