Amaru Metre Stats (Vasantatilakā: 5.93%, Mālinī: 1.69%, Śikhariṇī: 10.17%)

78 views
Skip to first unread message

Mārcis Gasūns

unread,
Dec 22, 2013, 3:13:48 AM12/22/13
to sanskrit-p...@googlegroups.com
Namaste,

  Amazing work going on. How can I run such stats on my own, any idea?

Amaru Stats (Vasantatilakā: 5.93%, Mālinī: 1.69%, Śikhariṇī: 10.17%)

{
  "Vasantatilakā": [
    14, 
    "5.93%"
  ], 
  "Mālinī": [
    4, 
    "1.69%"
  ], 
  "Śikhariṇī": [
    24, 
    "10.17%"
  ], 
  "Vaṃśastham (Vaṃśasthavila)": [
    4, 
    "1.69%"
  ], 
  "Hariṇī": [
    30, 
    "12.71%"
  ], 
  "Śārdūlavikrīḍitam": [
    136, 
    "57.63%"
  ], 
  "Anuṣṭup (Śloka)": [
    2, 
    "0.85%"
  ], 
  "Sragdharā": [
    10, 
    "4.24%"
  ], 
  "Drutavilambitam": [
    4, 
    "1.69%"
  ], 
  "Mandākrāntā": [
    8, 
    "3.39%"
  ]
}

Shreevatsa R

unread,
Dec 22, 2013, 5:04:33 AM12/22/13
to sanskrit-programmers
Run the repository's read_gretil.py on the file containing the GRETIL text. For some files you may have to filter out some non-verse lines (for this one, patch in diff-amaru_u.htm.patch ; see generate-stats.sh).

I guess it's time for another round of updates on the Sanskrit metre recognizer, as my last reply was on Nov 7, more than six weeks ago. I have pushed to the website a new version with minor improvements (and some regressions, still to fix), currently serving at http://1d.sanskritmetres.appspot.com/ (The previous version is still the default, available at http://1b.sanskritmetres.appspot.com/ for a while longer.)

The minor improvements have been mostly driven by running the code over a few GRETIL texts, a table summarising the results of which is on the main page as well. In fact, what occupied me for a long time was trying to fix up the GRETIL text of Bhartṛhari's Śataka-traya, by comparing each metrically questionable verse against variants in the excellent critical edition produced by DD Kosambi in 1948 and available on DLI. (See diff-bharst_u.htm.patch.) However, after a lot of time spent and still being only a little about half-way through, I gave up for now, became a bit more liberal with declaring a verse as identified, and proceeded to other texts. I plan to return to this too.

I am aware of several still-existing deficiencies, tracked at https://github.com/shreevatsa/sanskrit/issues?state=open . 
Most notably, it still doesn't have thousands of metres, only dozens. However, after looking at a few actual texts (such as Kirātārjunīya and Raghuvaṃśa) I am finally convinced of the need to include at least some of the obscure metres as well, and will get to adding all of them shortly. The work done by Dhaval and Vishvas will be helpful here.

In light of some previous comments, I'd like to make a couple of things clear:
(1) The web interface is intended for human users individually inputting a single verse. Thus I trust them to take care of things like removing extraneous junk that is obviously not part of the verse and can confuse the recognizer (like a, b, c, d for pādas). I am not keen on tampering with the user's input too much for the web interface. (For the reasons, see (2) below.) When you want to scan an entire messy text with the mess in a known pattern, you can always programmatically remove it, and run the metre recognizer offline. (See read_gretil.py.)

(2) There are two tasks the ideal metre-recognizing interface should do: identification and validation. The former is making a best guess on a verse assuming it's in some known metre (possibly with faults); the latter is to verify whether a given verse actually satisifies all the constraints. Imagine someone composing a verse, or someone checking if a verse is correct. I don't want to go too liberal (especially silently), and start allowing verses that don't actually fit the metre properly, on the web interface. In such cases, the ideal thing I'd like is to show the best-guess metre, while also highlighting exactly what is off.

I'll reply here again when the metres are all added, and the major issues are fixed. Then I'll request another round of testing and comments. :-)

Regards,
Shreevatsa


--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Mārcis Gasūns

unread,
Dec 22, 2013, 2:02:55 PM12/22/13
to sanskrit-p...@googlegroups.com
Hi,


On Sunday, 22 December 2013 14:04:33 UTC+4, shreevatsa wrote:
Run the repository's read_gretil.py on the file containing the GRETIL text. For some files you may have to filter out some non-verse lines (for this one, patch in diff-amaru_u.htm.patch ; see generate-stats.sh).
Would you bee so kind to upload a video to youtube? I've never worked with Python, just from the very beginning, step by step what you do.I'll try to learn the basics, but need help, please.
 
