Content deleted Content added
No edit summary |
No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 8:
-- Special cases for verb conjugation that don't follow the regular 's' or 'es' pattern
local specialCases = {
["go"] = "goes",
["do"] = "does"
}
Line 28 ⟶ 29:
local function adjustVerb(originalPronoun, originalVerb)
local pronoun = originalPronoun:lower() -- Use lowercase for logic
local verb = originalVerb and originalVerb:lower() or "" -- Use lowercase for logic, check for nil
local result = ""
--
if verb
-- No verb provided, return pronoun as is
result = applyContinuousVerb(originalPronoun, originalVerb)▼
else
--
if
▲ result = applyContinuousVerb(originalPronoun, originalVerb)
verb = specialCases[verb] or verb -- Apply special case if exists▼
if not verb:match("s$") then▼
-- Simple present tense for singular third-person
verb = verb .. (needsEsEnding(verb) and "es" or "s")▼
if pronoun == "he" or pronoun == "she" or pronoun == "it" then
▲ end
▲ verb = verb .. (needsEsEnding(verb) and "es" or "s")
end▼
else
verb = verb:sub(1, -3)
elseif verb:match("s$") then
verb = verb:sub(1, -2)
end
end
end
▲ if verb:match("es$") then
▲ verb = verb:sub(1, -3)
▲ elseif verb:match("s$") then
▲ verb = verb:sub(1, -2)
▲ end
end
▲ result = originalPronoun .. " " .. verb
end▼
-- Preserve the original case without converting everything to
if isAllCaps(originalPronoun) and isAllCaps(originalVerb) then
result = result:upper() -- Only convert to uppercase if both inputs were uppercase
▲ end
end
Line 68 ⟶ 77:
function p.main(frame)
local originalPronoun = frame.args[1]
local originalVerb = frame.args[2] -- This can be nil or empty
return adjustVerb(originalPronoun, originalVerb) -- Adjust and return the result
end
|