Module:az-last-vowel
- The following documentation is located at Module:az-last-vowel/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module helps you retrieve the last vowel in an Azerbaijani word, which is necessary for maintaining the vowel harmony.
Vowels in Azerbaijani
[edit]There are 9 vowels in Azerbaijani: a
, e
, ə
, ı
, i
, o
, ö
, u
, and ü
.
As some Azerbaijani suffixes have multiple forms, the last vowel plays a key role when appending suffixes to words. For example, the genitive case suffix, -ın
has 4 different forms: -ın
, -in
, -un
, and -ün
, and which one to use depends on the last vowel of the lemma. You can read more about it in Module:az-harmony.
How to use
[edit]From modules
[edit]You can use _main()
function, passing the word as an argument, and the function will return the vowel as a string:
local get_last_vowel = require("Module:az-last-vowel")._main
local last_vowel = get_last_vowel("söz") -- returns "ö"
From templates
[edit]There is a main()
function that wraps the core _main()
for templates. You can invoke it with the word as an argument, and it'll return the vowel:
{{#invoke:az-last-vowel|main|nümunə}} <!-- returns "ə" -->
local export = {}
function export._main(str)
local last_vowel = nil
for i = mw.ustring.len(str), 1, -1 do
local char = mw.ustring.sub(str, i, i)
if mw.ustring.find("AIOUEƏİÖÜaıoueəiöü", char, 1, true) then
last_vowel = char
break
end
end
return last_vowel
end
function export.main(frame)
return export._main(frame:getParent().args[1])
end
return export