Difference between revisions of "User:Mono/GSoC 2017"

From Apertium
Jump to navigation Jump to search
 
(18 intermediate revisions by one other user not shown)
Line 7: Line 7:
== Webpage Translation mode ==
== Webpage Translation mode ==


An interface that lets the user to input a URL, choose a source and a destination language and translate the webpage.
An interface that lets the user to input a URL, choose a source language and a destination language and translate the webpage. This feature has been successfully completed as a part of my GSoC project! Both the frontend as well as the backend for this feature have been merged into the main project.


=== Code ===
=== Code ===
Line 13: Line 13:
==== Backend ====
==== Backend ====


* https://github.com/goavki/apertium-apy/commit/1f0642858ad82c6666c1b92bea1f5f65bf150c41
* https://github.com/apertium/apertium-apy/commit/1f0642858ad82c6666c1b92bea1f5f65bf150c41


==== Frontend ====
==== Frontend ====


* https://github.com/goavki/apertium-html-tools/pull/154
* https://github.com/apertium/apertium-html-tools/pull/154
* https://github.com/goavki/apertium-html-tools/pull/202
* https://github.com/apertium/apertium-html-tools/pull/202
* https://github.com/goavki/apertium-html-tools/pull/205
* https://github.com/apertium/apertium-html-tools/pull/205
* https://github.com/apertium/apertium-html-tools/pull/208 (The merged PR)


=== Documentation ===
=== Documentation ===
Line 50: Line 51:


* <code>translation lookup</code> turns on webpage translation mode.
* <code>translation lookup</code> turns on webpage translation mode.

