Module:Pronoun: Difference between revisions

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Jump to navigation Jump to search
Content deleted Content added
Created page with "local p = {} -- A function to check if the verb ends in 's' and should change based on pronoun local function adjustVerb(pronoun, verb) if pronoun == "he" or pronoun == "she" or pronoun == "it" then -- Add 's' for singular third-person, if it doesn't already end with 's' if not verb:match("s$") then verb = verb .. "s" end elseif pronoun == "they" then -- Remove 's' for 'they', consider special cases like 'goes' -> 'go'..."
 
No edit summary
Line 1: Line 1:
local p = {}
local p = {}


-- A function to check if the verb ends in 's' and should change based on pronoun
-- Adjusts the verb based on the pronoun and the verb tense
local function adjustVerb(pronoun, verb)
local function adjustVerb(pronoun, verb)
-- Handle continuous tense (verbs ending in 'ing')
if pronoun == "he" or pronoun == "she" or pronoun == "it" then
if verb:sub(-3) == "ing" then
-- Add 's' for singular third-person, if it doesn't already end with 's'
if not verb:match("s$") then
if pronoun == "he" or pronoun == "she" or pronoun == "it" then
verb = verb .. "s"
return pronoun .. " is " .. verb
elseif pronoun == "they" then
return pronoun .. " are " .. verb
end
end
else
elseif pronoun == "they" then
-- Remove 's' for 'they', consider special cases like 'goes' -> 'go'
-- Handle simple present tense for singular third-person
if verb:match("es$") then
if pronoun == "he" or pronoun == "she" or pronoun == "it" then
-- Remove 'es' for verbs that end in 'es', like 'goes'
-- Special case for 'go' -> 'goes'; expand as needed for other irregular verbs
if verb == "go" then
verb = "goes"
-- Add 's' if it doesn't already end with one, excluding verbs ending in 'ing'
elseif not verb:match("s$") then
verb = verb .. "s"
end
-- Remove the 's' for 'they', considering special verbs like 'goes' -> 'go'
elseif pronoun == "they" and verb:match("es$") then
verb = verb:sub(1, -3)
verb = verb:sub(1, -3)
elseif verb:match("s$") then
elseif pronoun == "they" and verb:match("s$") then
-- Remove 's' for regular verbs
verb = verb:sub(1, -2)
verb = verb:sub(1, -2)
end
end
return pronoun .. " " .. verb
end
end
return verb
end
end


Line 24: Line 33:
local pronoun = frame.args[1]
local pronoun = frame.args[1]
local verb = frame.args[2]
local verb = frame.args[2]
verb = adjustVerb(pronoun, verb) -- Adjust the verb based on the pronoun
return adjustVerb(pronoun, verb) -- Adjust the verb based on the pronoun and return the result

return pronoun .. " " .. verb
end
end



Revision as of 19:12, 18 March 2024

Documentation for this module may be created at Module:Pronoun/doc

local p = {}

-- Adjusts the verb based on the pronoun and the verb tense
local function adjustVerb(pronoun, verb)
    -- Handle continuous tense (verbs ending in 'ing')
    if verb:sub(-3) == "ing" then
        if pronoun == "he" or pronoun == "she" or pronoun == "it" then
            return pronoun .. " is " .. verb
        elseif pronoun == "they" then
            return pronoun .. " are " .. verb
        end
    else
        -- Handle simple present tense for singular third-person
        if pronoun == "he" or pronoun == "she" or pronoun == "it" then
            -- Special case for 'go' -> 'goes'; expand as needed for other irregular verbs
            if verb == "go" then
                verb = "goes"
            -- Add 's' if it doesn't already end with one, excluding verbs ending in 'ing'
            elseif not verb:match("s$") then
                verb = verb .. "s"
            end
        -- Remove the 's' for 'they', considering special verbs like 'goes' -> 'go'
        elseif pronoun == "they" and verb:match("es$") then
            verb = verb:sub(1, -3)
        elseif pronoun == "they" and verb:match("s$") then
            verb = verb:sub(1, -2)
        end
        return pronoun .. " " .. verb
    end
end

function p.main(frame)
    local pronoun = frame.args[1]
    local verb = frame.args[2]
    return adjustVerb(pronoun, verb) -- Adjust the verb based on the pronoun and return the result
end

return p