Showing posts with label indic. Show all posts
Showing posts with label indic. Show all posts

Saturday, September 7, 2013

Enabling Indic transliteration on web pages

Enable typing in Indian languages in web pages using Pramukh IME. This javascript library is very easy to integrate into your website, and supports 20 Indian languages.

Also, it is open source; so you can add new languages, or change the keyboard layout for existing ones.

Monday, February 7, 2011

Typing in Indic languages in Ubuntu using ITRANS

(For Ubuntu 10.04, see further below.)

Ubuntu 12.04

I found this tip that made things really easy. To summarize:
  • Install ibus-m17n.
  • Go to System Settings -> Language Support -> Keyboard input method system. Choose `ibus'. Close the dialog.
  • Click on Dash Home. Type ``ibus'' and click on the ``IBus'' icon that appears. A keyboard icon appears in the system tray (top right of screen).
  • Click on the keyboard icon -> Preferences -> Input Method -> Customize active input methods -> Select an input method -> (Now choose your language and input method). Click on Add. (Add as many as you want.) Close the Preferences dialog.
  • Open a new document in gedit. Click on the keyboard icon and select the input method (the default setting will be ``Input method Off'').
  • Start typing in your preferred language.

Ubuntu 10.04

To type in Indic languages in Ubuntu using ITRANS scheme, do the following
  • Go to synaptic; install
    • TrueType fonts for required language (search for language name, e.g. 'kannada')
    • SCIM
    • m17n
    • itrans
  • Run gedit
  • Right-click on editor. Select 'Input Methods' -> 'SCIM Input Method'. The SCIM icon (a keyboard) will appear in system tray (where date etc. are there).
  • Go to 'Kannada'-> 'kn-trans'. (Or to any other language)
  • Go back to editor and start typing in Indic using the ITRANS scheme (see below).

ITRANS Scheme (copied from here)

Vowels (dependent and independent):
-------
a     aa / A       i      ii / I       u     uu / U 
RRi / R^i    RRI / R^I    LLi / L^i    LLI / L^I
e     ai     o     au     aM    aH

Consonants:
----------- 
k     kh     g     gh     ~N
ch    Ch     j     jh     ~n
T     Th     D     Dh     N
t     th     d     dh     n
p     ph     b     bh     m
y     r      l     v / w
sh    Sh     s     h      L
x / kSh     GY / j~n / dny     shr
R (for marathi half-RA)
L / ld (marathi LLA)
Y (bengali)

Consonants with a nukta (dot) under them (mainly for Urdu devanagari):
-----------------------------------------
k  with a dot:      q
kh with a dot:      K
g  with a dot:      G
j  with a dot:      z / J
p  with a dot:      f
D  with a dot:      .D
Dh with a dot:      .Dh

Specials/Accents:
-----------------
Anusvara:       .n / M / .m  (dot on top of previous consonant/vowel)
Avagraha:       .a    (`S' like symbol basically to replace a after o)
Ardhachandra:   .c    (for vowel sound as in english words `cat' or `talk')
Chandra-Bindu:  .N    (chandra-bindu on top of previous letter)
Halant:  .h    (to get half-form of the consonant - no vowel - virama)
Visarga:        H     (visarga - looks like a colon character)
Om:  OM, AUM (Om symbol)


[As shown, many codes have multiple choices, example "RRi / R^i" implies you
 can use either "RRi" or "R^i"]

Friday, December 31, 2010

Using Unicode in Latex/Tex

To use Hindi Unicode, do the following -

In the .tex file include the line -
\font\texthi="Lohit Hindi:script=deva,mapping=tex-text" at 11pt.
(Remember to exclude the full stop at the end!)
Enter Hindi unicode text in the document as -
Some English text {\texthi हिन्दी...} more English text...
Compile the document using Xetex or XeLatex.

More information -

"texthi" is the name of the command we just defined to indicate Unicode text. You can give any other name, e.g. \font\abcd="...".

"Lohit Hindi" (remember the space between Lohit and Hindi) is the name of an Open Truetype Font (OTF) installed in the system. You can specify any other font that is installed. In Ubuntu, you can see what fonts are installed as follows -
Goto Main Taskbar -> System -> Preferences -> Appearance -> (Popup opens) -> Click 'Fonts' tab -> Try to change any of the fonts e.g. Application font. You get another popup where the fonts are listed under 'Family'. You can use any of these fonts instead of "Lohit Hindi".

"deva" is a tag that specifies which script (and hence which unicode range) should be used. Hindi uses the devanagari script. For other scripts, find out which script tag to use.

"mapping=tex-text" - I don't know what this. If you do, please tell me.

Thursday, February 4, 2010

Perl tips - Unicode

First, use Encode;

Reading/Writing
  • $string = Encode::decode('UTF-8',$text); (assuming the input file (or STDIN) is encoded in UTF-8).
  • You can now handle $string as you would normal strings (e.g. split(//) will split it at character boundaries)
  • Do $text = Encode::encode('UTF-8', $string); before writing it out to file (assuming you want the output file (or STDOUT) in that encoding).
Regex
  • \p{L} - full glyph (e.g. the letter 'A')
  • \p{M} - partial glyph (e.g. the accent ` on the letter 'A', giving 'À')
  • \p{N} - digit
  • \p{P} - punctuation
  • \p{kannada} - any Kannada character
  • \P{} - invert the condition
E.g. to match a line if it contains no numerals and no punctuation do
$line ~= m/\p{N}|\p{P}/