I guess it's time for another round of updates on the Sanskrit metre recognizer, as my last reply was on Nov 7, more than six weeks ago.
Right.
 
I have pushed to the website a new version with minor improvements (and some regressions, still to fix), currently serving at http://1d.sanskritmetres.appspot.com/ (The previous version is still the default, available at http://1b.sanskritmetres.appspot.com/ for a while longer.)
Great data. Please add epics for more data. Maybe separate chart with all Mahabharata books and Ramayana books separately. And sort by "Metre" names, otherwise hard to read. Change the color or % or make in bold stand out.
 
The minor improvements have been mostly driven by running the code over a few GRETIL texts, a table summarising the results of which is on the main page as well. In fact, what occupied me for a long time was trying to fix up the GRETIL text of Bhartṛhari's Śataka-traya, by comparing each metrically questionable verse against variants in the excellent critical edition produced by DD Kosambi in 1948 and available on DLI. (See diff-bharst_u.htm.patch.) However, after a lot of time spent and still being only a little about half-way through, I gave up for now, became a bit more liberal with declaring a verse as identified, and proceeded to other texts. I plan to return to this too.
Dhaval has found more GRETIL issues I could ever imagine. Texts are dirty. But better dirty than no texts. It would be great if Indians could clean them up a but indeed. So love your passion.
 
I am aware of several still-existing deficiencies, tracked at https://github.com/shreevatsa/sanskrit/issues?state=open . 
Most notably, it still doesn't have thousands of metres, only dozens. However, after looking at a few actual texts (such as Kirātārjunīya and Raghuvaṃśa) I am finally convinced of the need to include at least some of the obscure metres as well, and will get to adding all of them shortly. The work done by Dhaval and Vishvas will be helpful here.
Great, good that you do not want to reinvent the wheel.
 
In light of some previous comments, I'd like to make a couple of things clear:
(1) The web interface is intended for human users individually inputting a single verse. Thus I trust them to take care of things like removing extraneous junk that is obviously not part of the verse and can confuse the recognizer (like a, b, c, d for pādas).
As a-b-c is a popular one you could kill that kind of junk and not ask the user to do it. Or?
 
I am not keen on tampering with the user's input too much for the web interface. (For the reasons, see (2) below.) When you want to scan an entire messy text with the mess in a known pattern, you can always programmatically remove it, and run the metre recognizer offline. (See read_gretil.py.)
Mess is typical in most cases, not so unique at all.
 
(2) There are two tasks the ideal metre-recognizing interface should do: identification and validation. The former is making a best guess on a verse assuming it's in some known metre (possibly with faults); the latter is to verify whether a given verse actually satisifies all the constraints. Imagine someone composing a verse, or someone checking if a verse is correct. I don't want to go too liberal (especially silently), and start allowing verses that don't actually fit the metre properly, on the web interface.
Have you seen any such false positives actually occurring?
 
In such cases, the ideal thing I'd like is to show the best-guess metre, while also highlighting exactly what is off.
Right, colors is what we miss.
 
I'll reply here again when the metres are all added, and the major issues are fixed.
Oh, so in 2015. That's a pity, but we have waited for at least 3,500 years so we can wait for a few months more for sure.
 
Then I'll request another round of testing and comments.
Oh, ready I am to test. At least the statistics, but only if you will be kind enough to make an intro video, thanks. 

M.G.

dhaval patel

unread,
Dec 23, 2013, 3:18:50 PM12/23/13
to sanskrit-p...@googlegroups.com
Dear Shreevatsa,

I am missing the fun of what is going on here.
The cause is: "I do not know how to test the code in localhost."

I have no background in python, but can manage to understand PHP.
So, when I look at the code, I can understand what it means.

But I can not test it on my own.
For PHP I know - dowload XAMPP- run XAMPP control panel - add your file in htdocs folder - run the file from your localhost in browser.

Can you prepare / give a link of video tutorial for such testing in python ? please please

I tried google applauncher SDK, but it is not working for me.




--
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.
For more options, visit https://groups.google.com/groups/opt_out.



--
Dr. Dhaval Patel, I.A.S
District Development Officer, Rajkot

Shreevatsa R

unread,
Dec 23, 2013, 11:40:20 PM12/23/13
to sanskrit-programmers
Not a video, but here are some detailed instructions that ought to work.

1. Open a terminal.

