Module talk:ar-verb

Definition from Wiktionary, the free dictionary
Jump to: navigation, search

Module for Arabic verbs[edit]

moved from User_talk:Atitarev#Module_for_Arabic_verbs

Hi, I can help with this. It will be a hard thing to do though, especially if we want to add irregular (mu'tall) verbs as well. --Z 04:12, 28 June 2013 (UTC)

Great! We're not in a hurry, though, can take time and do it properly. With Arabic, I can mostly work only from home where I have access to my grammar books with no distraction. Russian is more irregular than Arabic, AFAIK, can you give me a few examples of irregular verbs (excluding hamzated, assimilated and hollow forms, I'm also aware of quadrilateral roots)? Not sure if defective verbs (و or ي as a third radical) are considered "irregular". Working with the Russian module taught me an efficient of dealing with irregularities - just providing and overriding parameter, if they are a few. If an irregularity is common and repetitive, it's a candidate for a new function. Have you seen Module:ru-verb? Hopefully CodeCat jumps in if we get stuck with a technicality problem, even though she never replied. --Anatoli (обсудить/вклад) 04:26, 28 June 2013 (UTC)
That was what I meant, not irregular actually, since they are predictable, but we would have to create many functions. The Russian module seems quite big, I guess too that the Arabic one will be easier. --Z 05:19, 28 June 2013 (UTC)

I think we should work on those hard parts first, I mean w ' y verbs etc. for which we don't have conjugation templates (we do have for several hamzated forms though). Ric's templates are working well and I think there is little point in converting them to Lua. --Z 19:01, 28 June 2013 (UTC)

Sounds like a plan. At first I wanted to convert but it's not a small job. I should have a bit more time tomorrow. --Anatoli (обсудить/вклад) 07:05, 29 June 2013 (UTC)

Tests[edit]

Lua error in Module:ar-verb at line 1107: Form (conjugation type) has not been specified. Please pass a value to parameter 1 in the template invocation.

Yes, I got it, I was going to write the same thing here. :) --Anatoli (обсудить/вклад) 11:49, 28 June 2013 (UTC)

The test template is Template:ar-conjug-I-test. Some variables are nil, trying to find out why it complains. Will make default values, so that the template doesn't generate errors. --Anatoli (обсудить/вклад) 11:56, 28 June 2013 (UTC)

It works:

{{ar-conjug-I-test|ك|ت|ب|a|u}} gives: Template:ar-conjug-I-test

Almost fixed, let's work on the forms. --Z 17:03, 28 June 2013 (UTC)
With maṣdar:

Template:ar-conjug-I-test --Anatoli (обсудить/вклад) 09:51, 29 June 2013 (UTC)

Check intrans:

Template:ar-conjug-I-test --Anatoli (обсудить/вклад) 10:02, 29 June 2013 (UTC)

conj.I:generate_forms - grouping all conjugations together[edit]

Not sure this is a good idea. Now, for each verb form (I-X) and subtype there will be a new function repeating each form? This this revision uses separate function for tenses. E.g. perfective endings are the same for all sound verbs, hamzated (r1 or r2 = hamza), other forms. Some functions could be reused many times. --Anatoli (обсудить/вклад) 13:34, 29 June 2013 (UTC)

Of course, we'll need to make more function, which will will uses more than one stem - consonantal and vocalic for hollow verbs or similar. --Anatoli (обсудить/вклад) 13:40, 29 June 2013 (UTC)
I guess I had misunderstood your idea, please wait a bit, let me make some other changes. --Z 14:07, 29 June 2013 (UTC)
Ok, what about now? Now we should just give value to the stems in conj.<num>.init() functions. But in this way, we would have to override and redefine some functions in some cases, because not all verbs have the same "stem" always, e.g. for the root خ و ف: third-person m sg خَافَ xāfa but f pl خِفْنَ xifna --Z 16:19, 29 June 2013 (UTC)
Verbs with more than one stem is not a problem, they'll just need another function, which will use two stem parameters, e.g. (خَاف and خِفْ). We still need functions for each verb form (I-X) to create stems and call matching conjugation functions. Some can be reused, some will need to be added. Sorry, I don't understand your latest redesign. You have overwritten many changes I made, including . I'd like to go back to this revision and remove conj.<num>.init().
My challenge is not the Arabic conjugation and grammar at the moment but combining Arab forms with transliteration in the display table.
In the piece of code you have removed:
    -- Format and and add transliterations to all forms
    for key, form in pairs(forms) do
        -- check for empty strings and nil's
        if form ~= "" and form then
            forms[key] = "<span lang=\"ar\" class=\"Arab\">[[" .. com.remove_diacritics(form) .. "#Arabic|" .. form .. "]]</span><br/><span style=\"color: #888\">" .. "TRANSLIT" .. "</span>"
        else
            forms[key] = "—"
        end