The backend for this mode is merged through [https://github.com/apertium/apertium-apy/commit/1f0642858ad82c6666c1b92bea1f5f65bf150c41 this commit]. The frontend for this project is merged through [https://github.com/apertium/apertium-html-tools/pull/208 this PR] The screenshot of the current state of interface can be found [https://drive.google.com/open?id=0BwrSYlOsMCyWVDJ3YVdZRWdpQ2c here]. <br/>


=== Future Work ===
=== Future Work ===


Make use of a form handler while submitting the URL links for translation. The related issues are in [https://github.com/apertium/apertium-html-tools/pull/202#issuecomment-324234047 this comment].
1. The backend for this mode is merged through [https://github.com/goavki/apertium-apy/commit/1f0642858ad82c6666c1b92bea1f5f65bf150c41 this commit]. The screenshot of the current state of interface can be found [http://www.example.com here]. <br/>
2. The interface is pretty much functional. However, a future task is to make use of a form handler while submitting the URL links for translation. The related issues are in [https://github.com/goavki/apertium-html-tools/pull/202#issuecomment-324234047 this comment].




Line 65: Line 67:
==== Backend ====
==== Backend ====


* https://github.com/goavki/apertium-apy/pull/59
* https://github.com/apertium/apertium-apy/pull/59


==== Frontend ====
==== Frontend ====


* https://github.com/goavki/apertium-html-tools/pull/176
* https://github.com/apertium/apertium-html-tools/pull/176


=== Documentation ===
=== Documentation ===
Line 102: Line 104:


* <code>speller</code> turns on spell checking mode.
* <code>speller</code> turns on spell checking mode.

The screenshot of the current state of interface can be found [https://drive.google.com/open?id=0BwrSYlOsMCyWdkFCWklUaF8tMms here]. <br/>


=== Future Work ===
=== Future Work ===


Improving the logic of mapping the suggestions returned from the backend for the tokens appropriately to the corresponding text on the frontend.
1. The screenshot of the current state of interface can be found [http://www.example.com here]. <br/>
2. Improving the logic of mapping the suggestions returned from the backend for the tokens appropriately to the corresponding text on the frontend.




Line 118: Line 121:
==== Backend ====
==== Backend ====


* https://github.com/goavki/apertium-apy/pull/61
* https://github.com/apertium/apertium-apy/pull/61


==== Frontend ====
==== Frontend ====


* https://github.com/goavki/apertium-html-tools/pull/184
* https://github.com/apertium/apertium-html-tools/pull/184


=== Documentation ===
=== Documentation ===
Line 153: Line 156:


* <code>translation lookup</code> turns on dictionary lookup mode.
* <code>translation lookup</code> turns on dictionary lookup mode.

The screenshot of the current state of interface can be found [https://drive.google.com/open?id=0BwrSYlOsMCyWSEIzOXFGZnpLbHM here]. <br/>

=== Future Work ===

The pending tasks with respect to dictionary lookup mode are discussed in [https://github.com/apertium/apertium-html-tools/pull/184#issuecomment-323597780 this comment].


== Suggestions Interface ==

An interface that lets the user insert suggestions on the wiki page.

=== Code ===

==== Frontend ====

* https://github.com/share-with-me/apertium-html-tools/tree/gsoc-mono-suggestions-interface

==== Backend ====

* https://github.com/share-with-me/apertium-apy/tree/gsoc-suggestions-interface


=== Future Work ===
=== Future Work ===


This feature had just began. Focus was first put on completing the above 3 features before progressing on this one. Thus, there is no documentation on this feature as a part of my project. The future tasks for this feature would involve enhancing both the frontend as well as the backend code, testing the functionality and then creating a pull request for the same.
1. The screenshot of the current state of interface can be found [http://www.example.com here]. <br/>
2. The pending tasks with respect to dictionary lookup mode are discussed in [https://github.com/goavki/apertium-html-tools/pull/184#issuecomment-323597780 this comment].




Line 163: Line 186:


1. A notification that appears when the requests made to the APy take more than a threshold time. <br/>
1. A notification that appears when the requests made to the APy take more than a threshold time. <br/>
2. This notification also appears when a cumulative average of the requests duration exceeds a certain threshold indicating that the servers may be overloaded in that particular time phase and thus, one could set the APy locally too.
2. This notification also appears when an average of the duration of requests exceeds a certain threshold indicating that the servers may be overloaded in that particular time phase and thus, one could set the APy locally too. <br/>
3. At any point, we maintain a queue of duration of requests with a certain maximum size. If the size of the queue exceeds this threshold, we dequeue a duration and enqueue the duration of the latest request. This ensures a moving average and helps determine if the load on the server has reduced.


=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/662a48b4858f4e731e454a5547f6a9e76c3c96f8
* https://github.com/apertium/apertium-html-tools/commit/662a48b4858f4e731e454a5547f6a9e76c3c96f8


1. An issue that was observed here was, if an AJAX request is made which is not handled through callApy(), it used to take up the apyRequestStartTime value of the previously executed callApy call, execute handleApyRequestCompletion() in ajaxComplete() and thus, that difference being greater than the threshold, installation notification was always shown.<br/>
1. An issue that was observed here was, a variable ''apyRequestStartTime'' stored the timestamp when an AJAX request is made through callApy method. This variable was not cleared after the execution of request. Thus, if an AJAX request is made which is not handled through callApy(), on completion, it used up the start timestamp of the previous request and thus, the difference between the timestamp at which the request completes and the previous start timestamp almost always exceeded the threshold. This erroneously displayed the notification. <br/>
2. The following patch resolved the above issue.
The following patch resolved the above issue.


=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/1c69465cf17fe0028e2b075e90db34c08efba196
* https://github.com/apertium/apertium-html-tools/commit/1c69465cf17fe0028e2b075e90db34c08efba196




Line 185: Line 209:
=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/d40162f4c134c2b168d7f28627606d3ac7c58630
* https://github.com/apertium/apertium-html-tools/commit/d40162f4c134c2b168d7f28627606d3ac7c58630




== Language Dropdown going offscreen Issue ==
== Language Dropdown going offscreen Issue ==


1. The language dropdown used to go offscreen when the browser window size was adjusted. This would obstruct the user from choosing the language of his choice. <br/>
1. The language dropdowns of the source languages and the destination languages used to go off-screen when the browser window size was adjusted. This would obstruct the user from choosing the language of his choice. <br/>
2. This issue was fixed by dynamically determining the available space on the browser window (triggered on resize) and adjusting the number of columns to fit the languages inside the viewport.
2. This issue was fixed by dynamically determining the available space on the browser window (triggered on resize) and adjusting the number of columns to fit the languages inside the viewport.


=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/b2dc0caeecd6de9dcbf855d32aa1386b5d75d233
* https://github.com/apertium/apertium-html-tools/commit/b2dc0caeecd6de9dcbf855d32aa1386b5d75d233




== LTR/RTL alignment of languages in dropdown ==
== LTR/RTL alignment of languages in dropdown ==


1. Inspite of setting the left-to-right or right-to-left orientation for the language display names, the browser did not render it in the expected manner. <br/>
1. Inspite of setting a left-to-right or right-to-left orientation for the language display names, the browser did not render it in the expected manner. <br/>
2. A patch was created which applied the necessary styling to the display names along with the styling of other associated UI elements to achieve the right rendering.
2. A patch was created which applied the necessary styling to the display names along with the styling of other associated UI elements to achieve the right rendering.


=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/pull/159
* https://github.com/apertium/apertium-html-tools/pull/159




== Interface breaks when cookies disabled ==
== Interface breaks when cookies are disabled issue ==


1. The Apertium interface used to break when the cookies were disabled. <br/>
1. The Apertium interface used to break when the cookies were disabled. <br/>
2. This was because the interface used to interact with the localStorage of the browser and when the cookies were disabled, this interaction was prohibited by the browser. This was unhandled in the code. <br/>
2. This was because the interface used to interact with the localStorage of the browser and when the cookies were disabled, this interaction was prohibited by the browser. This was not handled in the code. <br/>
3. The issue was resolved by handling the exception that occurs when the cookies were disabled.
3. The issue was resolved by handling the exception that occurs when the cookies were disabled.


=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/07d96a23162d4b4e8e772d8fc0f2d5b5f411973b
* https://github.com/apertium/apertium-html-tools/commit/07d96a23162d4b4e8e772d8fc0f2d5b5f411973b




== Improve detectLanguage() functionality ==
== Improve detectLanguage() functionality ==


1. This method did not call the autoDstSelectLang() method to detect a destination language automatically after the langauge for a given text was identified. <br/>
1. The ''detectLanguage()'' method did not call the ''autoDstSelectLang()'' method to detect a destination language automatically after the langauge for a given text was identified. <br/>


=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/ec1e1ace75db0d55ca5c443309eda81dc8301e35
* https://github.com/apertium/apertium-html-tools/commit/ec1e1ace75db0d55ca5c443309eda81dc8301e35



== Prevent the requests when input is empty ==
== Prevent the requests when input is empty ==


1. The handlers on the backend gave a server error when the requests were made with empty inputs or if any of the necessary arguments were missing. <br/>
1. The handlers on the backend gave an internal server error when the requests were made with empty inputs or if any of the necessary arguments were missing. <br/>
2. This validation was added for a lot of functionalities such as that of Analyzer, Generator, Detect Language, APy Sandbox.
2. This validation was added for a lot of functionalities such as that of Analyzer, Generator, Detect Language, APy Sandbox.


=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/f274430c648a9d2fabb5b76f88a226420f14449f
* https://github.com/apertium/apertium-html-tools/commit/f274430c648a9d2fabb5b76f88a226420f14449f
* https://github.com/goavki/apertium-html-tools/commit/928f43a205355549580174bc37bcbdb3b5cd29e8
* https://github.com/apertium/apertium-html-tools/commit/928f43a205355549580174bc37bcbdb3b5cd29e8
* https://github.com/goavki/apertium-html-tools/commit/e8fa8dc755a065a1f568ee52a38cd01f1fd0188d
* https://github.com/apertium/apertium-html-tools/commit/e8fa8dc755a065a1f568ee52a38cd01f1fd0188d
* https://github.com/goavki/apertium-html-tools/commit/2518e5042da41bc1007f586569c8bd31d79eb63a
* https://github.com/apertium/apertium-html-tools/commit/2518e5042da41bc1007f586569c8bd31d79eb63a
* https://github.com/apertium/apertium-html-tools/commit/50f4a701e1d0bc2e986ca3c500d6909ee54322f3



== Improvement of Functionalities ==
== Improvement of Functionalities ==


1. The ''swap'' button did not swap the source and destination language on smaller screens. <br/>
1. The ''swap'' button did not swap the source language and destination language on smaller screens. <br/>
2. The ''translate'' button did not call the translate() method on smaller screens. <br/>
2. The ''translate'' button did not call the translate() method on smaller screens. <br/>
3. The ''Detect Language'' button was active on docTranslation interface whereas the detection it used to perform was for the input text in translateText interface. <br/>
3. The ''Detect Language'' button was active on docTranslation interface whereas the detection it used to perform was for the input text on translateText interface. <br/>
4. Calling appropriate translate() method based on the interface on which it is called. <br/>
4. Calling appropriate translate() method based on the interface on which it is called. <br/>
5. Fixing the container animation issues. When the interface was switched between containers rapidly, the animation used to break and it would render a blank screen. <br/>
5. Fixing the container animation issues. When the interface was switched between containers rapidly, the animation used to break and it would render a blank screen. <br/>
6. The language selectors used to overlap with the swap button for a certain set of recent source languages. <br/>
6. The language selectors used to overlap with the ''swap'' button for a certain set of recent source languages. <br/>
7. Adding a button that takes the user to the top of the webpage. <br/>
7. Adding a button that takes the user to the top of the webpage. <br/>
8. APY -> APy stylization. <br/>
8. APY to APy stylizations. <br/>
9. Alignment of Translate, Analyze and Request buttons with their respective textareas on the interface. <br/>
9. Alignment of Translate, Analyze and Request buttons with their respective textareas on the interface. <br/>
10. Execute translate() method as soon as any of source or destination languages is changed. (so that it executes even on docTranslation interface) <br/>
10. Execute translate() method as soon as any of source languages or destination languages is changed. (so that it executes even on docTranslation interface) <br/>
11. The above issues were resolved through following patches:
The above issues were resolved through following patches:




Line 257: Line 284:
=== Code ===
=== Code ===


* https://github.com/goavki/apertium-html-tools/commit/1859e7c2db9d46a7237c2117c39d2130df7305f5
* https://github.com/apertium/apertium-html-tools/commit/1859e7c2db9d46a7237c2117c39d2130df7305f5
* https://github.com/goavki/apertium-html-tools/commit/5e1d43117ed5f05b11092099e70cdd474c2348e1
* https://github.com/apertium/apertium-html-tools/commit/5e1d43117ed5f05b11092099e70cdd474c2348e1
* https://github.com/goavki/apertium-html-tools/commit/daee7bd9989cd8030a79907a7b39e00a1343580b
* https://github.com/apertium/apertium-html-tools/commit/daee7bd9989cd8030a79907a7b39e00a1343580b
* https://github.com/goavki/apertium-html-tools/commit/86034c308835059eed0407b83a94f0599dfe4cb5
* https://github.com/apertium/apertium-html-tools/commit/86034c308835059eed0407b83a94f0599dfe4cb5
* https://github.com/goavki/apertium-html-tools/commit/26c02d5f7fd608265157bc0022b8cf056cc8c59c
* https://github.com/apertium/apertium-html-tools/commit/26c02d5f7fd608265157bc0022b8cf056cc8c59c
* https://github.com/goavki/apertium-html-tools/commit/e6955c7778c651e55c9ce6acb1d44effd7d6d2b1
* https://github.com/apertium/apertium-html-tools/commit/e6955c7778c651e55c9ce6acb1d44effd7d6d2b1
* https://github.com/goavki/apertium-html-tools/commit/4218f48b7b2a15647989558c7a39970fcc158705
* https://github.com/apertium/apertium-html-tools/commit/4218f48b7b2a15647989558c7a39970fcc158705
* https://github.com/goavki/apertium-html-tools/commit/203de5af21bcd60810592e394ac2de589bdc78ea
* https://github.com/apertium/apertium-html-tools/commit/203de5af21bcd60810592e394ac2de589bdc78ea
* https://github.com/goavki/apertium-html-tools/commit/5e8cb605007fbf28a09ff1ab5479d9222b8cb21c
* https://github.com/apertium/apertium-html-tools/commit/5e8cb605007fbf28a09ff1ab5479d9222b8cb21c
* https://github.com/goavki/apertium-html-tools/commit/28c923c93971f428c075fd8c67e75dd9656d814f
* https://github.com/apertium/apertium-html-tools/commit/28c923c93971f428c075fd8c67e75dd9656d814f


== Miscellaneous Issues ==

1. Mark unknown checkbox to be sent with ''docTranslation'' interface. <br/>
2. Textarea sizes getting restored on page resize. <br/>
Pull requests have been created to solve the above issues.


=== Code ===

* https://github.com/apertium/apertium-html-tools/pull/180
* https://github.com/apertium/apertium-html-tools/pull/152




== Important Links ==
== Important Links ==



The following are the important links with regards to this project: <br/>
1. Apertium Wiki
1. Apertium Wiki
* [http://wiki.apertium.org http://wiki.apertium.org]
* [http://wiki.apertium.org http://wiki.apertium.org]
Line 276: Line 318:
* [https://www.apertium.org https://www.apertium.org]
* [https://www.apertium.org https://www.apertium.org]
3. Aperium html-tools github
3. Aperium html-tools github
* [https://github.com/goavki/apertium-html-tools https://github.com/goavki/apertium-html-tools]
* [https://github.com/apertium/apertium-html-tools https://github.com/apertium/apertium-html-tools]
4. Apertium APy github
4. Apertium APy github
* [https://github.com/goavki/apertium-apy https://github.com/goavki/apertium-apy]
* [https://github.com/apertium/apertium-apy https://github.com/apertium/apertium-apy]
5. Apertium html-tools forked repo github
5. Apertium html-tools forked repo github
* [https://github.com/share-with-me/apertium-html-tools https://github.com/share-with-me/apertium-html-tools]
* [https://github.com/share-with-me/apertium-html-tools https://github.com/share-with-me/apertium-html-tools]
Line 285: Line 327:
7. Commits to master (pull requests that got merged): <br/>
7. Commits to master (pull requests that got merged): <br/>
Frontend: <br/>
Frontend: <br/>
* [https://github.com/goavki/apertium-html-tools/commits/master?author=share-with-me https://github.com/goavki/apertium-html-tools/commits/master?author=share-with-me]
* [https://github.com/apertium/apertium-html-tools/commits/master?author=share-with-me https://github.com/apertium/apertium-html-tools/commits/master?author=share-with-me]
Backend: <br/>
Backend: <br/>
* [https://github.com/goavki/apertium-apy/commits/master?author=share-with-me https://github.com/goavki/apertium-apy/commits/master?author=share-with-me]
* [https://github.com/apertium/apertium-apy/commits/master?author=share-with-me https://github.com/apertium/apertium-apy/commits/master?author=share-with-me]
8. Issues opened by me: <br/>
8. Issues opened by me: <br/>
Frontend: <br/>
Frontend: <br/>
* [https://github.com/goavki/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aopen https://github.com/goavki/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aopen]
* [https://github.com/apertium/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aopen https://github.com/apertium/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aopen]
* [https://github.com/goavki/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aclosed https://github.com/goavki/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aclosed]<br/>
* [https://github.com/apertium/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aclosed https://github.com/apertium/apertium-html-tools/issues?q=is%3Aissue+author%3Ashare-with-me+is%3Aclosed]<br/>
Backend: <br/>
Backend: <br/>
* [https://github.com/goavki/apertium-apy/issues/created_by/share-with-me https://github.com/goavki/apertium-apy/issues/created_by/share-with-me]
* [https://github.com/apertium/apertium-apy/issues/created_by/share-with-me https://github.com/apertium/apertium-apy/issues/created_by/share-with-me]
9. Pull requests by me: <br/>
9. Pull requests by me: <br/>
Frontend: <br/>
Frontend: <br/>
* https://github.com/goavki/apertium-html-tools/pulls/share-with-me
* https://github.com/apertium/apertium-html-tools/pulls/share-with-me
* https://github.com/goavki/apertium-html-tools/issues?q=is%3Apr+author%3Ashare-with-me+is%3Aclosed
* https://github.com/apertium/apertium-html-tools/issues?q=is%3Apr+author%3Ashare-with-me+is%3Aclosed
Backend: <br/>
Backend: <br/>
* https://github.com/goavki/apertium-apy/pulls/share-with-me
* https://github.com/apertium/apertium-apy/pulls/share-with-me
* https://github.com/goavki/apertium-apy/pulls?q=is%3Apr+author%3Ashare-with-me+is%3Aclosed
* https://github.com/apertium/apertium-apy/pulls?q=is%3Apr+author%3Ashare-with-me+is%3Aclosed

Latest revision as of 01:40, 8 March 2018

Apertium is a free/open-source platform for rule-based machine translation and language technology which is aimed providing support for lesser-resourced and marginalized languages. The current interface of Apertium is already pretty awesome. However, adding a few more functionalities such as webpage translation, spellchecker interface and the dictionary lookup feature would make this platform even more awesome. My GSoC project has revolved around implementing these features along with making the interface more robust.

I would like to thank my mentors Sushain, Jonathan, Xavivars, Unhammer, TinoDidriksen and the entire Apertium community for helping and guiding me throughout the course of this project. All that was accomplished wouldn't have been remotely possible without the support of my mentors. I would also thank Google Summer of Code community to provide me with the platform where I could learn and build my skillset and quench my thirst for open source contribution.

The further part of the wiki mentions about the work I have accomplished during the period of GSoC 2017.

Webpage Translation mode[edit]

An interface that lets the user to input a URL, choose a source language and a destination language and translate the webpage. This feature has been successfully completed as a part of my GSoC project! Both the frontend as well as the backend for this feature have been merged into the main project.

Code[edit]

Backend[edit]

Frontend[edit]

Documentation[edit]

Backend[edit]

URL Function Parameters Output
/translatePage Translates a webpage
  • langpair: language pair to use for translation
  • url: url of webpage that has to be translated
Returns the translated webpage
curl -Ss 'http://localhost:2737/translatePage?langpair=eng|spa&url=http://facebook.com'

output

Frontend[edit]

ENABLED_MODES: an array of the enabled interfaces, a non-empty subset of ['translation', 'analyzation', 'generation', 'sandbox']

  • translation lookup turns on webpage translation mode.

The backend for this mode is merged through this commit. The frontend for this project is merged through this PR The screenshot of the current state of interface can be found here.

Future Work[edit]

Make use of a form handler while submitting the URL links for translation. The related issues are in this comment.


SpellChecker mode[edit]

Checks for the spelling of input text for a given language and suggests alternatives if the spelling is wrong.

Code[edit]

Backend[edit]

Frontend[edit]

Documentation[edit]

Backend[edit]

URL Function Parameters Output
/speller Performs spellchecking on a given text for a given language
  • lang: language to perform spellchecking for
  • q: text to perform spellchecking on
Returns the spellchecking results
curl -Ss 'http://localhost:2737/speller?lang=hin&q=माय' | ascii2uni -a U -q

[{"sugg": [["काय", "1.000000"], ["चाय", "1.000000"], ["राय", "1.000000"], ["हाय", "1.000000"], ["साय", "1.000000"], ["मा", "1.000000"], ["वाय", "1.000000"], ["दाय", "1.000000"], ["गाय", "1.000000"], ["जाय", "1.000000"]], "known": false, "token": "माय"}]

Frontend[edit]

ENABLED_MODES: an array of the enabled interfaces, a non-empty subset of ['translation', 'analyzation', 'generation', 'sandbox', 'speller']

  • speller turns on spell checking mode.

The screenshot of the current state of interface can be found here.

Future Work[edit]

Improving the logic of mapping the suggestions returned from the backend for the tokens appropriately to the corresponding text on the frontend.


Dictionary Lookup mode[edit]

An interface that generates all forms of a given word. It renders the definitions of a given word for a given language pair after translating them.

Code[edit]

Backend[edit]

Frontend[edit]

Documentation[edit]

Backend[edit]

URL Function Parameters Output
/dictionaryLookup Generate dictionary forms of a given word
  • langpair: language pair to use for translation
  • q: word to perform dictionary lookup on
Returns the possible forms of after translation
curl -Ss 'http://localhost:2737/dictionaryLookup?langpair=eng|spa&q=light'
{"vblex": ["encender", "iluminar"], "n": ["luz"], "adj": ["ligero", "claro"]}

Frontend[edit]

ENABLED_MODES: an array of the enabled interfaces, a non-empty subset of ['translation', 'analyzation', 'generation', 'sandbox']

  • translation lookup turns on dictionary lookup mode.

The screenshot of the current state of interface can be found here.

Future Work[edit]

The pending tasks with respect to dictionary lookup mode are discussed in this comment.


Suggestions Interface[edit]

An interface that lets the user insert suggestions on the wiki page.

Code[edit]

Frontend[edit]

Backend[edit]

Future Work[edit]

This feature had just began. Focus was first put on completing the above 3 features before progressing on this one. Thus, there is no documentation on this feature as a part of my project. The future tasks for this feature would involve enhancing both the frontend as well as the backend code, testing the functionality and then creating a pull request for the same.


Installation Notification[edit]

1. A notification that appears when the requests made to the APy take more than a threshold time.
2. This notification also appears when an average of the duration of requests exceeds a certain threshold indicating that the servers may be overloaded in that particular time phase and thus, one could set the APy locally too.
3. At any point, we maintain a queue of duration of requests with a certain maximum size. If the size of the queue exceeds this threshold, we dequeue a duration and enqueue the duration of the latest request. This ensures a moving average and helps determine if the load on the server has reduced.

Code[edit]

1. An issue that was observed here was, a variable apyRequestStartTime stored the timestamp when an AJAX request is made through callApy method. This variable was not cleared after the execution of request. Thus, if an AJAX request is made which is not handled through callApy(), on completion, it used up the start timestamp of the previous request and thus, the difference between the timestamp at which the request completes and the previous start timestamp almost always exceeded the threshold. This erroneously displayed the notification.
The following patch resolved the above issue.

Code[edit]


POST v/s GET[edit]

1. Initially, the AJAX requests made use of GET method to retrieve data from the backend.
2. The GET method was used along with jsonp to allow cross domain requests. However, this gave a 414-request URI too large error when the input size was large and thus, resulted in failed requests.
3. This issue was resolved by making use of a POST method if the request size was beyond a threshold size, and a GET method otherwise.

Code[edit]


Language Dropdown going offscreen Issue[edit]

1. The language dropdowns of the source languages and the destination languages used to go off-screen when the browser window size was adjusted. This would obstruct the user from choosing the language of his choice.
2. This issue was fixed by dynamically determining the available space on the browser window (triggered on resize) and adjusting the number of columns to fit the languages inside the viewport.

Code[edit]


LTR/RTL alignment of languages in dropdown[edit]

1. Inspite of setting a left-to-right or right-to-left orientation for the language display names, the browser did not render it in the expected manner.
2. A patch was created which applied the necessary styling to the display names along with the styling of other associated UI elements to achieve the right rendering.

Code[edit]


Interface breaks when cookies are disabled issue[edit]

1. The Apertium interface used to break when the cookies were disabled.
2. This was because the interface used to interact with the localStorage of the browser and when the cookies were disabled, this interaction was prohibited by the browser. This was not handled in the code.
3. The issue was resolved by handling the exception that occurs when the cookies were disabled.

Code[edit]


Improve detectLanguage() functionality[edit]

1. The detectLanguage() method did not call the autoDstSelectLang() method to detect a destination language automatically after the langauge for a given text was identified.

Code[edit]


Prevent the requests when input is empty[edit]

1. The handlers on the backend gave an internal server error when the requests were made with empty inputs or if any of the necessary arguments were missing.
2. This validation was added for a lot of functionalities such as that of Analyzer, Generator, Detect Language, APy Sandbox.

Code[edit]


Improvement of Functionalities[edit]

1. The swap button did not swap the source language and destination language on smaller screens.
2. The translate button did not call the translate() method on smaller screens.
3. The Detect Language button was active on docTranslation interface whereas the detection it used to perform was for the input text on translateText interface.
4. Calling appropriate translate() method based on the interface on which it is called.
5. Fixing the container animation issues. When the interface was switched between containers rapidly, the animation used to break and it would render a blank screen.
6. The language selectors used to overlap with the swap button for a certain set of recent source languages.
7. Adding a button that takes the user to the top of the webpage.
8. APY to APy stylizations.
9. Alignment of Translate, Analyze and Request buttons with their respective textareas on the interface.
10. Execute translate() method as soon as any of source languages or destination languages is changed. (so that it executes even on docTranslation interface)
The above issues were resolved through following patches:


Code[edit]


Miscellaneous Issues[edit]

1. Mark unknown checkbox to be sent with docTranslation interface.
2. Textarea sizes getting restored on page resize.
Pull requests have been created to solve the above issues.


Code[edit]


Important Links[edit]

1. Apertium Wiki

2. Apertium Web Interface

3. Aperium html-tools github

4. Apertium APy github

5. Apertium html-tools forked repo github

6. Apertium APy forked repo github

7. Commits to master (pull requests that got merged):
Frontend:

Backend:

8. Issues opened by me:
Frontend:

Backend:

9. Pull requests by me:
Frontend:

Backend: