Transfer Pivot Translation in Apertium Shardul Chiplunkar for Google Code-In 2016

Transfer Pivot Translation in Apertium Shardul Chiplunkar for Google Code-In 2016

Transfer pivot translation in Apertium Shardul Chiplunkar for Google Code-In 2016 Keywords: rule-based machine translation (RBMT), pivot translation, Apertium, ScaleMT Abtract source and final target languages. For example2, Apertium does not have a direct translation system Rule-based machine translation (RBMT) systems from English (eng) to Portuguese (por), but with built with the Apertium platform produce high pivot translation, Spanish (spa) and Catalan (cat) quality translations, given extensive bilingual dic- can be used to translate tionaries and shallow-transfer lexical and structural eng → spa → por rules [1]. I implemented transfer pivot translation— eng → spa → cat → por translation using one or more languages as interme- diate (‘pivot’) translation targets without specially etc. as required. As Apertium is a rule-based plat- modifying the translations in the process (‘trans- form, transfer pivot translation—where no special fer’)—to extend the scope of possible translations modifications are made at any intermediate step—is with minimal additional effort. This paper discusses the easiest way to do this, as opposed to other com- the details of this work and its future implementa- mon approaches to pivot translation which involve tion prospects across Apertium’s API, web interface, statistical approaches. and IRC bot. I implemented transfer pivot translation in Aper- tium’s web API ‘apertium-apy’3 which is modeled on ScaleMT [3], and in the web interface ‘apertium- Introduction html-tools’4. The ScaleMT infrastructure uses parallel asynchronous pipelines for each translation Apertium is a free and open-source RBMT plat- pair, so the challenge was to ensure that a text being form which can build RBMT systems from bilingual translated is correctly passed through multiple such dictionaries and shallow transfer rules for lexical pipelines without slowing down the system. On the selection and structural transfer [1]. Apertium it- other hand, the challenge for the web interface was self has extensively developed some such systems, to create an intuitive interface to view and select such as among various Romance languages ([2] de- from possible pivot translations. I also developed scribes initial work), along with community-driven an interface to pivot translation for Apertium’s IRC systems such as for languages of the Turkic fam- bot begiak. 1 ily . Apart from the morphological analyzer/gener- The following sections of this paper describe, in ator and part-of-speech tagger that each language order, details of contributions to apertium-apy, requires, each language pair requires a bilingual apertium-html-tools, begiak, and possibilities dictionary to find equivalents of lexical forms, lex- for future work. ical selection rules to disambiguate analyses, and shallow-transfer rules to transfer syntactical struc- tures. While this produces high-quality translation Web API systems, these requirements are difficult to fulfill as apertium-apy is modeled after the ScaleMT ar- they must most often be written manually. chitecture for efficiency and scalability [3]. Each Pivot translation is a technique that can expand translation pair, e.g. eng → spa, has an associ- the scope of possible translations using one or more ated pipeline running independently of all other intermediate (‘pivot’) target languages between the 2This will be a running example throughout this paper. 1Outlined at http://wiki.apertium.org/wiki/ 3https://github.com/goavki/apertium-apy Apertium_Turkic#Publications. 4https://github.com/goavki/apertium-html-tools 1 pipelines. Pipelines initialize all required resour- ces when started and maintain them thereafter. Pipelines are started and stopped on various servers by a central router based on the quantity of re- quests and server load. The router also provides an outward-facing REST API with endpoints for func- tions such as translation, morphological analysis and generation, listing available pairs, calculating translation coverage, etc. Pivot translation requires passing the source lan- guage text into one of these pipelines, waiting for its output, then passing it into another pipeline, and so on until the text is obtained in the target lan- guage. However, as the pipelines run independently in parallel, care had to be taken to perform the entire operation asynchronously so as to not block the entire system or slow down individual pipelines with a pivot translation request. The crucial ele- ment that I wrote was a coreduce routine5, which takes a list of functions and the initial arguments as its arguments and asynchronously applies each Figure 1: Target languages for eng with and without function to the result of the previous function. pivot translation I developed two API endpoints6 to access this functionality. The first was translateChain which paths described in the previous paragraph. For ex- takes a list of languages, e.g. eng|spa|por, and a ample, Figure 1 shows that with eng as the source text in the source language eng, and gives the text language, the only direct translation targets are after performing the eng → spa → por translation. spa, cat, and a couple others, but the pivot targets It would be convenient if apertium-apy auto- include por too. matically chose pivot translation languages if only the source and target were provided. Thus, I im- plemented Dijkstra’s algorithm for finding shortest Web Interface paths between all possible language pairs on a par- ticular server, which are found and recorded by Preliminary changes to apertium-html-tools for the server at start-up for future use. Dijkstra’s pivot translation are shown in Figure 1. A check- algorithm was used in particular because of the pos- box was added to enable pivot translation along sibility of using weights for each direct translation with a link explaining what pivot translation is pair—currently, the weights are all equal and have (termed “multi-step translation” so that the func- no bearing on the path chosen—which is discussed tion is clearer from the name). If this checkbox in the ‘Summary and Future Work’ section. was checked, the dropdown and target language The second API endpoint was listPairs which selection bar, which would otherwise only enable already had modes to list direct pairs, analyzers/gen- direct targets, enabled targets that would require erators, and taggers. I added a mode to take a pivot translation to achieve. To actually perform source language and give all possible target lan- the pivot translation, apertium-html-tools would guages that could be obtained through pivot trans- use the API described previously. lation. This mode merely accesses the list of shortest However, this approach has a few shortcomings: it does not display the pivot translation path for 5Line 251 in in translation.py https://github.com/ a selected target language, or even its length for a goavki/apertium-apy/pull/43/files 6Documented at http://wiki.apertium.org/wiki/ rough measure of accuracy, and it does not allow User:Shardulc. the user to select custom pivot translation paths. I 2 is built using the force-directed graph provisions of the powerful JavaScript visualization library D3.js7. This means that the nodes repel each other and the arrows tend to maintain their length, while the source and target language nodes can be moved around by the user as wanted, making the whole interface dynamic and intuitive. Care was taken to ensure that the interface functions as expected on mobile devices as well. IRC Bot Apertium’s IRC bot begiak could already obtain direct translations using apertium-apy, so adding provisions for pivot translations—of course, per- formed on the API side—was not a difficult matter. However, I discovered a large number of malfunc- tioning or broken API-accessing commands in the process, and rewrote almost the entire module8 so that it could provide access to most, if not all, apertium-apy functions. In order to aid future development, I added docu- mentation for the new code and bot commands, and also created extensive unit tests9 for the module. Future Work Figure 2: Unselected pivot translation graph for eng → por and the same graph upon selecting cat An important possibility for future development is and spa nodes using the quality of direct translations to decide pivot translation paths. Absolute quality evalua- tions for a direct pair are not available and may built a graphical interface to remedy this which is not be practical, but estimates would make a great shown in Figure 2. difference for pivot translation. These estimates The user is presented with a directed graph of could be used as weights in the implementation of possible direct translations that can be used as pivot Dijkstra’s algorithm mentioned in the ‘Web API’ languages for the eng → por translation. The user section, could be served over the API, and could clicks to select pivot languages cat and spa, rep- be used to provide a visual representation of the resented as nodes, which then turn blue; all direct quality of direct translations and pivot paths in the translation pairs, represented as arrows, which are graphical interface in the ‘Web Interface’ section. part of some pivot path involving the selected lan- It is also possible that the weights are adjusted guages also turn blue. (In the figure, there is no depending on the text to be translated after deter- direct translation pair that does not involve spa mining translation coverage for that specific text, or cat, so there are no gray arrows.) If any paths but this appears to be very inefficient. involving only the selected languages exist, the ar- rows for the entire path turn green and the desired 7https://d3js.org/ 8 path can be selected from a ‘Valid Paths’ list. https://github.com/goavki/phenny/blob/master/ modules/apy.py The graph shown is already complex and needs 9https://github.com/goavki/phenny/blob/master/ to be movable and spread out to be of use.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us