Hello. My name is @naoya_t.
Because of my relationship, I am participating in the beginner Latin reading party presided over by Mr. 7shi. I do an Advent calendar in Latin, and I say "Latin programming" I was happy to let you participate.
Perhaps this (quiet) feeling is likely to appear several times by December 25th, so For the time being, I would like to start lightly.
(I'm in charge of 12/2, but it's almost time for the west coast of the United States to change. I'm sorry.)
I am making such a tool. https://github.com/naoyat/latin
When you enter a Latin sentence, it will guess the inflected form or look up a dictionary and somehow translate it into Japanese. (Since the words that appear in the text are manually entered in the dictionary, the words that do not appear in the text are not understood.)
It has a slight North American English accent, but it also has the ability to read the text aloud (with pitch accents) [MacOSX only].
For example, in English, what is the subject and what is the object is expressed in word order (or sentence pattern), but in Latin, it is expressed by case inflection of nouns (or adjectives, etc.). And the word order is relatively free. In addition, the conjugation of verbs is complicated (compared to English, etc.), and the conjugation of verbs makes it possible to fully understand the subject, so pronouns that correspond to the subject may not be used (unless necessary).
As you all know, "Cogito, ergo sum." ) There is no need to change the subject.
So, in order to capture the meaning of a Latin sentence, it is necessary to understand not only the part of speech of the word that appears, but also the conjugation of verbs and the case inflection of nouns.
Since autumn, new (easy and easy-to-understand) texts have been adopted at the beginner Latin reading group, and the chances of looking up a dictionary and thinking about conjugations have decreased, but in the texts I used before, verb conjugation and conjugation I had to think about the case inflection of nouns and adjectives.
Since Latin has been used for a long time, I decided to "learn Latin for the purpose of writing a program to analyze Latin sentences" this time.
There are many patterns of verb conjugation and noun case inflection (there are irregular verbs), which is the most troublesome part of studying Latin.
But since I have a PC, I want to write a program and do something about it. By the way, it is troublesome to look up the dictionary one by one, so I want to do something about it.
The approach of inflected analysis can be roughly divided.
(1) Guess the original form and the inflected form each time from the inflection of the word form (surface form) that appears in the sentence. (2) Search for all inflections in advance, throw them into the DB, and search from there.
I think there are two directions like this, but this time I will go with the approach of (2). Actually, I don't set up a DB outside, but put it in a hash table (or dict) each time.
In conclusion, I'm using Python (2.7). Eliminate from my poor language skills.
If you can't write, you can write in any language, but I'm tired of being forced to choose a language, so it's probably a safe place.
In the end, I was worried about Python, Gauche, and JavaScript, but I wrote a little simple processing around word conjugation, and I thought that Python would be easier to write in this, so I chose Python.
Futurus persevero...
There are various things I want to write, but I will write more at a later date because I do not have enough time and there is more space behind the calendar.
We continue to thank you.
Recommended Posts