When I saw the hassle that @mavanyrecords was going through to get a random sutta, I thought that it might be a good coding project.
So, first of all, I want to say that I don’t think that getting a random sutta is the best way to study the suttas. But it seems to be something people want. I even added it into SuttaFriends.org, despite my better judgement.
So, here you have it. A random sutta translated by Bhante Sujato. Includes the first four nikayas and Kp, Dhp, Ud, Iti, Snp, Thag and Thig.
@mavanyrecords’s method wasn’t truly random in the sense that there would be a much higher chance of getting a sutta from the DN or MN than there is with this new thing I created.
The code is basically an extension of the sc.readingfaithfully.org lightweight SuttaCentral interface. I just stripped out all the Pali and removed the previous/next buttons. If you want those things on a random sutta, you can just click the SuttaCentral icon above the translation and it will take you right there.
One of the problems with random suttas this way is that many of the suttas from the SN and AN repetition series are unreadable in the form they are in. ¯\_(ツ)_/¯ Everything has its limits.
I got a list of all the ids by copying all of the suttas I wanted into a singe folder and then did dir > filelist.txt in a Windows command line. I didn’t bother to sort the list since that doesn’t really matter for this project.
As always any feedback is welcome.
And also, as always, much gratitude to Bhante Sujato for making his translations accessible in this way and to all the coders who have helped along the way. And special thanks to @Khemarato.bhikkhu for coaching me in my coding adventure.
That’s brilliant. Are the probabilities for each sutta evenly weighted? One could argue that weighting the MN and DN suttas higher would make sense. Looking quickly at my books, and ignoring the KN, we have, very roughly
DN 500 pages
MN 1200 pages
SN, AN 2000 pages each.
So that makes about 5700 pages, and if you just picked a page at random you’d get a DN sutta about 9% of the time. You probably wouldn’t want it to be that high, but higher than
(number of DN suttas)/(total number of suttas) would probably be good.
Yes, in the sense that there is no weighting at all. And no waiting either!
My thinking was that someone clicking the button wouldn’t want to be getting a sutta that might take them 2+ hours to read anyway. And segments aren’t actual pericopes.
So that means that a random segment wouldn’t be much help.
Yeah, there are 4051 “suttas” as they appear on SC. So getting a DN sutta would be ~.8% chance?
But really, I just go back to
Thanks for the feedback, though! I am considering allowing the user to select the books that random suttas would be pulled from. But then it does remove a bit of the randomness since you would be only getting what you wanted.
I love it! Thank you so much venerable @Snowbird
I second @stu 's comment that the icons in the links-area are hard to see.
Maybe make the background lighter would sort it?
Would it be easy to create a version that goes through translation in other languages?
Now, it doesn’t really work perfectly. Ayya hasn’t translated all the suttas yet (may she have long life!), so sometimes you hit random and get nothing. But if you just hit it again (and rejoice in Ayya’s merit) then you will eventually come to a translation.
I should be able to put something in the code to try again if it doesn’t find anything. Just wanted to show off how easy it was to do what you asked.
Now, it only works with Bilara translations. There is no API for the others. I guess once I fixed that no-result problem I could just have a dropdown to select the language.
Thank you, Bhante. I was also thinking about increasing letter spacing for the same reason.
And yes, the icons are just temporary. I have to remake them all in a new colour, so it takes a while.
I’m torn. I love the idea, but I also don’t want to clutter the page any more than it already is. You can kind of tell how long a sutta is by looking at the scroll bar. Why don’t you open up an issue on Github (nudge, nudge).
There’s only a little problem: it doesn’t actually give you a Sutta.
(And the explaning text should of course be in German, but that’s easy to solve. I’ll translate it for you.)
Ah, okay, I only read that later (was too fast in wanting to try it out!)—I had to press 5 times to get a Sutta, which isn’t quite representative. According to the Bilara progress counter, there should be translations for about 48% of the project I want to translate.
Would this list be of help? It’s updated regularly.
A man who would letterspace lower case would steal sheep,
Frederic Goudy (yes, the Goudy of the font!)
Font designers carefully design fonts with the correct letterspacing. You’re using source serif pro, which is beautiful and took many years of careful design by a leading professional. Don’t spit in his soup!
Generally it looks great, you don’t need much.
The only other suggestion would be to avoid faux-bold in headings. Either serve a bold font, or specify normal weight:
Well, there are weekly updates and additions for the German translations. If your code can’t keep up with changes, a German version would very quickly just have outdated texts. It was a nice experiment, but no, in this case rather don’t put any further effort into a German version. But thanks anyway!
Ha! That’s what I’m working on right now. But the icons I have there now are black, so filter isn’t doing me much good.
Well, my idea was to have it just check to see if the chosen sutta existed and if it didn’t, then it would keep looking for one. So it might take a second to find one, but then the code would never be out of date. And if you already knew the texts that you were never planning on translating, then I could remove them from your German version. That would reduce the number of blank hits.