Google recently added voice typing support to more languages. Among the languages Malayalam is also included. The speech recognition is good quality and I see lot of positive comments in my social media stream. Many people started using it as primary input mechanism. This is a big step for Malayalam users without any doubt. Technical difficulties related to writing in Malayalam in mobile devices is getting reduced a lot. This will lead to more content generated and that is one of the stated goals of Google’s Next billion users project. The cloud api for speech recognition will help android developers to build new innovative apps around the speech recognition feature.
Google had added handwriting based input method for many of these languages in 2015. It was also well recieved by Malayalam user community and many chose it as primary input method mechanism for mobile devices.
Google’s machine learning based language tools, including the machine translation is well engineered projects and takes the language technology forward. For a language like Malayalam with relatively less language processing technology, this is a big boost. There is not even a competing product in the above mentioned areas.
All of these above technologies are closed source software, completely controlled by Google. Google’s opensource strategy is a complicated one. Google supports and uses opensource to gain maximum out of it – a pragmatic corporate exploitation. Machine learning based technologies are complex to be defined in the traditional open source definition. Here, for a ML based service provider, the training toolkit might be opensource, tensorflow for example. At the same time, the training data, models might be closed and secret. So, basically the system can be only reproduced by the owners of the data and those who has enough processing capacity. These emerging trends in language technology is also hard for individual opensource developers to catch up because of resourcing issues(data, processing capacity).
Is this model good for language?
Think about this. With no competition, the android operating system with Google’s technology platform is becoming default presence in mobile devices of Malayalam speakers with no doubt. The new language technologies are being quickly accepted as the one and only way to convey a persons expressions to digital world. No, it is not an exaggeration. The availability and quality of these tools is clearly winning its mass user crowd. There is no formal education for Malayalam typing. People discover and try anything that is available. For a new person to the digital world, handwriting was the easiest method to input Malayalam. Now it is speech recognition. And that will be the one and only one way these users know to enter Malayalam content. And these tools are fully owned and controlled by Google with no alternatives.
The open soure alternatives for input methods are still at the traditional typing keyboards. With its peers, they indeed won large user base and it even came to the users before Google entered. For example, the Indic keyboard has 1.4 million installations and actively improved by contributor for 23 languages. But I don’t see any opensource project that is in parallel with handwriting and speech recognition based input methods. As a developer working in Indic language technology based on free software, this is indeed a failure of opensource community.
I contacted a few academic researchers working on speech recognition and handwring recognition and asked what they think about these products by Google. For them, it is more difficult to convince the value of their research. ‘Well, we have products from Google that does this and thousands are using it. Why you want to work again on it?’ This question can’t be answered easily.
But to me, all of these products and its above mentioned nature strongly emphasis the need for free software alternatives. The mediation by closed sourced systems on one of the fundamental language computing task- inputting – with no alternatives puts the whole language and hence its users in heavy risk. Input method technologies, speech recognition, handwriting recognition.. all these are core to the language technology. These technolgies and science behind them should be owned by its speakers. People should be able to study, innovate on top of this technology and should be able to build mechanisms that are free from any corporate control to express their language.
I don’t want to imply or spread fear, uncertainity that Google will one day just start charging for these services or shutdown the tools. That is not my concern. All these language tools I mentioned are not to be built for facing that situation. It is to be developed as fundamental communication tools for the people for the digital age – build, own, learn, use, maintain by the people.
Google i18n team developed a tool to create detailed report of fonts. The tool named fontreport, produces a multi page PDF with Unicode coverage of the font, what glyphs are in it, what Open Type features it supports, available ligatures, and glyph substitutions. Optionally the tool can also create plain text reports. The PDF is generated using TeX.
The Internet Engineering Task Force (IETF) – Languages is responsible for the registration of language tags, subtags and script variants. These registered language tags are used in a wide set of internet standards and applications to identify and annotate language uniquely.
Recently Sascha Brawer(currently working at Google) submitted a proposal to register two new language subtags for Malayalam to denote the orthography variations. Malayalam orthography had a diverging moment in history when Kerala government decided to script reformation in 1971. The decision was to accommodate the Malayalam orthography for the then existing typewriters and typesetting devices. These devices had limitations to accomodate the wide character set of Malayalam at that time.
ml-puthiya: Reformed Malayalam orthography-Malayalam that is w ritten in the orthography of the 1971 reform. In Malayalam (transcribed to English), the term for this variant is “puthiya lipi”.
ml-pazhaya: Traditional Malayalam orthography- Malayalam that is written using the orthographic conventions that were in place before the 1971 reform. In Malayalam (transcribed to English), the term for this variant is “pazhaya lipi”.
Sascha Brawer correctly explained the missing part in this classification:
According to my contact, this reform was a continuum; the Kerala government order of 1971 did not immediately affect the common practice. Instead, the transition from traditional to reformed has happened over the period of 20-30 years. There is a lot of variation in the specifics for any year one could pick in the last century.
Again according to my contact, there is a common overall understanding among Malayalam speakers that the orthography of the language has moved from ‘traditional’ to ‘reformed.’ However, my contact did not know of an authoritative reference that would describe this transition in more detail.
[…] This is true, there is no defnition or authoritative reference about this
differences. And that is my concern. Given a set of printed samples from
say, todays news paper in Malayalam, one cannot say this is new'(puthiya) or this is ‘old'(pazhaya). The contemporary Malayalam usage is a mixed one. It borrows some reformation from 1971 order and some from the practices that existed before
The reason for mixed mode is because the main intention behind the 1971
reformation was to get Malayalam ‘usable’ with then type writers and composing machines. As technology progressed and when these limitations vanished, nothing stopped people from using the types similar to what they will write using pen on paper. The modern opentype technology completely removed this limitation and many modern and famous typefaces of Malayalam uses this ‘old’/ml-pazhaya style.
So defining two variants ml-puthiya, ml-pazhaya without a clear way to
distinguish one from another and having a wide range of ununamed variants exist, is concerning.[…]
For a Malayalam subtag to be approvable, it really should refer to an orthographic standard. So far it appears that there isn’t anything very precise for either the traditional or the newer spelling to be specified, so it would be best to reject this now (rather than extending it little by little) until revised proposals with solid references can be put forward.
ICANN (Internet Corporation for Assigned Names and Numbers) has approved four additional proposed Indic TLDs (top level domain names), in Malayalam, Kannada, Assamese and Oriya languages. The TLDs are yet to be delegated to NIXI (National Internet exchange of India). While Malayalam, Kannada and Oriya will use their own scripts, Assamese TLDs will use the Bengali script.
The news title says “domain names” and the report talks about TLDs. For many people domain name is simply something like “google.com” or “amazon.in” etc. So people may misinterpret the news report as approval for domain names like “കേരളസർവ്വകലാശാല.ഭാരതം”. Many people asked me if that is the case. We are going to have such domain names in future, but not yet.
I will try to explain the concept of TLD and IDN and the current status in this post.
The Internet Corporation for Assigned Names and Numbers (ICANN) is a non-profit organization which takes care of the whole internet domain name system and registration process. It achieves this with the help of lot of domain process and policies and domain registrars. In India NIXI owns the .in registration process.
A domain name is a string, used to identify member of a network based on a well defined Domain Name System(DNS). So, “google.com”, “thottingal.in” etc are domain names. There are dots in the domain name. They indicate the hierarchy from right to left. In the domain name “thottingal.in”, “.in” indicates a top level or root in naming and under that there is “thottingal”. If there is “blog.thottingal.in”, “blog” is a subdomain under “thottingal.in” and so on.
The top level domains are familiar to us. “.org”, “.com”, “.in”, “.uk”, “.gov” are all examples. Out of these “.com”, “.org” and “.gov” are generic top level domains. “.in” and “.uk” are country code top level domains, often abbreviated as ccTLD. “.in” is obviously for India.
In November 2009, ICANN decided to allow these domain name strings in the script used in countries. So “.in” should be able to represent in Indian languages too. They are called Internationalized country code Top Level Domain names, abbreviated as IDN ccTLD.
ICANN also defined a fast track process to do the definition of these domains and delegation to registrars so that website owners can register such domain names. The actual policy document on this is available at ICANN website[pdf], but in short, the steps are (1) preparation, (2) string validation and approval, (3) delegation to registrars.
So far the following languages finished all 3 steps in 2014.
What this means is, NIXI owns this TLDs and can assign domains to website owners. But as far as I know, NIXI is yet to start that.
And the following languages, just got approval for second step – string validation. ICANN announced this on April 13, 2016. String validation means, Requests are evaluated in accordance with the technical and linguistic requirements for the IDN ccTLD string(s) criteria. IDN ccTLD requesters must fulfill a number of requirements:
The script used to represent the IDN ccTLDs must be non-Latin;
The languages used to express the IDN ccTLDs must be official in the corresponding country or territory; and
A specific set of technical requirements must be met.
The languages passed the second stage now are:
As a next step, these languages need delegation- NIXI as registrar. So in short, nothing ready yet for people want to register domain names with the above TLDs.
We were talking about TLDs- top level domain names. Why there is a delay in allowing people to register domains once we have TLD? It is not easy. The domain names are unique identifiers and there should be well defined rules to validate and allow registering a domain. The domain should be a valid string based on linguistic characteristics of the language. There should be a de-duplication process- nobody should be allowed to take a domain that is already registered. You may think that it is trivial, string comparison, but nope, it is very complex. There are visually similar characters in these scripts, there are rules about how a consonant-vowel combination can appear, there are canonically equivalent letters. There are security issues[pdf] to consider.
Before allowing domain names, the IDN policy for each script need to be defined and approved. You can see a sample here: Draft IDN Policy for Tamil[PDF]. The definition of these rules were initially attempted by CDAC and was controversial and did not proceed much. I had reviewed the Malayalam policy in 2010 and participated in the discussion meetings based on a critique we prepared.
ICANN has created Generation Panels to Develop Root Zone Label Generation Rules with specific reference to Neo-Brahmi scripts. I am a member of this panel as volunteer. Once the rules are defined, registration will start, but I don’t know exactly when it will happen. The Khmer Generation Panel has completed their proposal for the Root Zone LGR. The proposal has been released for public comments.
I had to spend a few hours to debug a problem about fontconfig not identifiying a font for a language. Following the tradition of sharing the knowledge you acquired in hard way, let me note it down here for search engines.
The font that I am designing now has 3 style variants, thin, regular and bold. All has same family name. So if you set this family for whatever purpose, depending on context, thin, regular or bold versions will be picked up. Regular is expected by default. Also when you pick the font from font selectors, you would expect, regular being selected by default.
The problem I was facing is, instead of Regular, Bold was getting selected as default. In font selectors, Bold was listed first.
In GNU/Linux systems, this font matching and selection is done by fontconfig. I started with fc-match
$ fc-list MyFont : family : style : lang
I tried to find how fontconfig calculates the languages supported by a font. The minimum set of code points to be included in a font so that fontconfig declare that it supports a given language is defined in the fontconfig library. You can find them in source code. For example, mandatory code points(glyphs that match to it) to be present for English is defined in en.orth file. I cross checked each code points and one was indeed missing from my regular font variant, but bold version had everything. When I added it, all started working normally.
Later fontconfig developer Akira TAGOH told me that I can also use fc-validate to check the language coverage
$ fc-validate --lang=en MyFont.otf
MyFont.otf:0 Missing 1 glyph(s) to satisfy the coverage for en language
And after adding the missing glyph
$ fc-validate --lang=en MyFont.otf
MyFont.otf:0 Satisfy the coverage for en language
The ContentTranslation tool provides machine translation as one of the translation tool, so that editors can use it as an initial version to improve up on. We used Apertium as machine translation backend and planning to support more machine translation services soon.
A big difference in editing using ContentTranslation, is it does not involve Wiki Markup. Instead, editors can edit rich text. Basically it is contenteditable HTML elements. This also means, what you translate is HTML sections of articles.
The HTML contains all possible markups that a typical Wikipedia article has. This means, the machine translation is on HTML content. But, not all MT engines support HTML content.
Some MT engines, such as Moses, output subsentence alignment information directly, showing which source words correspond to which target words.
$ echo 'das ist ein kleines haus' | moses -f phrase-model/moses.ini -t
this is |0-1| a |2-2| small |3-3| house |4-4|
The Apertium MT engine does not translate formatted text faithfully. Markup such as HTML tags is treated as a form of blank space. This can lead to semantic changes (if words are reordered), or syntactic errors (if mappings are not one-to-one).
$ echo 'legal <b>persons</b>' | apertium en-es -f html
$ echo 'I <b>am</b> David' | apertium en-es -f html
Other MT engines exhibit similar problems. This makes it challenging to provide machine translations of formatted text. This blog post explains how this challenge is tackled in ContentTranslation.
As we saw in the examples above, a machine translation engine can cause the following errors in the translated HTML. The errors are listed in descending order of severity.
Corrupt markup – If the machine translation engine is unaware of HTML structure, they can potentially move the HTML tags randomly, causing corrupted markup in the MT result
Wrongly placed annotations – The two examples given above illustrate this. It is more severe if content includes links and link targets were swapped or randomly given in the MT output.
Missing annotations – Sometimes the MT engine may eat up some tags in the translation process.
Split annotations -During translation a single word can be translated to more than one word. If the source word has a mark up, say <a> tag. Will the MT engine apply the <a> tag wrapping both words or apply to each word?
All of the above issues can cause bad experience to translators.
Apart from potential issues with markup transfer, there is another aspect about sending HTML content to MT engines. Compared to plain text version of a paragraph, HTML version is bigger in terms of size(bytes). Most of these extra addition is tags and attributes which should be unaffected by the translation. This is unnecessary bandwidth usage. If the MT engine is a metered engine(non-free, API access is measured and limited), we are not being economic.
An outline of the algorithm we used to transfer markups from source content to translated content is given below.
The input HTML content is translated into a LinearDoc, with inline markup (such as bold and links) stored as attributes on a linear array of text chunks. This linearized format is convenient for important text manipulation operations, such as reordering and slicing, which are challenging to perform on an HTML string or a DOM tree.
Plain text sentences (with all inline markup stripped away) are sent to the MT engine for translation.
The MT engine returns a plain text translation, together with subsentence alignment information (saying which parts of the source text correspond to which parts of the translated text).
The alignment information is used to reapply markup to the translated text.
This make sure that MT engines are translating only plain text and mark up is applied as a post-MT processing.
Essentially the algorithm does a fuzzy match to find the target locations in translated text to apply annotations. Here also content given to MT engines is plain text only.
The steps are given below.
For the text to translate, find the text of inline annotations like bold, italics, links etc. We call it subsequences.
Pass the full text and subsequences to the plain text machine translation engine. Use some delimiter so that we can do the array mapping between source items(full text and subsequences) and translated items.
The translated full text will have the subsequences somewhere in the text. To locate the subsequence translation in full text translation, use an approximate search algorithm
The approximate search algorithm will return the start position of match and length of match. To that range we map the annotation from the source html.
The approximate match involves calculating the edit distance between words in translated full text and translated subsequence. It is not strings being searched, but ngrams with n=number of words in subsequence. Each word in ngram will be matched independently.
To understand this, let us try the algorithm in some example sentences.
Translating the Spanish sentence <p>Es <s>además</s> de Valencia.</p> to Catalan: The plain text version is Es además de Valencia.. And the subsequence with annotation is además . We give both the full text and subsequence to MT. The full text translation is A més de València.. and the word además is translated as a més. We do a search for a més in the full text translation. The search will be successfull and the <s> tag will be applied, resulting <p>És <s>a més</s> de València.</p>.The seach performed in this example is plain text exact search. But the following example illustrate why it cannot be an exact search.
Translating an English sentence <p>A <b>Japanese</b> <i>BBC</i> article</p> to Spanish. The full text translation of this is Un artículo de BBC japonés One of the subsequenceJapanese will get translated as Japonés. The case of J differs and search should be smart enough to identify japonés as a match for Japonés. The word order in source text and translation is already handled by the algorithm. The following example will illustrate that is not just case change that happens.
Translating <p>A <b>modern</b> Britain.</p> to Spanish. The plain text version get translated as Una Gran Bretaña moderna. and the word with annotation modern get translated as Moderno. We need a match for moderna and Moderno. We get <p>Una Gran Bretaña <b>moderna</b>.</p>. This is a case of word inflection. A single letter at the end of the word changes.
Now let us see an example where the subsequence is more than one word and the case of nested subsequences. Translating English sentence <p>The <b>big <i>red</i></b> dog</p> to Spanish. Here, the subsequnce Big red is in bold, and inside that, the red is in italics. In this case we need to translate the full text, sub sequence big red and red. So we have, El perro rojo grande as full translation, Rojo grande and Rojo as translations of sub sequences. Rojo grande need to be first located and bold tag should be applied. Then search for Rojo and apply Italic. Then we get <p>El perro <b><i>rojo</i> grande</b></p>.
How does it work with heavily inflected languages like Malayalam? Suppose we translate <p>I am from <a href=”x”>Kerala<a></p> to Malayalam. The plain text translation is ഞാന് കേരളത്തില് നിന്നാണു്. And the sub sequence Kerala get translated to കേരളം. So we need to match കേരളം and കേരളത്തില്. They differ by an edit distance of 7 and changes are at the end of the word. This shows that we will require language specific tailoring to satisfy a reasonable output.
The algorithm to do an approximate string match can be a simple levenshtein distance , but what would be the acceptable edit distance? That must be configurable per language modules. And the following example illustrate that just doing an edit distance based matching wont work.
Translating <p>Los Budistas no <b>comer</b> carne</p> to English. Plain text translation is The Buddhists not eating meat.Comer translates as eat. With an edit distance approach, eat will match more with meat than eating. To address this kind of cases, we mix a second criteria that the words should start with same letter. So this also illustrate that the algorithm should have language specific modules.
Still there are cases that cannot be solved by the algorithm we mentioned above. Consider the following example
Translating <p>Bees <b>cannot</b> swim</p>. Plain text translation to Spanish is Las Abejas no pueden nadar and the phrase cannot translates as Puede no. Here we need to match Puede no andno pueden which of course wont match with the approach we explained so far.
To address this case, we do not consider sub sequence as a string, but an n-gram where n= number of words in the sequence. The fuzzy matching should be per word in the n-gram and should not be for the entire string. ie. Puede to be fuzzy matched with no and pueden, and no to be fuzzy matched wth no and pueden– left to right, till a match is found. This will take care of word order changes as welll as inflections
Revisiting the 4 type of errors that happen in annotation transfer, with the algorithm explained so far, we see that in worst case, we will miss annotations. There is no case of corrupted markup.
As and when ContentTranslation add more language support, language specific customization of above approach will be required.
You can see the algorithm in action by watching the video linked above. And here is a ascreenshot:
Credits: David Chan, my colleague at Wikimedia, for extensive help on providing lot of example sentences with varying complexity to fine tune the algorithm. The LinearDoc model that make the whole algorithm work is written by him. David also wrote an algorithm to handle the HTML translation using an upper casing algorithm, you can read it from here. The approximation based algorithm explained above replaced it.
Best Practices on the Design of Translation- Pau Giner, David Chan and Santhosh Thottingal.
Abstract: Wikipedia is one of the most multilingual projects on the web today. In order to provide access to knowledge to everyone, Wikipedia is available in more than 280 languages. However, the coverage of topics and detail varies from language to language. The Language Engineering team from the Wikimedia Foundation is building open source tools to facilitate the translation of content when creating new articles to facilitate the diffusion of quality content across languages. The translation process in Wikipedia presents many different challenges. Translation tools are aimed at making the translation processes more fluent by integrating different tools such as translation services, dictionaries, and information from semantic databases as Wikidata.org. In addition to the technical challenges, ensuring content quality is one of the most important aspects considered during the design of the tool since any translation that does not read natural is not acceptable for a community focused on content quality. This talk will cover the design (from both technical and user experience perspectives) of the translation tools, and their expected impact on Wikipedia and the Web as a whole.