[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
perl module for logical/visual Hebrew
Hi!
Once I needed to convert large volume of texts form logical hebrew to
visual (from word to readable format). I've implemented algorithm from the
Unicode book, and this seems to be working - as a Perl module. Now I've
cleaned it up a bit and I welcome anyone to take a look on it, to propose
improvements, to catch bugs and to tell me what's wrong with it.
The module is at http://sharat.co.il/frodo/Hebrew-0.1.tar.gz, weighting
about 3K. I can also mail it on request.
The thing seems to work for me, but I'm almost certain there are
some bugs or troubles that I've overlooked.
Seems that there's no such module on CPAN, so if (and when) everything is
OK, I'm going to send it there.
Below is the short doc for the module. Suggestions about the doc is
also very welcome.
---------------------------------------------------------------------
NAME
Hebrew - module for working with logical and visual hebrew
SYNOPSIS
use Hebrew;
$visual = log2vis_string($logical)
$vistext = log2vis_text($logtext)
$vistext = log2vis_text($logtext,$linelength)
$vistext = log2vis_text($logtext,$linelength,$start)
$vistext = log2vis_text($logtext,$linelength,$start,$end)
DESCRIPTION
This module is intended to automate task of converting logical
Hebrew to visual Hebrew.
log2vis_string STRING
This function converts it's argument from logical representaion
to visual (renders it like it should be printed).
log2vis_text STRING,LENGTH,START,END
This function allows to convert blocks of text, using
`log2vis_string'. All arguments except the first are optional.
LENGTH defines the maximal length of the resulting line, with
default of 80. START defines the text added before each line of
the resulting text. If START is undefined, the line is padded so
that the text is right-aligned. END defines what is added after
each line of text. Default is newline.
Example 1:
#!/usr/bin/perl
use Hebrew;
while(<>)
{
print log2vis_text($_);
}
This short program will convert any text in logical Hebrew to
readable visual Hebrew.
Example 2:
#!/usr/bin/perl
use Hebrew;
while(<>)
{
print log2vis_text($_,80,"<nobr>","</nobr><br>\n");
}
This example show how you can HTML-ize file in logical hebrew,
so that you can put it on the web page.
KNOWN BUGS
Bug reports are welcome.
AUTHOR
Stanislav Malyshev (frodo@sharat.co.il)
--
frodo@sharat.co.il \/ There shall be counsels taken
Stanislav Malyshev /\ Stronger than Morgul-spells
phone +972-2-6245112 /\ JRRT LotR.
http://sharat.co.il/frodo/ whois:!SM8333