2. Download the latest source into a new directory. You have several options (do only one of the following):
2a. The simplest may be to get the latest zip file: https://github.com/shreevatsa/sanskrit/archive/metrical-scan.zip and unzip it into a directory.
2b. Else (install git and) clone from github, by running the following command: 
git clone https://github.com/shreevatsa/sanskrit.git -b metrical-scan new_directory
It will create new_directory and put the source in it. [You can later get updates with "git pull", I think.]
2c. Create a new directory, cd into it, and run these:
git init
git pull gh metrical-scan
[You can later get updates by repeating "git pull gh metrical-scan"]
2d. Download a Github client for your platform (http://mac.github.com/http://windows.github.com/ ) and follow the instructions.
2e. If you'd like to submit commits of your own, create an account on Github, fork a repo, and follow these: https://help.github.com/articles/fork-a-repo

Whichever way you do it, you should now have all the source code in a directory.

3. cd into that directory, and run read_gretil.py on some text. Right now, the text of Bhartrhari is there (I'll remove it later when I'm done fixing it), so you can just run
python read_gretil.py bharst_u.htm
to see an example. It will print the metre of each verse, and statistics at the end (sorted by frequency). 
You can run it with other files to generate stats for them.

4. You can also just run python sscan.py and type a verse, then hit Ctrl-D to terminate output. It will attempt to identify the verse.

5. The web frontend is just a small wrapper (entirely contained in request_handler.py) over all this. It can (intentionally) handle only one verse at a time. If you are sure you want to test the web interface specifically, then 
5.1 make sure you have Python installed on your system,
5.2 download the Google App Engine SDK for Python from
5.3 Open it, go to File -> Add Existing Application, and choose the directory into which you've downloaded the source in step 2.
5.4 Click Run, wait for a few seconds, and open http://localhost:8080 (or http://localhost:9080 or wherever it's running: clicking on "Logs" will show you the logs).

Hope this helps.

If you have trouble with any step (other than Windows-specific ones like how to install a Terminal or Python on Windows, about which I wouldn't know anything... but I assume that developers who choose to use Windows have basic things like this set up somehow), feel free to ask again.

-Shreevatsa

dhaval patel

unread,
Dec 28, 2013, 2:53:19 AM12/28/13
to sanskrit-p...@googlegroups.com
Would you please tell me what a terminal is?
I use windows. 
I have python installed.


--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Usha Sanka

unread,
Dec 28, 2013, 3:02:13 AM12/28/13
to sanskrit-p...@googlegroups.com
Namaste
Terminal is in Linux base systems... like DOS for windows. In ubuntu (one of Linux flavors ) it is there. With one click you can open it like we do to a text editor.
It opens like our DOS- (C-prompt) in Windows.
And then we can "talk to" computer directly.. by giving (typing) commands. :)
I don't think it can be done in Windows also same way as Linux. Never tried. Please correct me if I am wrong.
-Usha

Usha Sanka

unread,
Dec 28, 2013, 3:31:49 AM12/28/13
to sanskrit-p...@googlegroups.com
Sorry- Command Prompt- not DOS.

श्रीमल्ललितालालितः

unread,
Dec 28, 2013, 3:42:28 AM12/28/13
to shritripura
cygwin is software which creates linux-like environment in windows and can run most of linux commands.
otherwise virtual machine is an option.

श्रीमल्ललितालालितः
www.lalitaalaalitah.com

Shreevatsa R

unread,
Dec 28, 2013, 5:28:21 AM12/28/13
to sanskrit-programmers
Please see the last line of my previous message. :-) I had said:

