Difference between revisions of "Language/Multiple-languages/Culture/Numeration-Tutorial"

From Polyglot Club WIKI
Jump to navigation Jump to search
Line 73: Line 73:


== What's the future plan? ==
== What's the future plan? ==
I need to add support to other 4 languages mentioned in 'about/language.yaml' and notations mentioned in 'about/notation.yaml', then I will start supporting other languages. I will add a guidance on adding a new language, add the TTS support (SR support requires too much effort with regard to its benefit, so it's dropped), create a GUI with [https://beeware.org/ BeeWare]. I need to accumulate experience through this project, then I can create other ones.
I need to add support to other 4 languages mentioned in 'about/language.yaml' and notations mentioned in 'about/notation.yaml', then I will start supporting other languages. I will add a guidance on adding a new language, add the TTS support and maybe the SR support, create a GUI with [https://beeware.org/ BeeWare]. I need to accumulate experience through this project, then I can create other ones.

Revision as of 18:19, 23 October 2020

Finally, the first version of the Numeration tool is released! This version will allow you to practise some Esperanto numerals! English is on the way! More languages to come...

Numeration 20201008.png

What is the Numeration tool?

This tool will help you practise reading, writing (hopefully also listening and speaking) numbers, written in Python and YAML.

The Numeration project is for practising conversion of numbers between symbols and writing systems.


Address: https://gitlab.com/GrimPixel/Numeration


NB: It would be ridiculous to post this tutorial on GitLab, because this tutorial's target readers are non-programmers, so it is too detailed for programmers.

What are Python and YAML and why choose them?

Python

Python is one of the most favoured languages.

Why not Rust or TypeScript, but Python? Well, because Python codes are very easy to maintain, Python also has some unique useful features including f-string and negative indexing. In addition, Python has a lot of scientific libraries, so it is more relevant to my main area of study.

YAML

YAML is one of the most useful data serialization formats.

And why not JSON or TOML, but YAML? Because YAML has high readability and is very easy to maintain, at least no need to type soo many quotation marks.

By the way, XML is not that horrible as described in that linked page. That is a joke with escape characters.

How to get started with Numeration?

1. Download the latest Python and install it, so you can run Python programs

2. Download PyCharm, an integrated development environment (IDE), and install it, so you have a graphical user interface (GUI) to edit the code or run it. Alternative: Pyzo.

3. Download Python's YAML parser, so that Python interpreter can understand YAML. If you are using Windows, tap WinKey, input "cmd", tap Enter, so the command line is opened. Copy the line starting with "pip" in that webpage, paste into the command line window, tap Enter. For users of other operating systems, you should already have known how to open the command line of your system, I suppose.

They are all open-source.

After doing this, go to that Address above. Download the source code and extract the compressed file. Keep the directory structure unchanged, otherwise you need to change the code to run the program.

Open PyCharm, open the project directory, open 'rule/esperanto.py'.

Tap "Ctrl + Shift + F10" to run the code in current tab. Tap "Shift + F10" to run the code in the file specified on the upper-right corner.

If you are still confused about PyCharm, please watch the first sections of that Mosh's tutorial above.

Can you explain the code?

The 'rule/lib' folder is the library, in which common functions are stored. The 'rule' folder contains completed and unfinished languages. In the completed 'esperanto.py', you can see several parts:

  1. Code to enable ruamel
  2. Functions for writing
  3. Code to import library
  4. Code to load dictionary
  5. Code to load setting
  6. Code for subject selection and check
  7. Empty strings (without which PyCharm will give ugly warnings of “potential undefined variables”)
  8. Code to input notation or “date and time” and check
  9. Code to write and print nominal number; integer, fraction etc. or ordinal number; date and time

Abbreviations are avoided, so that people can see what code does what thing clearly.

Further explanation will be included in the manual on how to add a language.

Why choose Apache 2.0?

I want to let people use this even commercially, e.g. in language-learning games like Influent. Thus I need a permissive license. You may ask why not public domain. It's disputable whether people can truly release software in public domain when they are alive.

MIT is good, but there is a problem: it doesn't explain how to deal with patents and trade marks. This allows patent trolls to sue those who use the code commercially without knowing that it contains patent. When the MIT license came into being, there was no software patent, so the license can be called outdated.

A guy named Lawrence E. Rosen created the Academic Free License to deal with this issue and this idea was incorporated into Apache 2.0, a better alternative.

What's the future plan?

I need to add support to other 4 languages mentioned in 'about/language.yaml' and notations mentioned in 'about/notation.yaml', then I will start supporting other languages. I will add a guidance on adding a new language, add the TTS support and maybe the SR support, create a GUI with BeeWare. I need to accumulate experience through this project, then I can create other ones.