summaryrefslogtreecommitdiffstats
path: root/payyans
diff options
context:
space:
mode:
Diffstat (limited to 'payyans')
-rwxr-xr-xpayyans/PKG-INFO2
-rwxr-xr-xpayyans/docs/ChangeLog6
-rwxr-xr-xpayyans/docs/README3
-rw-r--r--payyans/maps/ambili.map191
-rw-r--r--[-rwxr-xr-x]payyans/maps/indulekha.map0
-rw-r--r--[-rwxr-xr-x]payyans/maps/karthika.map0
-rwxr-xr-xpayyans/payyans/payyan.py70
-rwxr-xr-xpayyans/payyans/payyans5
-rwxr-xr-xpayyans/setup.py4
9 files changed, 253 insertions, 28 deletions
diff --git a/payyans/PKG-INFO b/payyans/PKG-INFO
index b9a5588..855a8c9 100755
--- a/payyans/PKG-INFO
+++ b/payyans/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: Payyans
-Version: 0.5
+Version: 0.7
Summary: Payyans is a python program to convert the data written for ascii fonts in ascii format to the Unicode format
Home-page: http://smc.org.in/Payyans
Author: Santhosh Thottingal, Nishan Naseer
diff --git a/payyans/docs/ChangeLog b/payyans/docs/ChangeLog
index c78e155..af785a1 100755
--- a/payyans/docs/ChangeLog
+++ b/payyans/docs/ChangeLog
@@ -1,7 +1,9 @@
Change Log:
+ version 0.7
+ * Bug fix to handle prebase, postbase matras correctly
+ * Added Ambili Map. Thanks to zyxware
version 0.6
- * Added word2Unicode and word2ASCII APIs
- * Move the doc files to /usr/share/doc/payyans-<ver> directory
+ * Loading the rules file multiple times fixed
version 0.5
* Python API fixes
* pdf option detection from input file name extension
diff --git a/payyans/docs/README b/payyans/docs/README
index 62eda0e..d453719 100755
--- a/payyans/docs/README
+++ b/payyans/docs/README
@@ -1,7 +1,6 @@
AUTHORS:
Santhosh Thottingal <santhosh.thottingal@gamil.com>
Nishan Naseer <nishan.naseer@gamil.com>
- Rajeesh K Nambiar <rajeeshknambiar@gmail.com>
A Swathanthra Malayalam Computing Project
Detailed Documentation: http://smc.org.in/Payyans
@@ -10,4 +9,4 @@ INSTALL:
As root
#python setup.py install
-Enjoy :)
+Enjoy :) \ No newline at end of file
diff --git a/payyans/maps/ambili.map b/payyans/maps/ambili.map
new file mode 100644
index 0000000..22fa9f0
--- /dev/null
+++ b/payyans/maps/ambili.map
@@ -0,0 +1,191 @@
+#Ambili Font map for Payyans
+#http://download.savannah.gnu.org/releases/smc/payyans
+#Copyright 2009 Zyxware (www.zyxware.com)
+#Copyright 2008 SMC (www.smc.org.in)
+#Licensed under GPLv3
+#Contact smc-discuss@googlegroups.com for bug reports
+w=ം
+x=ഃ
+A=അ
+B=ആ
+C=ഇ
+Cu=ഈ
+D=ഉ
+Du=ഊ
+E=ഋ
+\p=ഌ
+F=എ
+G=ഏ
+sF=ഐ
+H=ഒ
+Hm=ഓ
+Hu=ഔ
+I=ക
+J=ഖ
+K=ഗ
+L=ഘ
+M=ങ
+N=ച
+O=ഛ
+P=ജ
+Q=ഝ
+R=ഞ
+S=ട
+T=ഠ
+U=ഡ
+V=ഢ
+W=ണ
+X=ത
+Y=ഥ
+Z=ദ
+[=ധ
+\=ന
+]=പ
+^=ഫ
+_=ബ
+`=ഭ
+a=മ
+b=യ
+c=ര
+d=റ
+e=ല
+f=ള
+g=ഴ
+h=വ
+i=ശ
+j=ഷ
+k=സ
+l=ഹ
+m=ാ
+n=ി
+o=ീ
+p=ു
+q=ൂ
+r=ൃ
+s=െ
+t=േ
+ss=ൈ
+sm=ൊ
+tm=ോ
+su=ൌ
+v=്‌
+u=ൗ
+¡=ത്ഥ
+¢=ക്ല
+£=ക്ഷ
+€=ഗ്ഗ
+¥=ഗ്ല
+Š=ങ്ക
+§=ങ്ങ
+š=ണ്‍
+©=ഞ്ച
+ª=ഞ്ഞ
+«=ട്ട
+¬=ല്‍
+­=ണ്ട
+®=ച്ച
+¯=സ്ഥ
+°=ക്ക
+±=ദ്ദ
+²=ദ്ധ
+³=ന്‍
+Ž=ന്ത
+µ=ന്ദ
+¶=ങ്ക
+·=ന്മ
+ž=പ്പ
+¹=പ്ലശ്ശ
+º=മ്പ
+»=ശ്ശ
+Œ=മ്പ
+œ=മ്മ
+Ÿ=മ്ല
+¿=ര്‍
+À=ഹ്ല
+Á=റ്റ
+Â=ണ്ണ
+Ã=സ്റ്റ
+Ä=ള്‍
+Å=ള്ള
+Æ=ണ്ണ
+Ç=ശ്ല
+È=ശ്ശ
+É=സ്ല
+Ê=സ്സ
+Ë=ഹ്ല
+Ì=സ്റ്റ
+Í=ഡ്ഡ
+Î=ക്ട
+Ï=ബ്ധ
+Ð=ബ്ദ
+Ñ=ച്ഛ
+Ò=ഹ്മ
+Ó=ഹ്ന
+Ô=ന്ധ
+Õ=ത്സ
+Ö=ജ്ജ
+×=ണ്മ
+Ø=ത്ത
+Ù=ന്ഥ
+Ú=ജ്ഞ
+Û=ത്ഭ
+Ü=ഗ്മ
+Ý=ശ്ച
+Þ=ണ്ഡ
+ß=ങ്ങ
+à=ക്ത
+á=ഗ്ന
+â=ന്റ
+ã=ഷ്ട
+ä=റ്റ
+å=ന്
+ó=ന്ന
+y=്യ
+z=്വ
+{=്ര
+ð=ല്‍
+ï=ണ്ട
+ñ=ല്ല
+ò=ന്മ
+´=ട്ട
+¸=പ്പ
+¨=ണ്‍
+¦=ങ്ക
+¼=മ്പ
+½=മ്മ
+¤=ഗ്ഗ
+ô=ഞ്ച
+þ=-
+∂=ന്ന
+-=
+≤=ദ്ധ
+≥=ന്‍
+ƒ=ള്‍
+˛=-
+Ω=മ്മ
+‰=റ്റ
+ÿ=സ്ഥ
+›=ശ്ച
+∞=ത്ഥ
+≠=ണ്ട
+‡=ക്ത
+√=ല്ല
+∏=പ്പ
+≈=ള്ള
+π=പ്ല
+ø=യ്യ
+fl=ത്മ
+∑=ന്മ
+÷=ജ്ജ
+∆=വ്വ
+™=ഞ്ഞ
+—=ച്ഛ
+‚=ന്റ
+¥=ന്ത
+ =സ്സ
+⁄=ജ്ഞ
+•=ഗ്ല
+’=ത്സ
+‘=ന്ധ
+...=സ്ല
+“=ഹ്മ
diff --git a/payyans/maps/indulekha.map b/payyans/maps/indulekha.map
index 126031d..126031d 100755..100644
--- a/payyans/maps/indulekha.map
+++ b/payyans/maps/indulekha.map
diff --git a/payyans/maps/karthika.map b/payyans/maps/karthika.map
index c4e1765..c4e1765 100755..100644
--- a/payyans/maps/karthika.map
+++ b/payyans/maps/karthika.map
diff --git a/payyans/payyans/payyan.py b/payyans/payyans/payyan.py
index 0827b8f..afcac65 100755
--- a/payyans/payyans/payyan.py
+++ b/payyans/payyans/payyan.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Payyans Ascii to Unicode Convertor
-# Copyright 2008 Santhosh Thottingal <santhosh.thottingal@gmail.com>,
+# Copyright 2008-2009 Santhosh Thottingal <santhosh.thottingal@gmail.com>,
# Nishan Naseer <nishan.naseer@gmail.com>, Manu S Madhav <manusmad@gmail.com>,
# Rajeesh K Nambiar <rajeeshknambiar@gmail.com>
# http://www.smc.org.in
@@ -57,7 +57,7 @@ class Payyan:
letter = unicode_text[index:index+charNo]
if letter in self.rulesDict:
ascii_letter = self.rulesDict[letter]
- letter = letter.encode('utf8')
+ letter = letter.encode('utf-8')
'''കിട്ടിയ അക്ഷരങ്ങളുടെ അപ്പുറത്തും ഇപ്പുറത്തും സ്വരചിഹ്നങ്ങള്‍ ഫിറ്റ് ചെയ്യാനുള്ള ബദ്ധപ്പാട്'''
if letter == 'ൈ': # പിറകില്‍ രണ്ടു സാധനം പിടിപ്പിക്കുക
ascii_text = ascii_text[:-1] + ascii_letter*2 + ascii_text[-1:]
@@ -107,26 +107,45 @@ class Payyan:
def word2Unicode(self, ascii_text):
index = 0
+ post_index = 0
prebase_letter = ""
+ postbase_letter = "" # "‌‌്യ", "്വ"
unicode_text = ""
+ next_ucode_letter = ""
self.direction="a2u"
self.rulesDict = self.LoadRules()
while index < len(ascii_text):
- letter = ascii_text[index]
- if letter in self.rulesDict:
- unicode_letter = self.rulesDict[letter]
- else:
- unicode_letter = letter
- if(self.isPrebase(unicode_letter)):
- prebase_letter = unicode_letter
- else:
- if ((unicode_letter.encode('utf-8') == "എ") | ( unicode_letter.encode('utf-8') == "ഒ" )):
- unicode_text = unicode_text + self.getVowelSign(prebase_letter , unicode_letter)
+ for charNo in [2,1]:
+ letter = ascii_text[index:index+charNo]
+ if letter in self.rulesDict:
+ unicode_letter = self.rulesDict[letter]
+ if(self.isPrebase(unicode_letter)): #സ്വരചിഹ്നമാണോ?
+ prebase_letter = unicode_letter
+ else: #സ്വരചിഹ്നമല്ല
+ #എങ്കില്‍ വ്യഞ്ജനത്തിനു ശേഷം പോസ്റ്റ്-ബേസ് ഉണ്ടോ എന്നു നോക്കൂ
+ post_index = index+charNo
+ if post_index < len(ascii_text):
+ letter = ascii_text[post_index]
+ if letter in self.rulesDict:
+ next_ucode_letter = self.rulesDict[letter]
+ if self.isPostbase(next_ucode_letter):
+ postbase_letter = next_ucode_letter
+ index = index + 1
+ if ((unicode_letter.encode('utf-8') == "എ") |
+ ( unicode_letter.encode('utf-8') == "ഒ" )):
+ unicode_text = unicode_text + postbase_letter + self.getVowelSign(prebase_letter , unicode_letter)
+ else:
+ unicode_text = unicode_text + unicode_letter + postbase_letter + prebase_letter
+ prebase_letter=""
+ postbase_letter=""
+ index = index + charNo
+ break
else:
- unicode_text = unicode_text + unicode_letter+ prebase_letter
- prebase_letter=""
-
- index = index + 1
+ if charNo == 1:
+ unicode_text = unicode_text + letter
+ index = index + 1
+ break
+ unicode_letter = letter
return unicode_text # മതം മാറ്റി തിരിച്ചു കൊടുക്ക്വാ !
def Ascii2Uni(self):
@@ -140,7 +159,7 @@ class Payyan:
'''ഊഹും. കൊന്നാലും ഇനി മുന്നോട്ടില്ല. മുന്നില്‍ മറ്റവനാകുന്നു. ഏതു്? '''
return 1 # Error - no pdftotext !
else:
- self.input_filename = self.input_filename.split(".") [0]+ ".txt"
+ self.input_filename = os.path.splitext(self.input_filename)[0] + ".txt"
if self.input_filename :
ascii_file = codecs.open(self.input_filename, encoding = 'utf-8', errors = 'ignore')
else :
@@ -191,8 +210,21 @@ class Payyan:
if( ( unicode_letter == "േ" ) | ( unicode_letter == "ൈ" ) | ( unicode_letter == "ൊ" ) | ( unicode_letter == "ോ" ) | ( unicode_letter == "ൌ" )
| ( unicode_letter == "്ര" ) | ( unicode_letter == "െ" )
):
- return "ഇതു സത്യം... അ...സത്യം.... അസത്യം...!"
-
+ return True #"ഇതു സത്യം... അ...സത്യം.... അസത്യം...!"
+ else:
+ return False
+
+ def isPostbase(self, letter):
+ '''
+ "ക്യ" എന്നതിലെ "്യ", "ക്വ" എന്നതിലെ "്വ" എന്നിവ പോസ്റ്റ്-ബേസ് ആണ്.
+ "ത്യേ" എന്നത് ആസ്കിയില്‍ "ഏ+ത+്യ" എന്നാണ് എഴുതുന്നത്. അപ്പോള്‍ വ്യഞ്ജനം കഴിഞ്ഞ് പോസ്റ്റ്-ബേസ്
+ ഉണ്ടെങ്കില്‍ വ്യഞ്ജനം+പോസ്റ്റ്-ബേസ് കഴിഞ്ഞേ പ്രീ-ബേസ് ചേര്‍ക്കാവൂ! ഹൊ, പയ്യന്‍ പാണിനീശിഷ്യനാണ്!!
+ '''
+ unicode_letter = letter.encode('utf-8')
+ if ( (unicode_letter == "്യ") | (unicode_letter == "്വ") ):
+ return True
+ else:
+ return False
def LoadRules(self):
'''
diff --git a/payyans/payyans/payyans b/payyans/payyans/payyans
index 79c2854..7f3c421 100755
--- a/payyans/payyans/payyans
+++ b/payyans/payyans/payyans
@@ -25,9 +25,10 @@
from payyans import Payyans
from optparse import OptionParser
import sys,os
+VERSION=0.7
def error_exit():
print '''
- Payyans Malayalam Ascii <--> Unicode Converter Version 0.3
+ Payyans Malayalam Ascii <--> Unicode Converter
Please use --help or -h argument to see the options'''
sys.exit(1)
@@ -47,7 +48,7 @@ class Payyan:
'''നീ ആരാകുന്നു?'''
if options.version :
'''ഞാന്‍ പയ്യനാകുന്നു. പയ്യെ ജനനം. പൈത്തണ്‍കുലം. ഇങ്ങടു് കടിച്ചാല്‍ അങ്ങടും കടിക്കും- അതു് ജന്മ സ്വഭാവം'''
- print "Payyans Malayalam Ascii <--> Unicode Converter Version 0.3"
+ print "Payyans Malayalam Ascii <--> Unicode Converter Version" , VERSION,
return
if (options.mapping_filename is None):
''' മാപ്പിങ്ങ് ഇല്ലാതെ നമുക്കെന്താഘാഷം'''
diff --git a/payyans/setup.py b/payyans/setup.py
index 2993087..c1da8a0 100755
--- a/payyans/setup.py
+++ b/payyans/setup.py
@@ -4,7 +4,7 @@ from distutils.core import setup
doclines = __doc__.split("\n")
setup(name='payyans',
- version='0.6',
+ version='0.7',
description=doclines[0],
long_description = "\n".join(doclines[:]),
platforms = ["Linux"],
@@ -15,5 +15,5 @@ setup(name='payyans',
packages=['payyans'],
data_files=[('/usr/share/payyans/maps',['maps/karthika.map','maps/indulekha.map','maps/revathi.map']),
('/usr/bin',['payyans/payyans']),
- ('/usr/share/doc/payyans-0.6',['docs/README','docs/LICENSE','docs/ChangeLog'])]
+ ('/usr/share/doc/payyans-0.7',['docs/README','docs/LICENSE','docs/ChangeLog'])]
)