Content deleted Content added
No edit summary |
No edit summary |
||
(15 intermediate revisions by the same user not shown) | |||
Line 1:
local p = {}
-- Checks if a verb needs an 'es' ending (for third-person singular simple present tense)
-- Adjusts the verb based on the pronoun and the verb tense, preserving original pronoun capitalization▼
local function
return verb:match("[oschx]$") or verb:match("sh$") or verb:match("ss$")
local pronoun = originalPronoun:lower() -- Use a lowercase version for logic▼
end
if verb:sub(-3) == "ing" then▼
-- Special cases for verb conjugation that don't follow the regular 's' or 'es' pattern
if pronoun == "he" or pronoun == "she" or pronoun == "it" then▼
local specialCases = {
return originalPronoun .. " is " .. verb▼
["do"] = "does"
return originalPronoun .. " are " .. verb▼
}
end▼
-- Determines if the string is fully uppercase
local function isAllCaps(s)
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
end
if pronoun == "he" or pronoun == "she" or pronoun == "it" then▼
end
if verb == "go" then▼
▲-- Adjusts the verb based on the pronoun
verb = "goes"▼
local function adjustVerb(originalPronoun, originalVerb)
elseif not verb:match("s$") then -- Add 's' if it doesn't already end with one▼
verb = verb .. "s"▼
local verb = originalVerb and originalVerb:lower() or "" -- Use lowercase for logic, check for nil
local result = ""
-- Check if a verb is provided
if verb == "" then
-- No verb provided, return pronoun as is
else
-- Handle verb logic
▲ if verb:sub(-3) == "ing" then
result = applyContinuousVerb(originalPronoun, originalVerb)
else
-- Simple present tense for singular third-person
▲ if pronoun == "he" or pronoun == "she" or pronoun == "it" then
else
verb = specialCases[verb] or verb -- Apply special case if exists
verb = verb .. (needsEsEnding(verb) and "es" or "s")
end
end
if verb == "has" then
else
verb = specialCases[verb] or verb
if verb:match("es$") then
verb = verb:sub(1, -2)
end
end
end
▲ end
▲ elseif pronoun == "they" and verb:match("s$") then
-- Preserve the original case without converting everything to uppercase
▲ verb = verb:sub(1, -2) -- Remove 's' for regular verbs
if isAllCaps(originalPronoun) and isAllCaps(originalVerb) then
result = result:upper() -- Only convert to uppercase if both inputs were uppercase
end
end
return result
end
function p.main(frame)
local originalPronoun = frame.args[1]
local
return adjustVerb(originalPronoun,
end
|