Content deleted Content added
No edit summary |
No edit summary |
||
(13 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"
}
-- Determines if the string is fully uppercase
-- Adjusts the verb based on the pronoun, verb tense, and maintains original capitalization▼
local function
return s:upper() == s
end
-- Correctly applies 'is' or 'are' for continuous verbs based on pronoun, retaining input case
local function applyContinuousVerb(pronoun, verb)
if pronoun:lower() == "they" then
else
return pronoun .. " is " .. verb
end
local function adjustVerb(originalPronoun, originalVerb)
local pronoun = originalPronoun:lower() -- Use lowercase for logic
local verb =
▲ verb = verb:lower() -- Use lowercase for logic
local result = ""
-- Check if
-- No verb provided, return
▲ return originalPronoun .. " are " .. originalVerb
▲ end
else
--
if
result = applyContinuousVerb(originalPronoun, originalVerb)
if not verb:match("s$") then▼
-- Simple present tense
if pronoun == "he" or pronoun == "she"
else
verb = specialCases[verb]
▲ if not verb:match("s$") then
verb = verb .. (needsEsEnding(verb) and "es" or "s")
end
if verb:match("es$")
verb = verb:sub(1, -3)
elseif verb:match("s$") then
verb = verb:sub(1, -2)
end
end
end
result = originalPronoun .. " " .. verb
▲ verb = verb:sub(1, -3)
-- Preserve the original case without converting everything to uppercase
▲ elseif verb:match("s$") then
if isAllCaps(originalPronoun) and isAllCaps(originalVerb) then
▲ verb = verb:sub(1, -2)
result = result:upper() -- Only convert to uppercase if both inputs were uppercase
▲ end
end
end
return result
end
function p.main(frame)
local originalPronoun = frame.args[1]
local
return adjustVerb(originalPronoun,
end
|