Module talk:sa-verb/testcases

From Wiktionary, the free dictionary
Latest comment: 5 months ago by RichardW57m in topic Requirement
Jump to navigation Jump to search

Scope of Discussion Page

[edit]

I suggest that this should be about improvements to the testcases, including their coverage and encoding. Content of the conjugation tables is better discussed at Template talk:sa-conj. 11:09, 6 March 2024 (UTC) RichardW57m (talk) 11:09, 6 March 2024 (UTC)Reply

Requirement

[edit]

(Moved hither from Template talk:sa-conj#Class V Imperative.)

@RichardW57 I think it would be best if we generally made a test suite for Sanskrit verb conjugations based off of Whitney. Since a simple change like this could have unintended consequences on other words based on sandhi rules and such. Do you think you could help me put this together? Dragonoid76 (talk) 02:04, 5 February 2024 (UTC)Reply

@Dragonoid76: OK. My first thought is to structure it after Module:pi-conj/verb/testcases. The footnotes need to be part of the tested text, in some fashion. I think one of us needs to start with the basic structure, and then we can collaboratively build the individual conjugations on that.
I'm not sure whether we need to test multiple scripts. For Pali, I glue stem to ending in the respective scripts, which is not guaranteed to be the same as generating in Roman and then transliterating. I think the hooks should be left in in case we work out what to do for alternative spellings in Sanskrit. One of the problems is that we have alternative spellings in Pali, but we don't yet address that in Sanskrit. Sanskrit, and even more so on Wiktionary, is very unfriendly to someone groping their way through a text.
Accented IAST is probably the best script to test.
I would also add hooks to present the arguments when things go wrong, as in the Srpt_why and Srpt_whynot family of Module:sa-convert/testcases. --RichardW57 (talk) 13:12, 6 February 2024 (UTC)Reply
@RichardW57 We can try using the method sa_verb_data[args.tense](args, data) which is called on line 629.
For example, if result = sa_verb_data["pres"]({"strong_lemma" = "bhavati"}) is called then result["indic"]["av"]["1_s"] == "bhavāmi" should be true. Dragonoid76 (talk) 13:25, 6 February 2024 (UTC)Reply
@Dragonoid76: Yes, that should be suitable for getting access to tables for comparison with the manually entered results. To make the tests manageable, I propose to compare, for example, all the first person terms from the present 'indicative' in one 'test'. --RichardW57 (talk) 00:31, 7 February 2024 (UTC)Reply
@Dragonoid76: Maybe it should, but your expressions don't even compile. As well as omitting the mandatory second argument, I suspect the first argument is incomplete. I am finding that sa_verb_data["pres"]({strong_lemma = "bhavati"}, data), with data as initialised in Mod:sa-verb, is yielding nil. Moreover, even when made to to work, I wouldn't expect anything better than bhavAmi or bha/vAmi. (That, though, would be a minor hoop to leap through.)
Why are you using metatables instead of honest functions? --RichardW57m (talk) 15:07, 9 February 2024 (UTC)Reply
I've tried supplying all the non-nil elements of args, and it still just yields nil. --RichardW57m (talk) 15:54, 9 February 2024 (UTC)Reply
@Dragonoid76: The answer seems to be that the generated forms are squirrelled away in data.forms. I should have stuck to reverse-engineering your code. --RichardW57m (talk) 16:25, 9 February 2024 (UTC)Reply
@RichardW57 the way I chose to do it is based on Module:sa-decl and Module:sa-decl/data, which makes things a little complicated. I'll try to work on starting this testcase set when I get some free time. In the meantime, if you want to edit Module:sa-verb/data to include injunctives, it should be easy enough based on the aorist. Dragonoid76 (talk) 18:05, 9 February 2024 (UTC)Reply
@Dragonoid76: To be precise, the method seems to be to execute
sa_verb_data["pres"]({strong_lemma = "bhavati", auto_sandhi = true}, data)
with data initialised as above (perhaps might suffice just to have it as an empty table - I haven't checked) and then data.forms.indic_av_1_s == "bhavAmi" and so on will be true for the active and middle of the present [indicative] tense.
I've now got the testing working for the active and middle of the present tense of bhávati. (ŋote the accent.) We will also need some tests with Lua error in Module:code at line 47: Parameter "auto_sandhi" is not used by this template. if we want to keep that capability working. I think there's a problem area there, but as you say, best to get some sort of regression testing going before we attempt to solve the sandhi issues. --RichardW57 (talk) 19:30, 9 February 2024 (UTC)Reply
@Dragonoid76: To repeat without parsing trouble, we need some tests with auto_sandhi = false. --RichardW57 (talk) 11:30, 10 February 2024 (UTC)Reply
@Dragonoid76: And of course, one has to convert the lemmas to SLP1! I neglected to do that, and wondered why sandhi wasn't working. Now fixed. --RichardW57 (talk) 21:13, 11 February 2024 (UTC)Reply
@Dragonoid76: I've implemented and am using the hooks for fields why and whynot. They go in the reference at the same level as the relevant form(s) or immediately below the tense etc. + voice level. If they go at the higher level, they are displayed for each person for which the test fails. There are examples of both in operation. --RichardW57 (talk) 11:40, 10 February 2024 (UTC)Reply
(Notifying AryamanA, Bhagadatta, Svartava, JohnC5, Kutchkutch, Getsnoopy, Rishabhbhat, Dragonoid76, RichardW57): @Exarchus Please note that we are still putting together an extensive test set so as to check for unintended changes. Be very careful with fixing bugs. That said, making the undoubted 3s imperative active (-tu) take the strong stem seems a safe change - though it might have been better to work out how to handle -tāt first. The fix didn't improve the test score! The discussion of -tāt might belong better at the Beer Parlour than as a topic here, as it involves general matters of principle. --RichardW57m (talk) 11:58, 15 February 2024 (UTC)Reply
@RichardW57m I was actually looking at how to implement detection of 3pl. on -ati and -uḥ, but I realised that since you are busy with this, it'd probably be better to wait with that (and my implementation would still produce those forms from the supplied weak stem). Exarchus (talk) 13:36, 15 February 2024 (UTC)Reply

RichardW57m (talk) 11:21, 6 March 2024 (UTC)Reply