Code Monkey home page Code Monkey logo

ubn2rbn's Introduction

uBN2rBN

This is a bookmarklet that converts Bengali text written in the usual Unicode Eastern nagari script (which we like to call uBN, for Unicode Bengali) to a romanized version following a "standard" we like to call Romaji-Bangla (or rBN).

If a system is incapable of displaying Unicode Bengali, or if a person is more comfortable with or just wants to read romanized Bengali, this bookmarklet can help.

Use

Visit the demo page and drag the link to your bookmarks toolbar or folder. Then invoke that bookmark while a page you wish to convert is open.

Caveats

The actual code is separated from the bookmarklet-link, and as such, it only works online.

This was the authors' first bookmarklet, and hence is guaranteed to be...inelegant, at the very least.

Limitations

Bengali is a rather phonetically complex language, and not particularly consistent. And as such, there are many words that are pronounced differently than their spelling. The only way to alleviate this is to build a dictionary of common inconsistencies. The bookmarklet allows that, but does not yet contain one such dictionary.

Licence

Copyright (C) 2012 Sayantan Chaudhuri, Anamitra Saha

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ubn2rbn's People

Contributors

5310 avatar onnyyonn avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

onnyyonn

ubn2rbn's Issues

'য্য-ফলা' transliterates to 'j' instead of 'y'.

'য্য-ফলা' is written as '্য', which is included into the char-map on virtue or appearing to be a single character. But in reality, it is two characters, not a ligature by default.

This is why when converting words such as 'মধ্যে', the 'য' is converted to 'j' first, as it appears before '্য' in the map.

The proper way to fix this would be to include '্য' in the comp-map, along with all such mappings which are more than one letter.

All Vowel-mix-ins also fall into this category, but they are ligatures, which is why they work. Perhaps we should let them be.

But that's not all, folks: #7 (comment)

Update demo.

The demo should have some minimal instruction like "drag the above text to our bookmark-bar."

The demo should also have a tag for Github, and a link-back to the repo.

@font-face Unicode subsetting works, but by the lines.

Subsetting works, but instead of only styling the glyphs falling under the Bengali group, it styles any line with Bengali text, including any English ones, while leaving the others clear.

Tested only in Chrome, and only from the locally installed font.

Unmodified consonants inside words only translate to 'ô'.

Most unmodified consonants are indeed pronounced with 'ô', but some are unvoiced.

@Oni64 has actually worked very thoroughly on this issue. While he has come up with an model that works for a lot of cases, it has a much lower adherence/exception ratio than the word-ending one.

The only reliable way to solve that problem would be to include a respectable phrase-map. Procedurally, this has already been implemented, but the phrase-map does have such width.

We have decided to not try to solve this by algorithm after all. And will look into whether a useful phrase-map can be built without too much bloat. Or we could leave things as is, since it's already quite readable.

WrapSelection plugin has been added, but is not being used.

To be honest, I can't get it to work.

The desired behavior is to try and convert the selected text; if there is no selected text, then convert the entire page (or text-area, if it is one.)

But I just can't get wrapSelection to work, even during test. I must be doing something obvious wrong, so I'll look into it. But if I still can't get it to work, I will probably do it the old-fashioned way...

The ় glyph is treated individually.

All characters that are a composite of a plain character and the dot-glyph (়) are parsed individually instead of by the ligature.

So far, I've only noticed to 'য়' behave like it's 'য+়'

Word-end consonants are not ending with ্ when required.

@Oni64 has already solved the issue of whether to append a ্ to a word-endning unmodified consonant with absolute minimum of exceptions.

But I can't seem to implement it inside the 'let.

This jsFiddle works perfectly well. It only adds the ending ্, but does not romanize, of course. But the same thing does not work inside the bookmarklet.

Furthermore, since complex regex as string is quite annoying to make with the RegExp() constructor, I'm not using the usual method of creating a dictionary, instead, appending the text manually. Which is acceptable, but was worth mentioning.

Add a notification while the bookmarklet loads/works.

Currently, there's a very noticeable pause between the invocation of the bookmarklet (link) and actual change.

People, myself included, often think that the bookmarklet is broken, or not loading.

A simple notification, a throbber, or a notice, will be very helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.