[PYTHON] Latin learning for the purpose of writing a Latin sentence analysis program (Part 1)

greeting

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

スクリーンショット 2013-12-03 15.08.53 12-03.png

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].

Analysis of Latin sentences

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.

"Memorization of utilization table"

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.

Implementation language

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

Latin learning for the purpose of writing a Latin sentence analysis program (Part 1)
The story of writing a program
How to use machine learning for work? 01_ Understand the purpose of machine learning
Machine learning memo of a fledgling engineer Part 1
The story of low learning costs for Python
A program that searches for the same image
Machine learning memo of a fledgling engineer Part 2
Create a dataset of images to use for learning
[Python] A program that counts the number of valleys
Explanation of the concept of regression analysis using python Part 2
Summarized the types of sum of squares for analysis of variance
Techniques for understanding the basis of deep learning decisions
Explanation of the concept of regression analysis using Python Part 1
[Python] A program that compares the positions of kangaroos.
The story of creating a VIP channel for in-house chatwork
Avoiding the pitfalls of using a Mac (for Linux users?)
Performance verification of data preprocessing for machine learning (numerical data) (Part 2)
I wrote a demo program for linear transformation of a matrix
I made a dot picture of the image of Irasutoya. (part1)
I made a dot picture of the image of Irasutoya. (part2)
Performance verification of data preprocessing for machine learning (numerical data) (Part 1)
A Python beginner first tried a quick and easy analysis of weather data for the last 10 years.
A memorandum of understanding for the Python package management tool ez_setup
Let's write a simple simulation program for the "Monty Hall problem"
Wrap (part of) the AtCoder Library in Cython for use in Python
Find the optimal value of a function with a genetic algorithm (Part 2)
Studying web scraping for the purpose of extracting data from Filmarks # 2
I searched for a similar card of Hearthstone with Deep Learning
The story of making a standard driver for db with python.
Count the maximum concatenated part of a random graph with NetworkX
Finding the optimum value of a function using a genetic algorithm (Part 1)
Summary of pages useful for studying the deep learning framework Chainer
[Python] A program that rotates the contents of the list to the left
Create a compatibility judgment program with the random module of python.