I need each Arabic form to be matched with its transliteration. "TRANSLIT" in the above has to be replaced with forms_tr[key] where "key" is "3sm-perf", etc. What do you say if I go back to my last working version? I'll go through what it does, if you wish. --Anatoli (обсудить/вклад) 03:33, 30 June 2013 (UTC)

I will ask a question on Grease pit, if you know the answer, answer here please. --Anatoli (обсудить/вклад) 03:42, 30 June 2013 (UTC)

We don't need another table for transliterations, I fixed Module:ar-translit, with which we can transliterate forms when we are linking to them when we want to make the table.
Regarding the changes, actually it's quite similar to your version, I made some changes only to avoid some duplications in code. Now we should just change the values of stems (and any other variables, if needed) from those init functions. se the if self.rad1 == "و" and self.impf_vowel == "i" then part for example, try seeing the result of {{ar-conjug-I-test|و|ع|د|a|i}} (for imperfect) --Z 05:33, 30 June 2013 (UTC)
Shortcuts are fine, what I have problem with is, for each new conjugation form, there must be a new function. "conjugations["I"] = function(args)" was one of them, which did the work specific to one conjugation type (form-Iof of sound verbs) and delegated building endings to generic functions (e.g. "perfective_conj") where possible. I don't know how this is going to work with "init" function. Why did you move all the logic into "init" when it should be split? Are you going to handle all verb types in one big function. Having functions for adding prefixes/endings is not enough, as the middle portion will be different for each type and subtype. --Anatoli (обсудить/вклад) 05:58, 30 June 2013 (UTC)
No, that's just for form I. So for form II, conj.II:init will be used and so forth, exactly like before. --Z 06:00, 30 June 2013 (UTC)
I see. That was not obvious, though, as there is no conjugation type and self.conj_type variable seems to suggest that this function will handle any type. Let's just call it "init-I".
Please work off latest versions, as I now have to put back what you have removed. --Anatoli (обсудить/вклад) 06:10, 30 June 2013 (UTC)


