Introduction of activities applying Python

I teach programming at school. In my seminar, I am working on AI-based (artificial intelligence-related) themes using Python.   ------------------- Notes on tools and libraries (PDF format 40 pages: 502KB) Updated on September 29, 2018 Tools mentioned: MeCab, CaboCha, JUMAN, KNP,              Open JTalk, Julius, OpenSSL Referenced libraries: GMP, MPFR The processing environment mentioned: Visual Studio, MSYS / MinGW Modules mentioned: mecab-python, PySwip ------------------- ・ Prolog text We plan to make it a backend inference engine for Python programs. -------------------   The text for learning Python is based on this. → I made a Python text   (2017/07/11) We are working on implementing a "dialogue function that allows Japanese to be used properly". So, first of all, I am preparing to use MeCab and Open JTalk from Python.   The next goal is to realize an interactive function that can convert sentences into first-order predicate logic (FOL) formulas and exchange "meaningful" Japanese. (The type that has a connection before and after the dialogue properly) Therefore, I want to link with Prolog, so I need a function to call the SWI-Prolog function from Python. However, the PySwip module does not work well, and it seems faster to create the cooperation function by yourself ...   By the way, the activity stance of my seminar is "cognitive architecture" and "AGI". Nowadays, there seems to be a tendency that "AI" means "deep neural network", but in our seminar, the treatment of deep NN is still ahead.   It seems that the voice of "anachronism" will fly, but surprisingly the plain part is important.   Under Python, there are a lot of wonderful modules such as data analysis and computer algebra. You can also use natural language processing and inference engines.   Why don't we all aim to realize "Japanese general-purpose artificial intelligence"?

Supplement / report

[Report] Natural Language Understanding (NLU) (2018/12/25)

In this year's graduation research, there are students working on the theme of natural language understanding (NLU). I made Publish program module and document. Presentation at the 81st IPSJ National Convention.

[Report] Large-scale calculation (2018/02/27)

This is one of the deliverables of this year's graduation research, and is an enlarged movie of the Mandelbrot set. Uploaded on YouTube It is a movie that expands up to 10 ^ 260 times and consists of 8,855 frames. It takes about 3 minutes to generate one frame, so if you generate a movie on one machine, it will be "continuous operation for 18 days", but if you divide, distribute, and integrate jobs on many machines It was completed in about 6 hours. I didn't use any new technology, but I made a system with students to execute a frame generation program written in C ++ in a distributed manner in Python. In short, I improvised RJE (Remote Job Entry) for grid computing in Python. I did it with 3 liberal arts students + myself. (Presented at the conference)

[Report] Formula ⇔ Japanese (2018/02/27)

This is also the result of this year's graduation research. We are aiming for a system that solves math problems in Japanese, but this time we are implementing a function that "reads mathematical formulas correctly in Japanese". The computer algebra engine is Python's Sympy, the clean copy is TeX, and the reading is Open JTalk. The next step is to develop a function that answers when you convey the request in Japanese, but after inputting Japanese, perform morphological analysis (using MeCab) and make it a predicate logic expression and convey it to Prolog. I'm making it. It's nice that Python can connect anything. It will be fun. ● Read aloud formula 01: Simple addition ● Read aloud mathematical formula 02: Indefinite integral ● Read aloud the formula 03: Sum ● Reading out mathematical formulas 04: Complex cases ● Read aloud mathematical formulas 05: Japanese morphological analysis I did it with one liberal arts student + myself. (Presented at the conference)

[About python_ai_note.pdf]

