Module:Grammar: Difference between revisions

471 bytes added ,  01:46, 31 July 2019
m
no edit summary
mNo edit summary
mNo edit summary
Line 18: Line 18:


parsedtext = string.gsub(frame.args[1], "=([^=]+)=", function(f)
parsedtext = string.gsub(frame.args[1], "=([^=]+)=", function(f)
  for a, b, c in string.gmatch(string.lower(f), "(%w*)[:%.](%w*)(:?%w*)") do
  for a, b, c in string.gmatch(f, "(%w*)[:%.](%w*)(:?%w*)") do
  local capitalized = (string.gsub(b, "(^%w)", string.upper("%1")) == string.gsub(b,"(^%w)","%1"))
  returnstring = ""
  b = string.lower(b)
   if (a == "player") then
   if (a == "player") then
       return "(player's " .. b .. ")"
       returnstring = "(player's " .. b .. ")"
   elseif (a == "pronouns") then
   elseif (a == "pronouns") then
       if (b == "indicativeproximal") then
       if (b == "indicativeproximal") then
           return "this"
           if (p.isplural(gender,pronoun)) then
      end
              returnstring = "these"
       local results = p.parse(b, gender, pronoun)
          else
      if not results then  
              returnstring = "this"
return "No results!"
          end
       else
        local results = p.parse(b, gender, pronoun)
        if not results then  
  returnstring = "No results!"
        end
          returnstring = results[1][b]
       end
       end
      return results[1][b]
   elseif (a == "verb") then
   elseif (a == "verb") then
       if (c == nil or c == '') then
       if (c == nil or c == '') then
           return b
           returnstring = b
       end
       else


       local results = p.isplural(gender,pronoun)
       local results = p.isplural(gender,pronoun)
Line 39: Line 47:
       if (results == '0') then
       if (results == '0') then
         if (b == "are") then
         if (b == "are") then
             return "is"
             returnresults= "is"
         else
         else
             return b .. "s"
             returnresults= b .. "s"
         end
         end
       else  
       else  
         return b
         returnresults = b
      end
       end
       end
   else
   else
       return f
      returnresults = f
  end
  if (capitalized == true) then
       return (returnresults:gsub("^%l", string.upper))
  else
      return returnresults
   end
   end
  return "error"
   end
   end
end)
end)
Line 95: Line 108:
           return result[1]['pseudoplural']
           return result[1]['pseudoplural']
         else  
         else  
           if (result[1]['pseudoplural'] == '1' or resulttwo[1]['plural'] == '1') then
           if (result[1]['pseudoplural'] == true or resulttwo[1]['plural'] == true) then
    return '1'
    return '1'
           else
           else