Beispiel #1
0
        List <string> makeGerunPhrase(Idea idea, Dictionary dictionary)
        {
            if (idea.indirectObject != null)
            {
                if (dictionary.indirectObjects.findPerson(idea.indirectObject, Language.english) == dictionary.subjects.findPersonForSubject(idea.subject, Language.english))
                {
                    switch (idea.indirectObject)
                    {
                    case "me":
                        idea.indirectObject = "myself";
                        break;

                    case "you":
                        idea.indirectObject = "yourself";
                        break;

                    case "it":
                        if (idea.indirectObject == "it" && idea.subject == "it")
                        {
                            idea.indirectObject = "itself";
                        }
                        break;

                    case "him":
                        if (idea.indirectObject == "him" && idea.subject == "he")
                        {
                            idea.indirectObject = "himself";
                        }
                        break;

                    case "her":
                        if (idea.indirectObject == "her" && idea.subject == "she")
                        {
                            idea.indirectObject = "herself";
                        }
                        break;

                    case "us":
                        idea.indirectObject = "ourselves";
                        break;

                    case "them":
                        idea.indirectObject = "themselves";
                        break;
                    }
                }
            }
            if (idea.directObject != null)
            {
                if (dictionary.directObjects.findPerson(idea.directObject, Language.english) == dictionary.subjects.findPersonForSubject(idea.subject, Language.english))
                {
                    switch (idea.directObject)
                    {
                    case "me":
                        idea.directObject = "myself";
                        break;

                    case "you":
                        idea.directObject = "yourself";
                        break;

                    case "it":
                        if (idea.directObject == "it" && idea.subject == "it")
                        {
                            idea.directObject = "itself";
                        }
                        break;

                    case "him":
                        if (idea.directObject == "him" && idea.subject == "he")
                        {
                            idea.directObject = "himself";
                        }
                        break;

                    case "her":
                        if (idea.directObject == "her" && idea.subject == "she")
                        {
                            idea.directObject = "herself";
                        }
                        break;

                    case "us":
                        idea.directObject = "ourselves";
                        break;

                    case "them":
                        idea.directObject = "themselves";
                        break;
                    }
                }
            }
            Person        person      = dictionary.subjects.findPersonForSubject(idea.subject, Language.english);
            List <string> gerunPhrase = new List <string>(2);

            if (idea.negitive == false)
            {
                gerunPhrase.Add(idea.verb.englishForms.allForms()[(int)person]);
            }
            else
            {
                if (idea.verb.englishInfinitive == "be" ||
                    idea.verb.englishInfinitive == "can")
                {
                    gerunPhrase.Add(idea.verb.englishForms.allForms()[(int)person]);
                    gerunPhrase.Add("not");
                }
                else
                {
                    gerunPhrase.Add("don't");
                    gerunPhrase.Add(idea.verb.englishForms.allForms()[(int)person]);
                }
            }
            if (idea.auxilleryVerb != null)
            {
                if (idea.verbTypes == VerbTypes.conjugated_participle)
                {
                    gerunPhrase.Add(idea.auxilleryVerb.englishParticiple);
                }
                if (idea.verbTypes == VerbTypes.conjugated_infinitive)
                {
                    gerunPhrase.Add("to");
                    gerunPhrase.Add(idea.auxilleryVerb.englishInfinitive);
                }
            }
            if (idea.directObject != null)
            {
                gerunPhrase.Add(idea.directObject);
            }
            if (idea.indirectObject != null)
            {
                gerunPhrase.Add("to");
                gerunPhrase.Add(idea.indirectObject);
            }
            return(gerunPhrase);      //Make infinitvie folow "to" or "a"
        }                             //Make infinitvie folow "to" or "a"