-------------- Supplement Added information on Japanese morphological analysis and parsing tools (CaboCha, JUMAN, KNP). It seems that these can be used to convert to "Japanese sentence-> predicate logic expression".   -------------- Supplement For those who use C / C ++ language processing system, the introduction method and simple usage of Microsoft Visual Studio and MSYS / MinGW are posted.   As usual, when we used the visualization of the "Mandelbrot set" as a benchmark, we found that VC was 16% faster than GCC (MinGW64). (Both compilers optimized with O2 option) → Source Program   This program creates an image on an array and exports it as SVG. To be honest, if the pixel configuration is not small enough (about 128x128), the generated SVG cannot be displayed on a Web browser, but it is also a comparison of the writing speed when writing huge SVG data to a file. Output to a file was faster with GCC (about twice as much).   -------------- Supplement Added the basic usage of mecab-python and PySwip. PySwip is finally working fine.   -------------- Supplement Added a description of GMP / MPFR functions that free up storage for objects.   -------------- Supplement Added an introduction (introduction and demo method) of how to use the voice recognition program Julius.   Speech recognition is deep, so I think you can learn a lot through the practice of mastering Julus. Once you've learned the basics of speech processing at school, it's a good idea to use Julius for hands-on exercises.   Click here for a link to the sample voice data for voice recognition quoted in the text: snd01.wav snd02.wav   -------------- Supplement A little addition to the explanation of GMP.   -------------- Supplement Added explanation of basic usage of Arbitrary Precision Numerical Library GMP and MPFR. Since there are students who perform high-precision simulations of complex dynamical systems, I have described how to use them. High-precision arithmetic can be performed even with a computer algebra system, but there are cases where it is better to write in C / C ++ due to the amount of calculation and calculation speed, so we used this as a material for that purpose.   -------------- Supplement Added information on how to use Open JTalk. After executing the Open JTalk command in the subprocess module, we have posted a sample program that reads out Japanese sentences by playing the created WAV format file with PyAudio.   -------------- Supplement Added information on how to use OpenSSL.   Notes on tools and libraries   There was criticism from the students, and he said, "It's a shame to make AI the title even though AI-like functions haven't been created yet!" So the title was corrected ...


written by Katsunori Nakamura

Recommended Posts

Introduction of activities applying Python
Introduction of Python
Introduction of python drawing package pygal
Record of Python introduction for newcomers
General Theory of Relativity in Python: Introduction
Introduction of PyGMT
Easy introduction of speech recognition with Python
Basics of Python ①
Basics of python ①
Copy of python
Easy introduction of python3 series and OpenCV3
Introduction of cymel
[Introduction to Data Scientists] Basics of Python ♬
[Introduction to Udemy Python 3 + Application] 26. Copy of dictionary
[Introduction to Udemy Python 3 + Application] 19. Copy of list
Introduction of Python Imaging Library (PIL) using HomeBrew
Kyoto University Python Lecture Material: Introduction of Columns
[Introduction to Python] Basic usage of lambda expressions
[Python] Operation of enumerate
List of python modules
Introduction of trac (Windows + trac 1.0.10)
Unification of Python environment
Copy of python preferences
Basics of Python scraping basics
[python] behavior of argmax
Usage of Python locals ()
Introduction of Virtualenv wrapper
the zen of Python
Introduction to Python language
Introduction to OpenCV (python)-(2)
Installation of Python 3.3 rc1
Python Basic Course (Introduction)
# 4 [python] Basics of functions
Basic knowledge of Python
Sober trivia of python3
Summary of Python arguments
Python Beginner's Guide (Introduction)
Basics of python: Output
Installation of matplotlib (Python 3.3.2)
Application of Python 3 vars
Various processing of Python
[Chapter 5] Introduction to Python with 100 knocks of language processing
[Introduction to Udemy Python3 + Application] 53. Dictionary of keyword arguments
[Chapter 3] Introduction to Python with 100 knocks of language processing
[Chapter 2] Introduction to Python with 100 knocks of language processing
[Introduction to Python] Basic usage of the library matplotlib
[Introduction to Udemy Python3 + Application] 52. Tupleization of positional arguments
Explanation of NoReverseMatch error in "python django super introduction"
[Chapter 4] Introduction to Python with 100 knocks of language processing
[Python] Correct usage of map
Towards the retirement of Python2
Introduction to Python Django (2) Win
Summary of python file operations
Summary of Python3 list operations
Python --Quick start of logging
Recommendation of binpacking library of python
[Introduction to cx_Oracle] Overview of cx_Oracle
Automatic update of Python module
Python --Check type of values
[Python] Etymology of python function names
About the ease of Python