On Tue, Dec 24, 2013 at 10:10 AM, Shreevatsa R <shree...@gmail.com> wrote:
If you have trouble with any step (other than Windows-specific ones like how to install a Terminal or Python on Windows, about which I wouldn't know anything... but I assume that developers who choose to use Windows have basic things like this set up somehow), feel free to ask again.

To reiterate:
Whatever way you use to run Python programs on Windows -- use that, for steps 3 onwards. I assume it's equivalent to running it from a terminal. I don't know how to do it, because I haven't used Windows in over a decade. But I assume there should be tutorials on the internet (even generic Python tutorials should mention something).

Otherwise I remember I used to use Cygwin (or a virtual machine running Linux), back in the days when I was constrained to Windows.


On Sat, Dec 28, 2013 at 1:23 PM, dhaval patel <drdhav...@gmail.com> wrote:

dhaval patel

unread,
Dec 28, 2013, 8:12:38 AM12/28/13
to sanskrit-p...@googlegroups.com
I tried with cygwin.
I ran the code python read_gretil.py bharst_u.htm 
in the terminal.

This is what I got as output.

Inline image 1

Have I done something wrong ?
Or should I add something else ?

I guess that Python is correctly installed in my system
Inline image 2




--
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.
For more options, visit https://groups.google.com/groups/opt_out.
image.png
image.png

dhaval patel

unread,
Dec 28, 2013, 8:20:16 AM12/28/13
to sanskrit-p...@googlegroups.com
In Python shell for windows, when I run the module read_gretil.py ->
I get the following message

>>> ================================ RESTART ================================
>>> 
Traceback (most recent call last):
  File "C:\Users\Dhaval\Downloads\sanskrit-metrical-scan\sanskrit-metrical-scan\read_gretil.py", line 56, in <module>
    assert len(sys.argv) == 2
AssertionError
>>> 


image.png
image.png

Shreevatsa R

unread,
Dec 28, 2013, 9:23:48 AM12/28/13
to sanskrit-programmers
Dear Dhaval,

Great! I think you are very close to getting it working.

This one was my mistake -- I had not considered that file name and temporary directory format would be different on Windows -- I have fixed it in commit 723933d and pushed to Github now. If you update your source and try again, then 
python read_gretil.py bharst_u.htm
should work. Use a different file name to run it on a different file.


image.png
image.png

dhaval patel

unread,
Dec 28, 2013, 10:10:36 AM12/28/13
to sanskrit-p...@googlegroups.com
thanks for encouraging words.
The first hurdle is over now.

After I downloaded the revised read_gretil.py code,
What I am stuck at is this now
Inline image 1


image.png
image.png
image.png

Shreevatsa R

unread,
Dec 28, 2013, 10:16:40 AM12/28/13
to sanskrit-programmers
Ah, I think you have Python 3.3 installed. But Google App Engine doesn't support it (because of incompatibilities between Python 2.x and 3.x), so I'm using an older version of Python. 
Please install the latest 2.x version of Python -- probably 2.7.x (maybe 2.7.5 or 2.7.6).

Actually, it's possible that Python 2.7 is already installed on your system, just not the default: try "python2.7 read_gretil.py bharst_u.htm". If that doesn't work, then I'm afraid you'll have to install Python 2.7.
image.png
image.png
image.png

Shreevatsa R

unread,
Dec 28, 2013, 10:29:53 AM12/28/13
to sanskrit-programmers
By the way, the reason for the error message is that Python 3 has "unicode" as the default type for string literals; what Python 2 calls "str" and "unicode" is in Python 3 called "bytes" and "str" respectively.
image.png
image.png
image.png

dhaval patel

unread,
Dec 28, 2013, 10:45:12 AM12/28/13
to sanskrit-p...@googlegroups.com
Eureka !!

It finally worked after I changed it to Python 2.7.6

Inline image 1

Thank you very much for your patience.

image.png
image.png
image.png
image.png

dhaval patel

unread,
Dec 28, 2013, 11:22:55 AM12/28/13
to sanskrit-p...@googlegroups.com
tried to document the cygwin way for the windows users who are in no know how of using python.



image.png
image.png
image.png
image.png

Mārcis Gasūns

unread,
Mar 6, 2014, 12:57:31 AM3/6/14
to sanskrit-p...@googlegroups.com
It's year after. Eagerly waiting for updates. Ready to test it.

dhaval patel

unread,
Mar 6, 2014, 1:44:14 AM3/6/14
to sanskrit-p...@googlegroups.com
me too waiting for the updates.. 
Wish that shreevatsa comes up with frontend also.


--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Mārcis Gasūns

unread,
Apr 27, 2015, 3:49:43 PM4/27/15
to sanskrit-p...@googlegroups.com
One year anniversary past.


On Thursday, 6 March 2014 09:44:14 UTC+3, dhaval patel wrote:
me too waiting for the updates.. 
Wish that shreevatsa comes up with frontend also.
On Thu, Mar 6, 2014 at 11:27 AM, Mārcis Gasūns <gas...@gmail.com> wrote:
It's year after. Eagerly waiting for updates. Ready to test it.


On Saturday, 28 December 2013 20:22:55 UTC+4, dhaval patel wrote:
tried to document the cygwin way for the windows users who are in no know how of using python.


--
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-programmers+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Марцис Гасунс

unread,
Feb 13, 2016, 7:53:54 AM2/13/16
to sanskrit-programmers
Two year anniversary soon.

понедельник, 27 апреля 2015 г., 22:49:43 UTC+3 пользователь Mārcis Gasūns написал:
One year anniversary past.

Reply all
Reply to author
Forward
0 new messages