Monday, November 19, 2018

num2text-arabic

How to print num2text in arabic version


There are few below steps you need to follow.

1) Open your terminal.

2) If you already install git library than it would be good if not than first install git library.

3) Clone this link using your terminal (Just copy past below link).
git clone https://github.com/ahmedzaqout/num2words.git
4) Install another python library bidi
 sudo apt-get install bidi
5) Once successfully installed python-bidi you need to again install rashaper lib.
sudo apt-get install git+https://github.com/mpcabd/python-arabic-reshaper

Now you have well enough library to print number to text as Arabic.

Here below few lines you need to copy past in your python file save it and run it.

1) Create new python file as test.py

2) Past below command in your test.py file and save it

from bidi.algorithm import get_display
import arabic_reshaper
from num2words import num2words
print get_display(arabic_reshaper.reshape(num2words(550,lang='ar')))
print get_display(arabic_reshaper.reshape(num2words(100125,lang='ar')))

3) Run this test.py file and you will get below output.

خمسمائة وخمسون
مائة ألف ومائة وخمسة وعشرون


Referenced From


No comments:

Post a Comment

If you have any query please comment here, Will get back to you :)