Beispiel #2
0
        public Idea understand(String scentence, Dictionary dictionary)
        {
            string newScentence = "";

            foreach (char letter in scentence)
            {
                if (char.IsLetter(letter) || letter == ' ' || letter == '\'')
                {
                    newScentence += char.ToLower(letter);
                }
            }
            scentence = newScentence;
            Idea          idea  = new Idea("tú", null, null, null, null, IdeaType.declarative, false);
            List <string> words = scentence.Split(new char[2] {
                ' ', ','
            }).ToList();
            bool   pronounsAttatched = false;
            string commandVerbRoot   = "";

            for (int wordNum = 0; wordNum < words.Count(); /*incrementor at bottom*/)
            {
                string word = words[wordNum].ToLower();
                //go through the word and remove accent marks except for saber: 'sé'

                /*
                 * bool okayToRemoveAccents = true;
                 * foreach (string exception in new string[1] { "sé" })
                 * {
                 *  if (word == exception)
                 *  {
                 *      okayToRemoveAccents = false;
                 *  }
                 * }
                 * if (okayToRemoveAccents == true)
                 * {
                 *  //remove accents func
                 *  word = removeAccents(word);
                 * }
                 */
                if (word == "no")         /// this is wrong; check for negation directly after the subject or at the beggining
                {
                    idea.negitive = true; //but it'll do
                }
                bool foundVerb = false;
                foreach (Verb verb in dictionary.verbs)
                {
                    //see if it's the main verb
                    List <string> allPossibleConjugatedForms = verb.spanishForms.allForms().ToList();
                    foreach (Person person in new Person[6] {
                        Person.firstSing,
                        Person.secondSing,
                        Person.thirdSing,
                        Person.firstPlural,
                        Person.secondPlural,
                        Person.thirdPlural
                    })
                    {
                        if (word == verb.spanishForms.allForms()[(int)person].ToLower() && idea.verb == null)
                        {
                            foundVerb      = true;
                            idea.verb      = verb;
                            idea.ideaType  = IdeaType.declarative;
                            idea.verbTypes = VerbTypes.conjugated;
                            idea.subject   = dictionary.subjects.spanishDefaults[(int)person];
                            if (word == verb.spanishCommandForms.allForms()[1 /*2*/])//If this causes problems, remove it
                            {
                                idea.possiblyTuCommandOrThirdPeron = true;
                                //idea.ideaType = IdeaType.command;
                            }
                        }
                    }
                    //see if it's a spanish infinitive
                    string rootWord = "xxxxxxxxxxxxxxxxxxxxxxxx";
                    if (foundVerb == false)
                    {
                        string[] affirmatives  = verb.spanishCommandForms.allForms();
                        string   affirmativeTu = affirmatives[2];
                        if (word.Length >= verb.spanishInfinitive.Length) //this looks ugly but I've yet to find a bug in it
                        {
                            rootWord = word.Substring(0, verb.spanishInfinitive.Length);
                        }
                        else if (word.Length >= affirmativeTu.Length)
                        {
                            rootWord = word.Substring(0, affirmativeTu.Length);
                        }
                        //this doesn't work with all the shorites like 'pon', 'haz', etc.
                        if (removeAccents(rootWord) == verb.spanishInfinitive && idea.auxilleryVerb == null)
                        {
                            //it is an infinitive
                            if (idea.verb == null)
                            {
                                idea.verb          = verb;
                                idea.auxilleryVerb = null;
                                idea.verbTypes     = VerbTypes.infinitive;
                                return(idea); //this is new and hasn't been tested. if it's a problem, remove it
                            }
                            else
                            {
                                idea.auxilleryVerb = verb;
                                idea.verbTypes     = VerbTypes.conjugated_infinitive;
                            }
                            if (removeAccents(rootWord) != removeAccents(word))
                            {
                                pronounsAttatched = true;
                            }
                            idea = extractor(idea, removeAccents(word.Substring(rootWord.Length)), dictionary);
                        }
                    }
                    //see if it's a spanish participle
                    if (word.Length >= verb.spanishParticiple.Length)
                    {
                        rootWord = removeAccents(word.Substring(0, verb.spanishParticiple.Length));
                    }
                    if (removeAccents(rootWord) == verb.spanishParticiple && idea.auxilleryVerb == null)
                    {
                        //it is a spanish participle
                        idea.auxilleryVerb = verb;
                        if (idea.verb == null)
                        {
                            //having trouble recognizing the verb
                            throw new Exception("No conjugated verb before participle");
                        }
                        else
                        {
                            idea.verbTypes = VerbTypes.conjugated_participle;
                        }
                        if (removeAccents(rootWord) != removeAccents(word))
                        {
                            pronounsAttatched = true;
                        }
                        idea = extractor(idea, removeAccents(word.Substring(rootWord.Length)), dictionary);
                    }
                    //see if it's an command
                    Person commandPerson = Person.secondSing;
                    for (int commandTenseNum = 0; commandTenseNum < 4; commandTenseNum++) //-we, -y'all, -you, -you(formal)
                    {
                        switch (commandTenseNum)
                        {
                        case 0:
                            commandPerson = Person.firstPlural;
                            break;

                        case 1:
                            commandPerson = Person.secondPlural;
                            break;

                        case 2:
                            commandPerson = Person.secondSing;
                            break;

                        case 3:
                            commandPerson = Person.thirdSing;
                            break;
                        }
                        //check for affirmative form
                        string[] allForms        = verb.spanishCommandForms.allForms();
                        string   affirmativeVerb = verb.spanishCommandForms.allForms()[commandTenseNum];
                        if (idea.ideaType != IdeaType.command)
                        {
                            if (word.Length >= affirmativeVerb.Length)
                            {
                                rootWord = removeAccents(word.Substring(0, affirmativeVerb.Length));
                            }
                            List <string> possibleIndirects = dictionary.indirectObjects.indirectObjects(Language.spanish);
                            List <string> possibleDirects   = dictionary.directObjects.directObjects(Language.spanish);
                            possibleIndirects.Add("");
                            possibleDirects.Add("");
                            foreach (string possibleIndirect in possibleIndirects)
                            {
                                foreach (string possibleDirect in possibleDirects)
                                {
                                    bool wordsAreEqual = removeAccents(word) == (removeAccents(rootWord) + removeAccents(possibleIndirect)
                                                                                 + removeAccents(possibleDirect));
                                    bool equalsAffVerb = removeAccents(affirmativeVerb) == removeAccents(rootWord);
                                    if (wordsAreEqual && equalsAffVerb)
                                    {
                                        idea.verb           = verb;
                                        idea.indirectObject = (possibleIndirect == "") ? null : removeAccents(possibleIndirect);
                                        idea.directObject   = (possibleDirect == "") ? null : removeAccents(possibleDirect);
                                        idea.subject        = dictionary.subjects.spanishDefaults[(int)commandPerson];
                                        idea.ideaType       = IdeaType.command;
                                        if (removeAccents(rootWord) != removeAccents(word))
                                        {
                                            pronounsAttatched = true;
                                            idea.possiblyTuCommandOrThirdPeron = false;
                                        }
                                        else
                                        {
                                            pronounsAttatched = false;
                                        }

                                        /*if (removeAccents(word) == verb.spanishForms.allForms()[2])
                                         * {
                                         *  idea.eitherIOPorDOP = true;
                                         * }*/
                                        if (possibleIndirect == "" ^ possibleDirect == "")
                                        {
                                            string combo = possibleDirect + possibleIndirect;
                                            if (combo != "les" || combo != "las" || combo != "los" ||
                                                combo != "le" || combo != "la" || combo != "lo")
                                            {
                                                idea.eitherIOPorDOP = true;
                                            }
                                        }
                                        if (word == verb.spanishCommandForms.allForms()[2] && word == verb.spanishForms.allForms()[2])
                                        {
                                            idea.subject  = dictionary.subjects.spanishDefaults[2];
                                            idea.ideaType = IdeaType.declarative;
                                            idea.possiblyTuCommandOrThirdPeron = true;
                                            goto endOfWordThinker;
                                        }
                                    }
                                }
                                //now check for negitive command form
                                if (verb.spanishCommandForms.allForms()[commandTenseNum + 4] == word.ToLower())
                                {
                                    idea.verb         = verb;
                                    commandVerbRoot   = rootWord;
                                    pronounsAttatched = false;
                                    idea.ideaType     = IdeaType.command;
                                    idea.subject      = dictionary.subjects.spanishDefaults[(int)commandPerson];
                                }
                            }
                        }
                    }
                }
endOfWordThinker:
                wordNum++;
            }

            /*
             * if (idea.negitive == false && idea.subject == dictionary.subjects.spanishDefaults[2] &&
             *  idea.indirectObject == null && idea.directObject == null)// add some clause  to not make 'de' possibly
             * {
             *  idea.possiblyTuCommandOrThirdPeron = true;
             * }*/
            if (pronounsAttatched == false)
            {
                foreach (string word in words)
                {
                    foreach (string indirectObject in
                             dictionary.indirectObjects.indirectObjects(Language.spanish))
                    {
                        if (word.ToLower() == indirectObject)
                        {
                            idea.indirectObject = indirectObject;
                            idea.eitherIOPorDOP = true;
                            //look to see if there's a DOP
                            foreach (string directObject in dictionary.directObjects.directObjects(Language.spanish))
                            {
                                if (words.Count > words.IndexOf(idea.indirectObject) - 1)
                                {
                                    if (words[words.IndexOf(idea.indirectObject) + 1].ToLower() == directObject)
                                    {
                                        idea.directObject   = directObject;
                                        idea.eitherIOPorDOP = false;
                                    }
                                }
                            }
                        }
                    }
                    if (idea.indirectObject == null)
                    {
                        foreach (string directObject in
                                 dictionary.directObjects.directObjects(Language.spanish))
                        {
                            if (word.ToLower() == directObject)
                            {
                                idea.directObject = directObject;
                            }
                        }
                    }
                }
            }
            foreach (string word in words)
            {
                foreach (string possibleFemininePronoun in dictionary.subjects.subjectsOfGender(Gender.feminine))
                {
                    if (word.ToLower() == possibleFemininePronoun)
                    {
                        idea.subject          = possibleFemininePronoun;
                        idea.masculineSubject = false;
                        idea.foundSubject     = true;
                    }
                }
                foreach (string possibleMasculinePronoun in dictionary.subjects.subjectsOfGender(Gender.masculine))
                {
                    if (word.ToLower() == possibleMasculinePronoun)
                    {
                        idea.subject          = possibleMasculinePronoun;
                        idea.masculineSubject = true;
                        idea.foundSubject     = true;
                    }
                }
            }
            if (idea.ideaType == IdeaType.command && idea.verbTypes == VerbTypes.infinitive)
            {
                idea.verbTypes = VerbTypes.conjugated;
            }
            if (idea.ideaType == IdeaType.command)
            {
                if (dictionary.subjects.findPersonForSubject(idea.subject, Language.spanish) == Person.thirdSing)
                {
                    idea.subject = dictionary.subjects.spanishDefaults[1];
                }
            }
            if (pronounsAttatched == false)
            {
                if (idea.negitive == false && (idea.indirectObject != null || idea.directObject != null) &&
                    dictionary.subjects.findPersonForSubject(idea.subject, Language.spanish) == Person.thirdSing)
                {
                    idea.possiblyTuCommandOrThirdPeron = false;
                }
                if (idea.negitive == false && idea.ideaType == IdeaType.command &&
                    idea.possiblyTuCommandOrThirdPeron == false &&
                    (idea.directObject == null ^ idea.indirectObject == null))
                {
                    string betterOption = idea.subject + " " + commandVerbRoot +
                                          ((idea.indirectObject != null) ? idea.indirectObject : "") +
                                          ((idea.directObject != null) ? idea.directObject : "");
                    throw new Exception("You need to stack pronouns on the end of an affirmative verb. Try: \"" + betterOption
                                        + "\" instead.");
                }
            }
            return(idea);
        }
