Padmini (beta) -- a fast Paninian word generator

137 views
Skip to first unread message

Arun

unread,
Feb 27, 2022, 7:14:13 PM2/27/22
to sanskrit-programmers
Padmini is a Python library that generates Sanskrit words with their traditional derivations (prakriyā).


Padmini can replace SanskritVerb for most use cases. In addition to being an order of magnitude faster, it also generates more optional forms and fixes several small bugs. But what is most exciting is that Padmini gives us a clean platform and set of libraries for modeling all of the rest of the Ashtadhyayi.

That said,  I still have a few bugs to clean up. That's why this is a beta release. Please don't expect the commit history to remain stable, as I will probably force-push over it in the future.

To get a sense of what the program can do, please read the docs, or download the code and run python harness.py to generate an XML file in the style of SanskritVerb.

Arun

Shreevatsa R

unread,
Feb 28, 2022, 4:20:27 AM2/28/22
to sanskrit-programmers
This looks amazing, thanks for sharing Arun! And thanks for documenting it in detail...

Separately, I had been planning for a while to try out Pyodide (running Python inside a web browser) and this (having no dependencies) seemed a good use-case, so I made a hacky demo page for the two main API functions (tinanta and subanta).
(Hope the webpage isn't misleading in any way, e.g. the slowness on initial load is because of the Pyodide translation while the Python code itself is super fast, but the cool thing is that the Python code runs entirely inside the browser.)


--
You received this message because you are subscribed to the Google Groups "sanskrit-programmers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sanskrit-program...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sanskrit-programmers/518ce9d4-9b08-4ef1-8b2c-1185a76ad80cn%40googlegroups.com.

विश्वासो वासुकिजः (Vishvas Vasuki)

unread,
Feb 28, 2022, 10:29:32 PM2/28/22
to sanskrit-programmers, MA Alwar आळ्वारः नैयायिकः
cc shrI Alwar, who mentioned some Mysore acquaintance who is said to be sporadically involved in similar python grammatical generation projects (porting 90-s unpublicized obsolete code) in isolation.



--
--
Vishvas /विश्वासः

विश्वासो वासुकिजः (Vishvas Vasuki)

unread,
Mar 4, 2022, 9:15:29 AM3/4/22
to Narasimhan M.G., sanskrit-programmers, Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः
+sanskrit-programmers who may be interested

+Screenshot attached earlier.


On Fri, 4 Mar 2022 at 18:02, Narasimhan M.G. <narasi...@gmail.com> wrote:
Yes, it is open source. Free to clone, use, extend and enhance. However, documentation is not done yet.


Plan to add a  REST Api and a web client next. Still doing some restructuring of the code, so it depends on my priorities and other work.

Some feedback

- It would be good to split out controller code into separate modules (eg. sanskrit_generator, sanskrit_analyzer) and publish them on pypi so that any can install (eg. with - pip install sanskrit_generator) and use. Otherwise, probability of reuse and extension falls quite drastically.
- You can eliminate non-essential parts of your code (along with maintenance headaches) by depending on other mature packages (example- https://github.com/indic-transliteration/indic_transliteration_py/ or https://github.com/virtualvinodh/aksharamukha/ )
- Announce advances to interested people (eg. sending email to +sanskrit-programmers )
- Might be a good idea to eliminate ISCII from your code/ db and switch over to something more widespread (slp1 or even plain unicode)



 
 

 
 

mobile: 994-527-4542 address: 90, 8th Cross, 3rd Stage, Gokulam, Mysore 570002



On Fri, 4 Mar 2022 at 07:45, विश्वासो वासुकिजः (Vishvas Vasuki) <vishvas...@gmail.com> wrote:
Thank you for the screenshots, and pleased to make your acquaintance!
(Could not view the slideshow since I only have a Linux computer and am not familiar with a program which opens it. If anyone has tips, please let me know.)

Much of the functionality seems to be independently available elsewhere, for example, https://github.com/kmadathil/sanskrit_parser . If this software or its key components are open source, could you please share a link to them here so that other interested contributors may study, benefit from and extend it?


On Thu, 3 Mar 2022 at 19:48, Narasimhan M.G. <narasi...@gmail.com> wrote:
Here are some screenshots of the "obsolete" code ☺

Also a slideshow prepared with Microsoft Step Recorder that can be played in internet explorer when you double click on a single .mhtml file inside this zip file.


More explanations can be done in a chat or virtual conference.
mobile: 994-527-4542 address: 90, 8th Cross, 3rd Stage, Gokulam, Mysore 570002



On Tue, 1 Mar 2022 at 10:29, Dr. M.A.Alwar <m.a....@gmail.com> wrote:
FYI and needful action

Narasimhan M.G.

unread,
Mar 4, 2022, 11:42:17 AM3/4/22
to विश्वासो वासुकिजः (Vishvas Vasuki), sanskrit-programmers, Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः
Thanks. Good ideas. Some basic modularization has been done (as usual in SW, improvements always needed). 

BTW, ISCII is mostly eliminated at the generator and morphology analysis level, but not the syntactic level. Next on my to-do list..

It's a one-man old system rewrite project, and I am doing other such projects as well... 

  • packaging for pip install - I need to learn it, and see how my AMarakosha database can be part of it
  • using other mature packages - I'll look into it. It'll need more learning period and my own code restructuring
This project was done to show my erstwhile mentor Sri M.A. Lakshmi Thathachar that it can be done according to rules given by him. Since I know very little Sanskrit, domain expertise in grammar is order-of-magnitude more difficult for me. A VB 6.0 Win Xp code base with ISCII strewn all over was rewritten in Python. and also converted to Unicode. Many parts of the code are not well-programmed, and that itself will require more effort from me.

So the question is in what way it should evolve, and whether others can use it usefully. Then I can at least start documenting the application better.
mobile: 994-527-4542 address: 90, 8th Cross, 3rd Stage, Gokulam, Mysore 570002

विश्वासो वासुकिजः (Vishvas Vasuki)

unread,
Mar 4, 2022, 9:48:55 PM3/4/22
to Narasimhan M.G., sanskrit-programmers, Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः
On Fri, 4 Mar 2022 at 20:48, Narasimhan M.G. <narasi...@gmail.com> wrote:
Thanks. Good ideas. Some basic modularization has been done (as usual in SW, improvements always needed). 

BTW, ISCII is mostly eliminated at the generator and morphology analysis level, but not the syntactic level. Next on my to-do list..

It's a one-man old system rewrite project, and I am doing other such projects as well... 

  • packaging for pip install - I need to learn it, and see how my AMarakosha database can be part of it

I hope that you don't include amarakosha database in your pip package. No reason why users who just want to call some generator or analyzer should be burdened with that. Packaging itself is simple - can refer to the structure of https://github.com/indic-transliteration/indic_transliteration_py/ for an example.
 
  • using other mature packages - I'll look into it. It'll need more learning period and my own code restructuring
This project was done to show my erstwhile mentor Sri M.A. Lakshmi Thathachar that it can be done according to rules given by him. Since I know very little Sanskrit, domain expertise in grammar is order-of-magnitude more difficult for me. A VB 6.0 Win Xp code base with ISCII strewn all over was rewritten in Python. and also converted to Unicode. Many parts of the code are not well-programmed, and that itself will require more effort from me.

So the question is in what way it should evolve, and whether others can use it usefully.

As long as the installation and generation/ analysis API is simple, there is good potential for use.

Narasimhan M.G.

unread,
Mar 5, 2022, 2:53:07 AM3/5/22
to विश्वासो वासुकिजः (Vishvas Vasuki), sanskrit-programmers, Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः
I hope that you don't include amarakosha database in your pip package. No reason why users who just want to call some generator or analyzer should be burdened with that. Packaging itself is simple - can refer to the structure of https://github.com/indic-transliteration/indic_transliteration_py/ for an example.
 Amarakosha resides in a SQLIte DB with tables for Subanta, Tiganta, Krdanta, suffixes etc. SQL queries are used to generate and analyze input words. So it's essential. If a python package cannot include that, then it won't work. Let me think about what I can do.
How does a well-specified REST Api (Python-flask) and a cloud-based service sound to you?  

As long as the installation and generation/ analysis API is simple, there is good potential for use
The code is structured in a Model-View-Controller pattern and the Controller modules have all the functionality. The View module "Amarakosha.py" uses these functions. Each UI Menu item calls the required function, gets the results and displays it with PyQt5 hooks.
I have also developed fairly detailed unit tests, so that regression tests can be run, whenever a new version is developed/committed.
 
The same design can be extended to a REST service Api and an example Javascript client developed. 
mobile: 994-527-4542 address: 90, 8th Cross, 3rd Stage, Gokulam, Mysore 570002

विश्वासो वासुकिजः (Vishvas Vasuki)

unread,
Mar 5, 2022, 3:01:06 AM3/5/22
to Narasimhan M.G., sanskrit-programmers, Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः
On Sat, 5 Mar 2022 at 11:28, Narasimhan M.G. <narasi...@gmail.com> wrote:
I hope that you don't include amarakosha database in your pip package. No reason why users who just want to call some generator or analyzer should be burdened with that. Packaging itself is simple - can refer to the structure of https://github.com/indic-transliteration/indic_transliteration_py/ for an example.
 Amarakosha resides in a SQLIte DB with tables for Subanta, Tiganta, Krdanta, suffixes etc. SQL queries are used to generate and analyze input words. So it's essential. If a python package cannot include that, then it won't work.

Oh ok - python package can include data or db files. (Just as toml files are included in the quoted example.)

 
Let me think about what I can do.
How does a well-specified REST Api (Python-flask) and a cloud-based service sound to you?  

REST API is useful, of course. But a python module will be more so IMO.

 

As long as the installation and generation/ analysis API is simple, there is good potential for use
The code is structured in a Model-View-Controller pattern and the Controller modules have all the functionality. The View module "Amarakosha.py" uses these functions. Each UI Menu item calls the required function, gets the results and displays it with PyQt5 hooks.

Good idea to publish the following separate things (in decreasing order of importance)-

1 A simple library (published at pypi) without any GUI.
2 Server providing REST API to 1 above.
3 GUI-s or websites which uses 1 above and maybe 2.

Narasimhan M.G.

unread,
Mar 6, 2022, 12:20:01 AM3/6/22
to विश्वासो वासुकिजः (Vishvas Vasuki), sanskrit-programmers, Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः

Thanks. I'll work on these suggestions and get back to you all.
mobile: 994-527-4542 address: 90, 8th Cross, 3rd Stage, Gokulam, Mysore 570002

Narasimhan M.G.

unread,
Mar 16, 2022, 5:46:24 AM3/16/22
to विश्वासो वासुकिजः (Vishvas Vasuki), sanskrit-programmers, Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः
Hi All.

I have been working on the first suggestion by Sri Vishvas Vasuki, I've restructured my Python code for Sanskrit word/sentence analyzer/generator based on an Amarakosha database
So I have a difficult technical problem related to Python package publishing on a Test basis.
 
I have made a package version and published it on Test PyPi

image.png

I created a Virtual Environment and installed my package with pip.
image.png
image.png
However, the import statement for this package gives an error message. "not found"
image.png
I use Jetbrains PyCharm for development. The same pattern there as well.
image.png
Has anyone tried this before, with Test PyPi and a Python Virtual Environment? Any tips would be appreciated.
I have a Windows 10 Desktop OS.

Narasimhan MG  
DirectorS.R.V.V.P
mobile: 994-527-4542 address: 90, 8th Cross, 3rd Stage, Gokulam, Mysore 570002

Avinash L Varna

unread,
Mar 16, 2022, 4:50:36 PM3/16/22
to sanskrit-programmers, विश्वासो वासुकिजः (Vishvas Vasuki), Dr. M.A.Alwar, Shreevatsa shrIvatsaH R श्रीवत्सो गणितज्ञः
My first guess would be that the python interpreter is not the same as the one in the venv. I notice that you ran pip as ./venv/scripts/pip, but python directly. Did you activate the venv (e.g. by "./venv/scripts/activate" or whatever the equivalent for PowerShell is)?

Reply all
Reply to author
Forward
0 new messages