Source: Github repository.
Rule based English to Ukrainian translator
Very simple translator. Barely handles Present Simple.
Currently it doesn't work because of unimplemented dictionary interface. The declension part is also undone.
Thinking about writing it in Python and making it much simpler.
Dependencies
amb-parser
(my package, actually).
Algorithm:
-
Parse English sentence into parse tree (
parsing.rkt
,english-grammar.rkt
,dictionary.rkt
):- Downcase string.
- Remove punctuation characters.
- Split string into words by whitespace.
- Tag POS for words.
- Parse the sentence. (
amb-parser
handles ambiguity, so it returns all possible parse trees).
-
Transform English parse tree into Ukrainian parse tree.
That's the heart of the translator. It uses rules and Racket's
match
form to transform English grammar patterns to Ukrainian grammar patterns.The only thing it handles are:
- Removing
am
,is
,are
from simple sentences (like:My name is Anton.
). - Removing determiners
a
,an
,the
. - Transforming sentences with
have
/has
(like:I have a pen.
->В я є ручка.
).
- Removing
-
Decline Ukrainian parse tree and turn it into string.
It should be an interesing part of the program. I've tried to write declension functions some time ago, but failed.