Module:rad-syllables: Difference between revisions

Added generate_array
(Added apostrophes to affix group)
(Added generate_array)
Line 153: Line 153:
end
end


function syllabify(graphemes, divider)
function syllabify(graphemes)
mw.log("————— SYLLABIFYING —————")
mw.log("————— SYLLABIFYING —————")
Line 290: Line 290:
end
end
end
end
return graphemes
end
function export.generate(frame)
local args = getArgs(frame)
if args[1] == nil then
error("Word needed.")
end
local outputSyllables = args[1]
outputSyllables = graphemise(outputSyllables)
outputSyllables = syllabify(outputSyllables)
local divider = args[2]
if divider == nil then
if divider == nil then
Line 295: Line 314:
end
end


graphemes = table.concat(graphemes)
outputSyllables = table.concat(outputSyllables)
graphemes = mw.ustring.gsub(graphemes, "(σ)", divider)
outputSyllables = mw.ustring.gsub(outputSyllables, "(σ)", divider)
 
return graphemes
return outputSyllables
end
end


 
function export.generate_array(frame)
function export.generate(frame)
local args = getArgs(frame)
local args = getArgs(frame)
Line 313: Line 331:
outputSyllables = graphemise(outputSyllables)
outputSyllables = graphemise(outputSyllables)
outputSyllables = syllabify(outputSyllables, args[2])
outputSyllables = syllabify(outputSyllables)
 
return outputSyllables
return outputSyllables