Conjugating objects in descriptions

I would like to know what is the best way to conjugate verbs describing an object when the object's number is unknown. For example, when dealing with common functionality across multiple objects of variable plurality through object types and displaying a simple default message defined in the type itself, I want to be able to write, dynamically, "it is red" or "they are red". The article is defined on an object-per-object basis, and as a basic attribute I am satisfied with it. However, verb conjugation is a problem. I do not want to create a passive verb, I do not want to add a redundant plurality attribute, and as there are multiple types of plural objects, parsing them all is awkward, though it seems like the best solution from my perspective. Is there any better way of doing it? If not, what IS the syntax for validating whether an object's type is singular or plural?


Try using the Conjugate function?

msg (GetDisplayAlias(obj) + " " + Conjugate (obj, "answer") + " your question.")

(the English one has proper lists of verb forms for "do" and "be"; for everything else it looks like it just decides if it should add an 's'. Different language libraries might have more advanced forms of this function)

It's also used by WriteVerb. Depending on the object you pass it, WriteVerb (obj, "be") could return "He is", "You are", "They are", and so on.


Thank you, that seems perfect. I thought that Conjugate required creating a new Verb entry since the documentation did not specify the argument type.


On the desktop version, you could override the function to add your own verbs, if you want it to handle more irregular ones. The version I see in English.aslx looks like:

  <function name="Conjugate" type="string" parameters="obj, verb">
    gender = obj.gender
    if (gender = "he" or gender = "she") {
      gender = "it"
    }
    switch (verb) {
      case ("be") {
        switch (gender) {
          case ("i") {
            return ("am")
          }
          case ("you") {
            return ("are")
          }
          case ("it") {
            return ("is")
          }
          case ("we") {
            return ("are")
          }
          case ("they") {
            return ("are")
          }
          default {
            return ("is")
          }
        }
      }
      case ("do") {
        switch (gender) {
          case ("i") {
            return ("do")
          }
          case ("you") {
            return ("do")
          }
          case ("it") {
            return ("does")
          }
          case ("we") {
            return ("do")
          }
          case ("they") {
            return ("do")
          }
          default {
            return ("do")
          }      
        }
      }
      default {
        if (gender = "it") {
          return (verb + "s")
        }
        else {
          return (verb)
        }
      }
    }
  </function>

So if there's more irregular verbs, you can just add more case blocks to that.


You may try using the Conjugate function.
msg (GetDisplayAlias(obj) + " " + Conjugate (obj, "answer") + " your question.")
gmail sign up


The above is spam. They are getting more clever, and copying text from earlier posts to make it look like they are joining the discussion.

[to whoever deletes it, please delete this too when you do]


Log in to post a reply.

Support

Forums