Z, could you check the conjugation table, please? Also, the translit module is not giving the expected results (I don't know if it can work eventually, there are problems with initial letters as well, they get doubled - mmaš‎, alif examples don't look good either. --Anatoli (обсудить/вклад) 06:39, 30 June 2013 (UTC)
The module apparently works, alif problem is because you didn't used hamzah (أ). --Z 07:15, 30 June 2013 (UTC)

I'm lost[edit]

I'm lost now. conj.I:init hardly has anything and ConjugationTable:init(args) does what a function for form should be doing. What's the purpose of ConjugationTable:init? --Anatoli (обсудить/вклад) 06:57, 30 June 2013 (UTC)

ConjugationTable:init is a "common" function, which those conj...init functions inherit from it. It's exactly like before, just some duplications are removed. Note that you should not change ConjugationTable:init. --Z 07:21, 30 June 2013 (UTC)
I just wanted to make the job easier, but it has made it harder for you, so feel free to revert to the old version (I will perform those changes at the end). --Z 07:31, 30 June 2013 (UTC)
Thank you for your efforts, Z. Last night I had guests and then went to bed as I was tired.
Your suggestion sounds good to me. I won't be able to contribute if I don't understand the code and I have my own view how to make it. I'll learn more of your tricks while we're doing but I'd prefer no radical changes, which would affect readability (from my point of view). I'm happy to focus on conjugation tables only but before that the basic structure should work. Currently, the conjugation table is incorrect (the layout). Please check the position of كَتَبَا and كَتَبْتُمَا for example? Could you please fix it? I find it hard.
With automatic transliteration. Do you feel confident that it can be done well for conjugations, including initial alifs and endings such as كَتَبُوا? I don't mind working on manual transliteration. This can also be done at a later stage (when all conjugations are done) or, as another option, we could without it altogether. Fully vocalised verb forms may be sufficient.
I'd like to add existing (Ric's templates) conjugation types as well for consistency, testing. Good functions could be reused or we may decide to convert all verbs to use this module.
I'd like to categorise verbs using templates - form-I to form-X, transitive/intransitive, then all irregularities - hollow, assimilated, etc. We can discuss the exact terminology. Happy to take this on.
I may be busy this week but I'd like to continue. --Anatoli (обсудить/вклад) 23:29, 30 June 2013 (UTC)
The table is fixed. I agree not to work on transliterations (automated/manual) right now (yes I'm sure we can automatically do that; but lets discuss on this at the end when we finished working on all forms). --Z 07:12, 1 July 2013 (UTC)

geminate[edit]

Lua error in Module:ar-verb at line 1107: Form (conjugation type) has not been specified. Please pass a value to parameter 1 in the template invocation. --Anatoli (обсудить/вклад) 13:14, 4 July 2013 (UTC)

Now

. Benwing (talk) 00:40, 30 August 2014 (UTC)

Stems[edit]

For some forms and roots the prefixes are a bit different (their vowel is "u" instead of "a") also some forms don't have initial hamza in imperative, we can't create these forms with current functions. --Z 19:10, 11 July 2013 (UTC)

Sorry, missed your post.
Do you mean the intial vowel for imperatives in form-I? I have already added the code to determine the initial vowel (after the alif) based on the middle vowel, for "a" and "i", the initial vowel is "i", for "u" it's "u":
    -- determine the imperative vowel based on imperfect vowel
    local imper_vowel = "a"
    if impf_vowel == "a" or impf_vowel == "i" then
        imper_vowel = "i"
    elseif impf_vowel == "u" then
        imper_vowel = "u"
    end

    -- imperative stem
    local imper_stem = alif .. dia[imper_vowel] .. rad1 .. rad2 .. dia[impf_vowel] .. rad3

If it's not what you meant, please give an example. --Anatoli (обсудить/вклад) 06:44, 13 July 2013 (UTC)
I mean assimilated verbs, for example, m sg imperative of أخذ ‎(axadha): خذ ‎(xidh) (there's a similar problem for imperfective of some verb forms, e.g. IV: yuf3ilu) --Z 19:30, 13 July 2013 (UTC)
Form-I function is obviously for sound verbs only. Assimilated, hollow, etc. will get their own functions. There's a lot to do. --Anatoli (обсудить/вклад) 00:23, 14 July 2013 (UTC)
But in this way we would need a lot of functions, I think we should consider hamza as part of the root for imperative (as well as that initial vowel as in yuf3ilu for imperfect). --Z 09:37, 14 July 2013 (UTC)
I think it's OK t have a lot of functions, reusable parts can be copy-edited or separated into reusable function. Any grammar book will have separate tables not only for forms I-X but also for doubled, hamzated, assimilated, hollow, and three versions of defective verbs. Plus quadrilateral verbs, doubly weak, hamzated and weak, completely irregular, etc. I've started working on "conjugations["I-geminate"]", only have done perfect and imperfect. Haven't been very productive lately, sorry :) --Anatoli (обсудить/вклад) 10:47, 14 July 2013 (UTC)

Module:ar-verb needing testing, work, use of new {{ar-conj}}[edit]

Moved from Wiktionary:Beer_parlour/2014/August#Module:ar-verb_needing_testing.2C_work.2C_use_of_new_.7B.7Bar-conj.7D.7D

I've done lots of work on Module:ar-verb. Currently all verb forms I through VI plus quadriliteral Iq/IIq are implemented in all weaknesses (sound, assimilated, hollow, defective, geminate, assimilated+defective), except for hamzated verbs. There is a template {{ar-conj}} that uses the module. It takes the form as the first argument followed by the radicals and then past/non-past vowels (for form I). It automatically determines the weakness from the radicals but you can override this to force interpretation as a sound verb. Detailed documentation is found in {{ar-conj}}. Any help would be greatly appreciated. There's still forms VII to X to do as well as individual override parameters and changes for hamzated verbs -- I've documented thoroughly how to do this in the comment at the top of the module. I could definitely use help testing the various combinations of form and weakness and verifying that the conjugations are correct. Benwing (talk) 03:53, 28 August 2014 (UTC)

It now handles forms VII - X as well. Working on hamza support. Benwing (talk) 08:35, 28 August 2014 (UTC)
Hamza support is largely done. The big thing now is testing and using the new {{ar-conj}} in verb lemmas (i.e. adding conjugations to the verbs). BTW what is the fastest way to automate this? I've used AWB but there may be better ways. Are there any JavaScript tools to do something like this, and if so, how do they work? I'm not very familiar with JavaScript and Wiktionary (or Wikipedia). Benwing (talk) 23:14, 28 August 2014 (UTC)
What is it you want to automate? DTLHS (talk) 23:28, 28 August 2014 (UTC)
Adding conjugations to Arabic verb lemmas. Benwing (talk) 00:03, 29 August 2014 (UTC)
There's pywikibot, if you like python. DTLHS (talk) 00:27, 29 August 2014 (UTC)
You can probably use AWB and ask AWB experts at Wiktionary:Grease pit/2014/August about how to replace something like {{ar-conj-I|س|ع|ل|a|u|vn=سعال|vn-wv=سُعَالٌ|vn-tr=suʿāl|passive=-}} with {{ar-conj|I|س|ع|ل|a|u|vn=سُعَالٌ|intrans=y}}. The changes seem straightforward. For entries missing conjugation tables, such {{ar-conj-I}}, especially form-I verbs, it can't be automated without making prior knowledge of supplying present tense vowels, transitivity and verbal nouns. Again, you need AWB, I think. --Anatoli T. (обсудить/вклад) 01:30, 29 August 2014 (UTC)
You're right that changing existing conjugations isn't too hard; in AWB you just use the appropriate regexes. I guess I was thinking of having it guess the radicals and even the form from the headword, which can be done with a fair amount of accuracy, although there are cases where it can't be done without knowing the form and even then of course it can't guess the past/non-past vowels in form I. But something semi-automated could help a lot. Benwing (talk) 03:45, 29 August 2014 (UTC)
The first test سعل ‎(saʿala), a sound verb, intransitive, form-I. It looks good, only the entry got into Category:Link with section, meaning there's a link with #. --Anatoli T. (обсудить/вклад) 00:24, 29 August 2014 (UTC)
I don't understand this. The link for the 3rd-person masculine perfect form has a #Arabic anchor in it, but that's to be expected, right? I checked and there's no place that the code itself inserts this anchor; it must come from the call to full_link() in Module:links. Benwing (talk) 03:30, 29 August 2014 (UTC)
I don't know either. Module:ru-verb doesn't have this problem, even if it uses explicit #Russian. --Anatoli T. (обсудить/вклад) 03:43, 29 August 2014 (UTC)
BTW what do you think about the possibility of inferring the consonants from the headword, assuming you specify the form but leave out the radicals? This won't work perfectly for form I but it should for all the others, and might make adding conjugation tables easier. Benwing (talk) 03:39, 29 August 2014 (UTC)
If you can do it and cater for hollow/defective verbs separately (supplying either "y" or "w" as R2 or R3), I don't see why not. Geminated should also work (R2=R3). --Anatoli T. (обсудить/вклад) 03:47, 29 August 2014 (UTC)
This is now done. It's enough to specify the form and it will infer the radicals from the headword. The only issues are with form I of course especially hollow verbs where wāw is automatically assumed (but could be a y), and form VIII beginning with itt-, which is assumed to have a t radical but could be a w or y. For augmented-form hollow and defective verbs a wāw is automatically assumed, but in this case it doesn't matter because the conjugation is the same regardless of whether the root is w or y. Benwing (talk) 06:01, 29 August 2014 (UTC)
I've now changed the order of arguments to {{ar-conj}} so that past/non-past vowels come first in Form I, before the radicals. The idea is that radicals will almost always be omitted so don't have any numbered params that come after the radicals. Benwing (talk) 08:58, 29 August 2014 (UTC)
The intrans= argument now should be either yes, y, 1 etc. for an intransitive verb with no passive, prep for an intransitive verb with a prepositional object and hence an impersonal passive, or no, n, 0 etc. for a transitive verb with a passive. Default is transitive except for forms VII, IX, XI - XV and IIq - IVq where it's intransitive, and form VI where it's intransitive w/prepositional object.
BTW I'm probably going to change things so that there's a passive= argument where you directly specify whether something has a passive or an impersonal passive, and then have a separate intrans= argument that's just yes or no and takes its default from the passive= value. The "passive through preposition" is a misleading way of specifying an impersonal passive. Benwing (talk) 11:22, 29 August 2014 (UTC)
This is done. Benwing (talk) 12:03, 29 August 2014 (UTC)
Why does transitivity matter if you already have a passive= parameter? --WikiTiki89 14:05, 29 August 2014 (UTC)
It was there before, and puts the verb into a transitive or intransitive verb category. It also used to display the transitivity in the title, although I see you removed it. Benwing (talk) 00:45, 30 August 2014 (UTC)
The category should be added by the {{lb|ar|intransitive}} on the definition line. No need to duplicate it in the conjugation table. I think we can entirely remove this parameter. --WikiTiki89 13:29, 30 August 2014 (UTC)
The only thing about that is it requires duplicating the declaration on the defn line when it's already available elsewhere. Benwing (talk) 21:30, 30 August 2014 (UTC)
Where is elsewhere? The definition line is the place where transitivity is supposed to be indicated. Especially since it is possible for a verb to have multiple definitions, some of which are transitive and some of which are intransitive. The conjugation table only needs to know whether to omit the passive, regardless of the reason it needs to be omitted. --WikiTiki89 21:41, 30 August 2014 (UTC)
OK, I see what you mean. As I side note, is there such a general Wiktionary category as "transitive through a preposition"? This is like "speak to X" or "dispose of Y" where X and Y are thematic arguments in English and Arabic and hence can be passivized. In English we say "it was spoken to" or "it was disposed of"; in Arabic an impersonal passive is used that can vaguely be rendered "There was a speaking to X" or "There was as disposal of Y" where in place of "There was a speaking" or "There was a disposal" there'd be an impersonal passive -- identical in form to the normal 3sg masc passive but with no subject. It doesn't really do justice to call these uses "intransitive" IMO. Benwing (talk) 11:29, 31 August 2014 (UTC)
Can you give an example in Arabic? There is no need to circumvent Arabic with English. --WikiTiki89 16:22, 31 August 2014 (UTC)
جاء بالفلوس "he brought the money" lit. "he came with the money". For this reason the verb جاء "come" forms a passive (impersonal). Similarly احتاج إلى الفلوس "he needed the money" lit. "he needed to the money". These verbs/usages may be grammatically intransitive but semantically transitive. Benwing (talk) 18:46, 31 August 2014 (UTC)
I was hoping for an example of the passive. --WikiTiki89 01:29, 2 September 2014 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── From John Mace "Arabic Verbs" p. 58: يُشَكُّ فِي أَرْقَامِنَا "Our figures are doubted" where the active would be يَشُكُّونَ فِي أَرْقَامِنَا "They doubt our figures" or whatever. شَكَّ "to doubt" is transitive through the preposition فِي. Benwing (talk) 06:29, 3 September 2014 (UTC)

I see, it makes sense to me now. I actually think that this proves that we should not consider them to be transitive. The passive of a transitive verb takes the verbs object as a subject instead, but here this is not the case since the passive is taking it as an object as well. I think this shows that intransitive verbs can have impersonal passives, and I think that applies even when the intransitive verb does not take any sort of object at all, even through a preposition. To help clarify, the example you just gave can be thought of as (active) "They have doubt in our figures" vs (passive) "Doubt is had in our figures". --WikiTiki89 12:20, 4 September 2014 (UTC)
If passive forms are available, we should make them transitive, IMO. Otherwise, we could just stick to to "|passive=y" without adding transitivity categories. --Anatoli T. (обсудить/вклад) 23:21, 31 August 2014 (UTC)
Also, I think we should move this discussion to Module talk:ar-verb. It really isn't BP material. --WikiTiki89 14:24, 29 August 2014 (UTC)
Moved. --Anatoli T. (обсудить/вклад) 01:37, 3 September 2014 (UTC)