Lingua::SA - Perl extension for the language Sanskrit
use Lingua::SA qw(transliterate vibhakti sandhi);
print transliterate("raamaH");
# outputs: रामः
The module exports functions to (1) Obtain declinations of Sanskrit nouns (2) Convert Roman into Unicode Sanskrit
print vibhakti({naam=>"raama", vibhakti=>"prathamA", linga=>"puM", vachana=>"ekavachana"}),"\n";
# outputs: rAm + aH
print sandhi(vibhakti({naam=>"raama", vibhakti=>"prathamA", linga=>"puM", vachana=>"ekavachana"})),"\n";
# outputs: rAmaH
print transliterate(sandhi(vibhakti({naam=>"raama", vibhakti=>"prathamA", linga=>"puM", vachana=>"ekavachana"}))),"\n";
or,
print transliterate(sandhi(vibhakti({naam=>"raama", vibhakti=>1, linga=>1, vachana=>1}))),"\n";
None by default.
The module optionally exports three functions:
(1) transliterate: This takes roman text as input and depicts it in UNICODE devanAgarI. The character set used is that of Sanskrit. Ideal for use in cgi scripts.
(2) vibhakti: This returns the declinations of nouns. Takes as input a noun (naam), a case (vibhakti), a gender (linga) and number/plurality (vachana) and returns the corresponding declination if the inputs are valid.
The vibhakti has to be one of: prathamA dvitIyA tRutIyA chaturthI paJchamI ShaShThI saptamI sambodhana Alternately, the numbers 1 through 8 are also allowed.
The vachana has to be one of: ekavachana dvivachana bahuvachana or 1 2 3
The linga has to be one of: puM strI napuMsaka or 1 2 3
The naam has to end in one of: a A i I u U R (aa, ii, uu are internally converted to A, I, U respectively). Other endings not supported yet.
(3) sandhi: Merely "straightens" the output by doing a few minor operations to make it look more like a proper "word". In particular, it removes ' + ' from the "word + inflection" combinations. It also replaces aa with A, ii with I and uu with U.
Currently write-only mailing list for feedback: http://groups.google.com/group/sanskrit-module-feedback
You can see the module in operation through various cgi-bin links at: http://www.astro.caltech.edu/~aam/sanskrit You will also find there links to other Sanskrit resources including some from which I have borrowed. You will also find there the transliteration mapping used.
Ashish Mahabal, <mahabal.ashish@gmail.com>
Copyright (C) 2008 by Ashish Mahabal
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install Lingua::SA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::SA
CPAN shell
perl -MCPAN -e shell install Lingua::SA
For more information on module installation, please visit the detailed CPAN module installation guide.