For those who like to feel they are helping the world, this may be a tangible opportunity. I have done some research on the Perl packages for handling Thai or Lao languages (which are similar, but with separate unicode code points), and found none which will properly classify the characters in the language. The only classes identified are to determine if a particular character is in that language, as in:

\p{InThai} | \p{InLao}

However, these languages have, for example, three classes of consonants: high, middle, and low. These classes, in conjunction with tone marks, determine the tone of each syllable, and play an important role in determining the boundaries for words and syllables (these languages do not space-delimit words).

The unicode documentation I found on some of the packages on CPAN mentioned that the programmers did not know Thai, and could not, therefore, do much of usefulness with it.

I'm trying to create, then, a set of classes for these characters, but have never created a perl package before, only used them. The Perl book I have was vague in how to define the subroutines for this, and has left me confused.

I'm not asking for anyone to create the package. I only ask for someone to point me in the right direction. If we were to assume that x = high class, y = low class, and z = middle class, could anyone give me an example of how I might make a package that could be used something like this:

use Thai;

$line =~ m/\p{ThaiHighClass}\p{ThaiLowClass}/;

Naturally, I would like to define much more than consonant classes for these languages, but if I could do just this much, the rest would be easy to add.

Help will be much appreciated, and success may mean an addition to CPAN.

Blessings,

Polyglot


In reply to Creating new character classes for foreign languages by Polyglot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.