Modul:eo-IPA

Hej, du har kommit hit för att leta efter betydelsen av ordet Modul:eo-IPA. I DICTIOUS hittar du inte bara alla ordboksbetydelser av ordet Modul:eo-IPA, utan du får också veta mer om dess etymologi, dess egenskaper och hur man säger Modul:eo-IPA i singular och plural. Allt du behöver veta om ordet Modul:eo-IPA finns här. Definitionen av ordet Modul:eo-IPA hjälper dig att vara mer exakt och korrekt när du talar eller skriver dina texter. Genom att känna till definitionen avModul:eo-IPA och andra ord berikar du ditt ordförråd och får tillgång till fler och bättre språkliga resurser.

Dokumentation för denna modul finns på /dok (redigera), /test


Användning

Enbart via {{ipa}}.

Parametrar

  • (namngiven och frivillig) word= behövs enbart för dokumentation och testande (modulen behöver aldrig "hjälp")

Självtest

ĉiuĵaŭde ->
ĈIUĴAŬDE ->
Rio-de-Ĵanejro ->
Mi estas finvenkisto! ->

en.wiktionary

-- based on https://en.wiktionary.orghttps://dictious.com/sv/Module:eo-pron
-- this module must NOT be "updated" by blindly copying from that page
-- authors: "DTLHS" et al
-- modification for non-en wiktionaries: "Taylor 49"

local export = {}

local has_vowel, term_to_words, string_to_letters, string_to_syllables,
  string_to_ipa, letters_to_syllables, strip_initial_consonants, term_to_IPA

local consonants = {
   = "b",
   = "t͡s",
   = "t͡ʃ",
   = "d",
   = "f",
   = "ɡ",
   = "d͡ʒ",
   = "h",
   = "x",
   = "j",
   = "ʒ",
   = "k",
   = "l",
   = "m",
   = "n",
   = "p",
   = "r",
   = "s",
   = "ʃ",
   = "t",
   = "v",
   = "z",
   = "w"}

local vowels = {
   = "a",
   = "e",
   = "i",
   = "o",
   = "u",

}

local letters_phonemes = {}

-- combine into single table
for k, v in pairs(vowels) do letters_phonemes = v end
for k, v in pairs(consonants) do letters_phonemes = v end

function term_to_words(term)
  -- split by spaces, hyphens, or periods
  return mw.text.split(term, '')
end
function string_to_letters(term)
  return mw.text.split(term, "")
end

function letters_to_syllables(letters)

  if not letters then
    return { = letters}
  end
  local l_r_exceptions = { = true,  = true,  = true,  = true}

  local result = { = ""}
  local j = 1
  for i = 1, #letters - 2 do
    result = result .. letters
    local letter = mw.ustring.lower(letters)
    local letter1 = mw.ustring.lower(letters)
    local letter2 = mw.ustring.lower(letters)

    if vowels then
      if consonants and vowels then
        -- single consonant goes with following vowel
        if has_vowel(result) and (letter1 ~= 'ŭ') then
          j = j + 1
          result = ""
        end

      elseif consonants and not l_r_exceptions and (letter2 == 'l' or letter2 == 'r') and (letter1 ~= 'l' and letter1 ~= 'r') then
        -- consonant followed by l or r goes with l or r
        if has_vowel(result) then
          j = j + 1
          result = ""
        end

      elseif vowels then
        -- two vowels
        if has_vowel(result) then
          j = j + 1
          result = ""
        end
      end
    elseif consonants then
      if consonants and vowels then
        if (mw.ustring.len(result) ~= 1) then
          -- single consonant goes with following vowel
          if has_vowel(result) then
            j = j + 1
            result = ""
          end
        end
      elseif consonants and not l_r_exceptions and (letter2 == 'l' or letter2 == 'r') and (letter1 ~= 'l' and letter1 ~= 'r') then
        -- consonant followed by l or r goes with l or r
        if has_vowel(result) then
          j = j + 1
          result = ""
        end

      elseif vowels then
        -- two vowels
        if has_vowel(result) then
          j = j + 1
          result = ""
        end
      end
    end
  end

  -- add last two letters
  if letters then
    local c1 = letters
    local c2 = letters

    if c1 ~= 'ŭ' then
            if vowels and vowels then
                result = result .. c1
                j = j + 1
                result = c2
            elseif has_vowel(result) and has_vowel(c1 .. c2) then
              j = j + 1
              result = c1 .. c2
          else
            result = result .. c1 .. c2
        end

        else
            if vowels] and vowels then
              result = result .. c1
                j = j + 1
                result = c2
            elseif has_vowel(result) and has_vowel(c1 .. c2) then
              j = j + 1
              result = c1 .. c2
          else
            result = result .. c1 .. c2
        end
        end
    end


  local result2 = {}
  for i, j in pairs(result) do
    if j and j ~= "" then
      table.insert(result2, j)
    end
  end
  return result2
end

function string_to_syllables(term)
  -- split if given artificial syllable breaks
  local split_input = mw.text.split(term, '‧', true)
  local result = {}
  for _, split in pairs(split_input) do
    for j, syllable in pairs(letters_to_syllables(string_to_letters(split))) do
      table.insert(result, syllable)
    end
  end

  return result

end

function string_to_ipa(syllable)

  local syllable_letters = string_to_letters(syllable)
  local syllable_ipa = ""

  for k, letter in pairs(syllable_letters) do
    if letters_phonemes then
      syllable_ipa = syllable_ipa .. letters_phonemes
    end

  end
  return syllable_ipa
end

function has_vowel(term)
  return mw.ustring.lower(term):find("") ~= nil
end

function strip_initial_consonants(term)
  local letters = string_to_letters(term)
  local result = {}

  local gate = false
  for i, j in pairs(letters) do
    if vowels then
      gate = true
    end

    if gate then
      table.insert(result, j)
    end
  end

  return table.concat(result)
end


function term_to_IPA(term)

  local words = term_to_words(term)
  local result = {}

  for i, word in pairs(words) do
    if word ~= "" then
      -- add /o/ if word is a single character and a consonant
      if mw.ustring.len(word) == 1 then
        if consonants then
          word = word .. 'o'
        end
      end

      -- break into syllables and make each into IPA
      local hyphenated = string_to_syllables(word)
      local word_result = {}
      for j, syllable in pairs(hyphenated) do
        local syllable_ipa = string_to_ipa(syllable)
        word_result = syllable_ipa
      end

      -- add stress to penultimate syllable, and set rhyme to last two syllables
      if word_result then
        word_result = "ˈ" .. word_result
      end

      result = table.concat(word_result)
    end
  end

  return result

end

function export.IPA (arxframent)
  local pron = ''
  local IPA_input = mw.title.getCurrentTitle().text -- {{PAGENAME}}
  arxourown = arxframent.args
  local strover = arxourown -- use only if needed
  if (type(strover)=="string") then
    if (string.len(strover)~=0) then
      IPA_input = strover -- override only if parameter is non-empty (due to forwarding)
    end--if
  end--if
  IPA_input = mw.ustring.lower(IPA_input)
  pron = ""
  return pron
end

return export