Coding exceptions with patter-matching

Tiago Tresoldi tiago.tresoldi at
Sat Oct 27 20:29:38 CEST 2001

Hello people,

I'm involved with a project of machine translation in Python
( I'm
working alone on the code now, and now I found a huge problem. Let me
tell that sentence in
Traduki are split into a quite-complex list structures with lists,
integers and Unicode
strings inside. A language is first translated into this list and then
to the wanted language.

Now I've found a problem dealing with exceptions in human languages.
For example, how to code
that you have feet instead of foots? How to code that italian verbs
ending in -care and -gare
need an -h before the standard suffix when indicative form? And so on.
Sometimes I need to
look at the value of more than 10 variables to know if it is a
language-exception or not. I know
it would be impossible and stupid to hard-code all the exception, so I
started to think about
if I can write in Python a kind of matching pattern to get the right
translations. I am
thinking about an ASCII-file (I am not a very skilled programmer...)
with contents like:

0 0 1 0 12 0 8 0 1 0 0 0 0 1 2 en foots feet
1 0 0 1  3 0 0 1 0 1 4 6 0 0 1 it -care, -gare -ch*, -gh*

and so on (this code is not true, please! :).

I am sure that there must be a better way for doing this. Please
remember that there are almost
infinite entries to this database. Can someone help me with this?

Thanks in advance for everything.

Tiago Tresoldi

More information about the Python-list mailing list