Beispiel #3
0
        public Idea understand(String scentence, Dictionary dictionary)
        {
            string newScentence = "";

            foreach (char letter in scentence)
            {
                if (char.IsLetter(letter) || letter == ' ' || letter == '\'')
                {
                    newScentence += char.ToLower(letter);
                }
            }
            scentence = newScentence;
            string[] crazyVerbs = new string[6] {
                "do", "does", "can", "am", "are", "is"
            };
            Idea          idea  = new Idea(null, null, null, null, null, IdeaType.declarative, false);
            List <String> words = (scentence.Split(new char[4] {
                ' ', ',', '.', '?'
            })).ToList();

            //WORK ON THIS IF GATE HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            if (words.Count == 1)
            {
                //it's either a command or infinitive
                foreach (Verb verb in dictionary.verbs)
                {
                    if (words[0] == verb.englishInfinitive.ToLower())
                    {
                        idea.subject            = dictionary.subjects.englishDefaults[1];
                        idea.ideaType           = IdeaType.command;
                        idea.possiblyInfinitive = true; //infinitives are a subset of commands
                        idea.verb = verb;
                        return(idea);
                    }
                }
            }
            else if (words.Count == 0)
            {
                throw new Exception("please enter some text");
            }
            else if (words.Count == 2 && words[0] == "to")
            {
                foreach (Verb verb in dictionary.verbs)
                {
                    if (words[1] == verb.englishInfinitive)
                    {
                        idea.ideaType = IdeaType.infinitive;
                        idea.verb     = verb;
                        return(idea);
                    }
                }
            }
            else
            {
                //seporate contractions
                attributedVerb firstVerb      = null;
                attributedVerb secondVerb     = null;
                string[]       replaceStrings = new string[2];
                for (int wordNum = 0; wordNum < words.Count; wordNum++)
                {
                    replaceStrings = new string[2] {
                        "", ""
                    };
                    foreach (Contraction contraction in dictionary.englishContractions)
                    {
                        if (words[wordNum].ToLower() == contraction.contraction)
                        {
                            replaceStrings[0] = contraction.firstWord;
                            replaceStrings[1] = contraction.secondWord;
                        }
                    }
                    if (replaceStrings[0] != "" || replaceStrings[1] != "")
                    {
                        words.RemoveAt(wordNum);
                        words.InsertRange(wordNum, replaceStrings);
                    }
                }
                //find all verbs in list in any form
                //List<Tuple<Verb, int>> verbs = new List<Tuple<Verb, int>>();

                for (int wordNum = 0; wordNum < words.Count;)
                {
                    string word = words[wordNum].ToLower();
                    foreach (Verb verb in dictionary.verbs)
                    {
                        List <string> allVerbForms = verb.allVerbForms(Language.english);
                        foreach (String possibleConjugation in allVerbForms)
                        {
                            if (possibleConjugation == word)
                            {
                                //verbs.Add(new Tuple<Verb, int>(verb, wordNum));
                                if (firstVerb == null)
                                {
                                    firstVerb = new attributedVerb(verb, word, wordNum);
                                    if (firstVerb.verb.englishInfinitive == "let" && firstVerb.position == 0)
                                    {
                                        //if (words.Count > 1) //there is always more than one word in this branch
                                        //{
                                        idea.ideaType = IdeaType.command;
                                        idea.subject  = dictionary.subjects.englishDefaults[1];
                                        if (words[1] == "us")
                                        {
                                            words.Remove("us");
                                            idea.subject = dictionary.subjects.englishDefaults[3];
                                            firstVerb    = null;
                                            goto endOfWordNumLoop;
                                        }
                                        //}
                                    }
                                    //continue;
                                }
                                else
                                {
                                    if (firstVerb != null && secondVerb != null)
                                    {
                                        if (firstVerb.verb.englishInfinitive == "do")
                                        {
                                            firstVerb = secondVerb;
                                        }
                                    }
                                    if (firstVerb.position != wordNum)
                                    {
                                        secondVerb = new attributedVerb(verb, word, wordNum);
                                        if (possibleConjugation == verb.englishInfinitive)
                                        {
                                            idea.verbTypes = VerbTypes.conjugated_infinitive;
                                        }
                                        else if (possibleConjugation == verb.englishParticiple)
                                        {
                                            idea.verbTypes = VerbTypes.conjugated_participle;
                                        }
                                    }
                                }
                            }
                        }
                    }
endOfWordNumLoop:
                    wordNum++;
                }
                if (firstVerb != null)
                {
                    idea.verb = firstVerb.verb;
                }
                else
                {
                    throw new Exception("no verb");
                }
                if (secondVerb != null)
                {
                    idea.auxilleryVerb = secondVerb.verb;
                }
                //if do in any conj. form appears directly before "not" remove it as a verb
                if (firstVerb.verb.englishInfinitive == "be" ||
                    firstVerb.verb.englishInfinitive == "can" ||
                    firstVerb.verb.englishInfinitive == "do" ||
                    firstVerb.verb.englishInfinitive == "let")
                {
                    if (words.Count > firstVerb.position + 1)
                    {
                        if (words[firstVerb.position + 1] == "not")
                        {
                            idea.negitive = true;
                        }
                    }

                    /*string text = Console.ReadLine();
                     * string[] seporate_words = text.Split(new char[1] { ' ' });
                     * int i = 5;
                     * Console.WriteLine("my number is" + i.ToString());
                     * Console.WriteLine("please say 'hi'");
                     * if (Console.ReadLine() == "hi")
                     * {
                     *  "grsfdbf"==namespace
                     * }*/
                }
                else
                {
                    if (firstVerb.position > 0)
                    {
                        if (words[firstVerb.position - 1] == "not")
                        {
                            idea.negitive = true;
                        }
                    }
                }

                /*foreach (Tuple<Verb, int> verb in verbs)
                 * {
                 *  if (verb.Item1.englishInfinitive.ToLower() == "do"
                 *      && words[verb.Item2 + 1].ToLower() == "not")
                 *  {
                 *      verbs.Remove(verb);
                 *  }
                 * }*/
                //look for let us

                /*if (words[0].ToLower() == "let")
                 * {
                 *  idea.subject = "we";
                 *  idea.ideaType = IdeaType.command;
                 *  foreach (string possibleIndirectObject in
                 *      dictionary.indirectObjects.indirectObjects(Language.english))
                 *  {
                 *      if (possibleIndirectObject == words[1].ToLower())
                 *      {
                 *          idea.possiblyInfinitive = false;
                 *          idea.indirectObject = possibleIndirectObject;
                 *      }
                 *  }
                 *  if (idea.indirectObject == "us")
                 *  {
                 *      idea.indirectObject = null;
                 *      idea.subject = "we";
                 *  }
                 *  verbs.RemoveAt(0);
                 * }*/
                //look for question verbs

                /*foreach (string qVerb in crazyVerbs)
                 * {
                 *  if (words[verbs[0].Item2] == qVerb && words[verbs[0].Item2] == words[0])
                 *  {
                 *      if (verbs.Count == 1 && //"do him it" "do it"
                 *         verbs[0].Item1.englishInfinitive == "do")
                 *      {
                 *          idea.ideaType = IdeaType.command;
                 *          idea.verbTypes = VerbTypes.conjugated;
                 *      }
                 *      else
                 *      {
                 *          if (words[verbs[0].Item2] == qVerb)
                 *          {
                 *              idea.ideaType = IdeaType.interogitive;
                 *              idea.subject = words[verbs[0].Item2 + 1];
                 *          }
                 *      }
                 *  }
                 * }*/
                //checking verb type

                /*
                 * switch (verbs.Count)
                 * {
                 *  case 2:
                 *      idea.auxilleryVerb = verbs[1].Item1;
                 *      string lastVerb = words[verbs[1].Item2];
                 *      if (lastVerb.Length < 3)
                 *      {
                 *          throw new Exception("Verb shorter than three words");
                 *      }
                 *      string ending = lastVerb.Substring(lastVerb.Length - 3);
                 *      if (ending.ToLower() == "ing")
                 *      {
                 *          idea.verbTypes = VerbTypes.conjugated_participle;
                 *      }
                 *      else if (lastVerb.ToLower() == verbs[1].Item1.englishInfinitive)
                 *      {
                 *          idea.verbTypes = VerbTypes.conjugated_infinitive;
                 *      }
                 *      else
                 *      {
                 *          throw new Exception("Last word in scenetence is not -ing or infinitive");
                 *      }
                 *      break;
                 *  case 1:
                 *      if (verbs[0].Item1.englishParticiple == words[verbs[0].Item2].ToLower())
                 *      {
                 *          throw new Exception("No be, go, or do verb to help to participle");
                 *      }
                 *      idea.verbTypes = VerbTypes.conjugated;
                 *      break;
                 *  case 0:
                 *  default:
                 *      throw new Exception("Invalid number of verbs");
                 *      break;
                 *
                 * }*/
                //look for do not directly before (or after with any 'be' conj) first verb to make negation

                /*if (verbs[0].Item2 > 0 && words[verbs[0].Item2 - 1].ToLower() == "not")
                 * {
                 *  idea.negitive = true;
                 * }
                 * else if (verbs[0].Item1.englishInfinitive == "be")
                 * {
                 *  if (verbs.Count > 1 &&
                 *      words[verbs[1].Item2 - 1].ToLower() == "not")
                 *  {
                 *      idea.negitive = true;
                 *  }
                 *  if (words[verbs[0].Item2 + 1].ToLower() == "not")
                 *  {
                 *      idea.negitive = true;
                 *  }
                 * }
                 * else
                 * {
                 *  idea.negitive = false;
                 * }*/
                //look for iop floating if not two ops
                for (int wordNum = 0; wordNum <= words.Count - 2; wordNum++)
                {
                    foreach (string indirectObject in dictionary.indirectObjects.indirectObjects(Language.english))
                    {
                        if (words[wordNum] == "to" &&
                            words[wordNum + 1] == indirectObject)
                        {
                            idea.indirectObject = indirectObject;
                        }
                        if (words[wordNum] == "for" &&
                            words[wordNum + 1] == indirectObject)
                        {
                            idea.indirectObject = indirectObject;
                        }
                    }
                }
                //look for op(s) after verb

                /*
                 * bool foundCrazyVerb = false;
                 * foreach (string verb in crazyVerbs)
                 * {
                 *  if (verb == words[verbs[0].Item2])
                 *  {
                 *      foundCrazyVerb = true;
                 *  }
                 * }
                 * if (foundCrazyVerb == true && verbs.Count == 1 && idea.negitive == true)
                 * {
                 *  //check to see if the scentence is long enough to have a DOP
                 *  if (words.Count > verbs[0].Item2)
                 *  {
                 *      //look ahead and see if a DOP exists
                 *      foreach (string possibleDirectObjects in dictionary.directObjects.directObjects(Language.english))
                 *      {
                 *          if (words[verbs[0].Item2 + 2] == possibleDirectObjects)
                 *          {
                 *              idea.directObject = words[verbs[0].Item2 + 2];
                 *              if (verbs[0].Item1.englishInfinitive == "be")
                 *              {
                 *                  idea.useSer = true;
                 *              }
                 *          }
                 *      }
                 *  }
                 * }
                 * else
                 * {
                 *  if (idea.indirectObject == null)
                 *  {
                 *      if (words.Count - 1 > verbs[verbs.Count - 1].Item2)
                 *      {
                 *          foreach (string possibleIndirectObjects in dictionary.indirectObjects.indirectObjects(Language.english))
                 *          {
                 *              if (words[verbs[verbs.Count - 1].Item2 + 1] == possibleIndirectObjects)
                 *              {
                 *                  idea.indirectObject = words[verbs[verbs.Count - 1].Item2 + 1];
                 *                  idea.eitherIOPorDOP = true;
                 *                  //look ahead and see if another op exists; if it does, it's the DOP
                 *                  if (words.Count > verbs[verbs.Count - 1].Item2 + 2)
                 *                  {
                 *                      foreach (string possibleDirectObjects in dictionary.directObjects.directObjects(Language.english))
                 *                      {
                 *                          if (words[verbs[verbs.Count - 1].Item2 + 2] == possibleDirectObjects)
                 *                          {
                 *                              idea.directObject = words[verbs[verbs.Count - 1].Item2 + 2];
                 *                          }
                 *                      }
                 *                  }
                 *              }
                 *          }
                 *      }
                 *      if (idea.indirectObject == "" || idea.indirectObject == null)
                 *      {
                 *          if (words.Count - 1 > verbs[verbs.Count - 1].Item2)
                 *          {
                 *              foreach (string possibleDirectObjects in dictionary.directObjects.directObjects(Language.english))
                 *              {
                 *                  if (words[verbs[verbs.Count - 1].Item2 + 1] == possibleDirectObjects)
                 *                  {
                 *                      idea.directObject = words[verbs[verbs.Count - 1].Item2 + 1];
                 *                  }
                 *              }
                 *          }
                 *      }
                 *  }
                 *  else
                 *  {
                 *      if (words.Count - 1 > verbs[verbs.Count - 1].Item2)
                 *      {
                 *          foreach (string possibleDirectObjects in dictionary.directObjects.directObjects(Language.english))
                 *          {
                 *              if (words[verbs[verbs.Count - 1].Item2 + 1] == possibleDirectObjects)
                 *              {
                 *                  idea.directObject = words[verbs[verbs.Count - 1].Item2 + 1];
                 *              }
                 *          }
                 *      }
                 *  }
                 * }*/
                int lastVerbPosition = 0;
                if (secondVerb == null)
                {
                    lastVerbPosition = firstVerb.position;
                }
                else
                {
                    lastVerbPosition = secondVerb.position;
                }
                if (idea.indirectObject == null)
                {
                    if (words.Count > lastVerbPosition + 1)
                    {
                        //look for an IO directly following the verb
                        foreach (string possibleIndirectObject in dictionary.indirectObjects.indirectObjects(Language.english))
                        {
                            if (possibleIndirectObject == words[lastVerbPosition + 1])
                            {
                                //if found set idea.eitherIOPorDop to be true
                                idea.indirectObject = possibleIndirectObject;
                                idea.eitherIOPorDOP = true;
                                //look for a DO following the IO (or 2+ the last verb)
                                if (words.Count > lastVerbPosition + 2)
                                {
                                    foreach (string possibleDirectObject in dictionary.directObjects.directObjects(Language.english))
                                    {
                                        if (words[lastVerbPosition + 2] == possibleDirectObject)
                                        {
                                            //if found idea.eitherIOPorDOP = false
                                            idea.eitherIOPorDOP = false;
                                            idea.directObject   = possibleDirectObject;
                                        }
                                    }
                                }
                            }
                        }
                        //if not found look for a DO
                        if (idea.indirectObject == null)
                        {
                            foreach (string possibleDirectObject in dictionary.directObjects.directObjects(Language.english))
                            {
                                if (words[lastVerbPosition + 1] == possibleDirectObject)
                                {
                                    idea.eitherIOPorDOP = false;
                                    idea.directObject   = possibleDirectObject;
                                }
                            }
                        }
                    }
                }
                else
                {
                    //look for only a DO in the spot directly following the verb
                    foreach (string possibleDirectObject in dictionary.directObjects.directObjects(Language.english))
                    {
                        if (words[lastVerbPosition + 1] == possibleDirectObject)
                        {
                            idea.eitherIOPorDOP = false;
                            idea.directObject   = possibleDirectObject;
                        }
                    }
                }
                //look for subject before verb
                if (idea.ideaType == IdeaType.declarative)
                {
                    for (int wordNum = 0; wordNum < firstVerb.position; wordNum++)
                    {
                        foreach (string subject in dictionary.subjects.subjects(Language.english))
                        {
                            if (words[wordNum].ToLower() == subject.ToLower())
                            {
                                idea.subject = subject;
                            }
                        }
                    }
                }
            }
            if (idea.subject == null)
            {
                idea.ideaType = IdeaType.command;
                idea.subject  = "you";
            }
            if (idea.verb.englishInfinitive == "be")
            {
                if (idea.auxilleryVerb != null)
                {
                    //use ester
                    foreach (Verb verb in dictionary.verbs)
                    {
                        if (verb.spanishInfinitive == "eatar")
                        {
                            idea.verb = verb;
                        }
                    }
                }
                else
                {
                    foreach (Verb verb in dictionary.verbs)
                    {
                        if (verb.spanishInfinitive == "ser")
                        {
                            idea.verb           = verb;
                            idea.eitherIOPorDOP = false;
                        }
                    }
                }
            }
            return(idea);
        }