Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorklevin.gluo <klevin.gluo@gmail.com>2013-12-01 18:25:39 (GMT)
committer klevin.gluo <klevin.gluo@gmail.com>2013-12-01 18:25:39 (GMT)
commit8cdb7ec26e01ce586893c6cf46bdb78aad337a51 (patch)
treea1005e23641416132bd5e8730689d4489f2ba61b
parent928e10ff671126d7a6efe85b4fa4e6cfe41c3833 (diff)
initial support for indic numerals
-rw-r--r--numParser.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/numParser.py b/numParser.py
new file mode 100644
index 0000000..71f9c1c
--- /dev/null
+++ b/numParser.py
@@ -0,0 +1,27 @@
+# -*- coding: UTF-8 -*-
+import os
+
+locale = os.getenv('LANG', u'no language')
+
+pashto = {u'۰': u'0', u'۱': u'1', u'۲': u'2', u'۳': u'3', u'۴': u'4', u'۵': u'5', u'۶': u'6', u'۷': u'7', u'۸': u'8', u'۹': u'9'}
+arabic = {v:k for k, v in pashto.items()}
+
+
+def local(arabicString):
+ result = u''
+ for c in arabicString:
+ if c.encode('utf-8') in arabic:
+ result = result + arabic[c]
+ else:
+ result = result + c
+ return result
+
+def standard(pashtoString):
+ pashtoString = pashtoString.decode('utf-8')
+ result = u''
+ for c in pashtoString:
+ if c in pashto:
+ result = result + pashto[c]
+ else:
+ result = result + c
+ return result