private void HandleServerReceived(object sender, DataPacketEventArgs e)
        {
            // Add the input to working memory
            string           senderName = e.DataPacket.SenderName;
            StringMemoryItem inputItem  = null;

            if (senderName == AgentConstants.LISTENER_PROCESS_NAME)
            {
                inputItem = new StringMemoryItem();
                inputItem.TagList.Add(listenerInputTag);
                inputItem.SetContent(e.DataPacket.Message);
                workingMemory.AddItem(inputItem);
                timeOfLastListenerInput = inputItem.InsertionTime;
                if (!busy)
                {
                    HandleUserInput(inputItem);
                }
            }
            else if (senderName == AgentConstants.VISION_PROCESS_NAME)
            {
                inputItem = new StringMemoryItem();
                inputItem.TagList.Add(visionInputTag);
                inputItem.SetContent(e.DataPacket.Message);
                workingMemory.AddItem(inputItem);
                timeOfLastVisionInput = inputItem.InsertionTime;
                if (!busy)
                {
                    HandleUserInput(inputItem);
                }
            }
            else if (senderName == AgentConstants.INTERNET_PROCESS_NAME)
            {
                ProcessInternetInput(e.DataPacket.Message);
            }
        }
Example #2
0
        private void AddQueryTermsToWorkingMemory(List <string> queryTerms)
        {
            List <MemoryItem> queryMemoryItemList = new List <MemoryItem>();

            for (int ii = 0; ii < queryTerms.Count; ii++)
            {
                string           queryTerm       = queryTerms[ii];
                string           queryTag        = queryTagList[ii];
                StringMemoryItem queryMemoryItem = new StringMemoryItem();
                queryMemoryItem.TagList.Add(queryTag);
                queryMemoryItem.SetContent(queryTerm);
                queryMemoryItemList.Add(queryMemoryItem);
            }
            ownerAgent.WorkingMemory.AddItems(queryMemoryItemList);


            /*   StringMemoryItem queryMemoryItem = new StringMemoryItem();
             * foreach (string queryTag in queryTagList)
             * {
             *     queryMemoryItem.TagList.Add(queryTag);
             * }
             * string queryTermsString = "";
             * foreach (string queryTerm in queryTerms)
             * {
             *     queryTermsString += queryTerm + ownerAgent.MemoryItemSeparationCharacter;
             * }
             * queryTermsString = queryTermsString.TrimEnd(new char[] { ownerAgent.MemoryItemSeparationCharacter });
             * queryMemoryItem.SetContent(queryTermsString);
             * ownerAgent.WorkingMemory.AddItem(queryMemoryItem);   */
        }
Example #3
0
 private void AddQueryTermsToWorkingMemory(List <string> queryTerms, Tuple <List <string>, List <string> > queryTagList)
 {
     //sets values at same tag as it was recieved
     foreach (string tag in queryTagList.Item1)
     {
         string term = queryTerms[0];
         queryTerms.RemoveAt(0);
         StringMemoryItem queryMemoryItem = ItemHandler.StoreTermOnTag(ownerAgent, tag, term);
     }
     foreach (string tag in queryTagList.Item2)
     {
         //fills unfilled queries with empty string
         StringMemoryItem queryMemoryItem = ItemHandler.StoreTermOnTag(ownerAgent, tag, "");
     }
 }
        public void SendInternetRequest(string request)
        {
            StringMemoryItem requestItem = new StringMemoryItem();

            requestItem.TagList.Add(internetOutputTag);
            requestItem.SetContent(request);
            workingMemory.AddItem(requestItem);
            timeOfLastInternetRequest = requestItem.InsertionTime;
            string clientID = server.GetFirstClientID(AgentConstants.INTERNET_PROCESS_NAME);

            if (clientID != null)
            {
                server.Send(clientID, request);
            }
        }
        public void SendExpression(string expression)
        {
            StringMemoryItem expressionItem = new StringMemoryItem();

            expressionItem.TagList.Add(faceExpressionOutputTag);
            expressionItem.SetContent(expression);
            workingMemory.AddItem(expressionItem);
            timeOfLastFaceExpressionOutput = expressionItem.InsertionTime;
            string clientID = server.GetFirstClientID(AgentConstants.FACE_PROCESS_NAME);

            if (clientID != null)
            {
                server.Send(clientID, expression);
            }
        }
        public void SendSpeechOutput(string outputString)
        {
            StringMemoryItem outputItem = new StringMemoryItem();

            outputItem.TagList.Add(speechOutputTag);
            outputItem.SetContent(outputString);
            workingMemory.AddItem(outputItem);
            timeOfLastSpeechOutput = outputItem.InsertionTime;
            string clientID = server.GetFirstClientID(AgentConstants.SPEECH_PROCESS_NAME);

            if (clientID != null)
            {
                server.Send(clientID, outputString);
            }
        }
        private void AddQueryTermsToWorkingMemory(List <string> queryTerms)
        {
            List <MemoryItem> queryMemoryItemList = new List <MemoryItem>();

            for (int ii = 0; ii < queryTerms.Count; ii++)
            {
                string           queryTerm       = queryTerms[ii];
                string           queryTag        = QueryTagList[ii];
                StringMemoryItem queryMemoryItem = new StringMemoryItem();
                queryMemoryItem.TagList.Add(queryTag);
                queryMemoryItem.SetContent(queryTerm);
                queryMemoryItemList.Add(queryMemoryItem);
            }
            ownerAgent.WorkingMemory.AddItems(queryMemoryItemList);
        }
        public override Boolean Run(List <object> parameterList, out string targetContext, out string targetID)
        {
            base.Run(parameterList, out targetContext, out targetID);
            Boolean       labelFound           = false;
            List <string> itemSoughtStringList = new List <string>();

            foreach (string inputQueryTag in inputQueryTagList)
            {
                MemoryItem itemSought = ownerAgent.WorkingMemory.GetLastItemByTag(inputQueryTag);
                if (itemSought != null)  // 20171201
                {
                    string itemSoughtString = (string)itemSought.GetContent();
                    itemSoughtStringList.Add(itemSoughtString);
                }
            }
            List <MemoryItem> tagMatchingItemList = null;

            if (memoryIdentifier == AgentConstants.LONG_TERM_MEMORY_NAME)
            {
                tagMatchingItemList = ownerAgent.LongTermMemory.GetAllItemsByTagList(searchTagList, tagSearchMode);
            }
            else
            {
                tagMatchingItemList = ownerAgent.WorkingMemory.GetAllItemsByTagList(searchTagList, tagSearchMode);
            }
            if (tagMatchingItemList != null)
            {
                foreach (MemoryItem memoryItem in tagMatchingItemList)
                {
                    if (memoryItem is StringMemoryItem)  // The only case covered, so far.
                    {
                        StringMemoryItem stringMemoryItem = (StringMemoryItem)memoryItem;
                        stringMemoryItem.GenerateLabelContentPairs();
                        LabelContentPair labelContentPair = null;

                        labelContentPair = stringMemoryItem.LabelContentPairList.Find(lcp => (lcp.Label == identificationLabel)); // && (lcp.Content.ToLower() == itemSoughtString));
                        if (labelContentPair != null)                                                                             // 20171201
                        {
                            foreach (string itemSoughtString in itemSoughtStringList)
                            {
                                if (!labelContentPair.Content.ToLower().Contains(itemSoughtString))
                                {
                                    labelContentPair = null;
                                    break;
                                }
                            }
                        }


                        if (labelContentPair != null)
                        {
                            // A match was found. Now check if the searchLabel can be found as well:
                            LabelContentPair searchLabelContentPair = stringMemoryItem.LabelContentPairList.Find(lcp => lcp.Label == searchLabel);
                            if (searchLabelContentPair != null)
                            {
                                labelFound = true;
                                StringMemoryItem matchMemoryItem = new StringMemoryItem();
                                matchMemoryItem.TagList = new List <string>()
                                {
                                    outputQueryTag
                                };
                                matchMemoryItem.SetContent(searchLabelContentPair.Content);
                                ownerAgent.WorkingMemory.AddItem(matchMemoryItem);
                                break;
                            }
                        }
                    }
                }
            }
            if (labelFound)
            {
                targetContext = successTargetContext; // ToDo - uncomment and use!
                targetID      = successTargetID;      // ToDo - uncomment and use!
            }
            else
            {
                targetContext = failureTargetContext;
                targetID      = failureTargetID;
            }
            return(labelFound);
        }
Example #9
0
        /* public override void Initialize(Agent ownerAgent) // TODO use pattern list
         * {
         *   base.Initialize(ownerAgent);
         *   //foreach (Pattern pattern in outputAction.PatternList)
         *   //{
         *   //    pattern.ProcessDefinition();
         *   //    //     pattern.ProcessDefinitionList();
         *   //}
         * }*/

        public override Boolean Run(List <object> parameterList, out string targetContext, out string targetID)
        {
            base.Run(parameterList, out targetContext, out targetID);


            string     currentUser = "";
            MemoryItem itemSought  = ownerAgent.WorkingMemory.GetLastItemByTag(inputQueryTagList[0]);

            if (itemSought != null)  // 20171201
            {
                currentUser = (string)itemSought.GetContent();
            }

            List <string> openRatings = new List <string> {
            };

            foreach (var movie in _ultraManager.MovieList)
            {
                Boolean addItem = true;
                //movie.Title ==
                foreach (var rating in _ultraManager.RatingList)
                {
                    if (rating.UserName == currentUser && rating.MovieTitle == movie.Title)
                    {
                        addItem = false;
                    }
                }
                if (addItem)
                {
                    openRatings.Add(movie.Title);
                }
            }

            // return random unseen movie to rate as outputQueryTag
            Boolean noMoreRatngs = false;

            if (openRatings.Count > 0)
            {
                // Random random = new Random();
                // int randomIndex = random.Next(0, openRatings.Count);
                int              randomIndex    = ownerAgent.RandomNumberGenerator.Next(0, openRatings.Count);
                string           openRating     = openRatings[randomIndex];
                StringMemoryItem rateMemoryItem = new StringMemoryItem();
                rateMemoryItem.TagList = new List <string>()
                {
                    outputQueryTag
                };
                rateMemoryItem.SetContent(openRating);
                ownerAgent.WorkingMemory.AddItem(rateMemoryItem);
            }
            else
            {
                noMoreRatngs = true;
            }


            if (repetitionCount < maximumRepetitionCount && noMoreRatngs == false)
            {
                targetContext = successTargetContext;
                targetID      = successTargetID;
            }
            else
            {
                targetContext = failureTargetContext;
                targetID      = failureTargetID;
            }
            return(true);
        }
Example #10
0
        protected override void RunLoop(List <object> parameterList)
        {
            string     originalContext = ownerAgent.WorkingMemory.CurrentContext;
            string     currentUser     = "";
            MemoryItem itemSought      = ownerAgent.WorkingMemory.GetLastItemByTag(inputQueryTagList[0]);

            if (itemSought != null)  // 20171201
            {
                currentUser = (string)itemSought.GetContent();
            }

            // Recommend!

            // Get similarity of currentUser to all other users-------------------------------------------------

            // create ratingTable
            List <string> userList  = new List <string> {
            };
            List <string> movieList = new List <string> {
            };

            userList.Add(currentUser);
            foreach (var rating in _ultraManager.RatingList)
            {
                if (!userList.Exists(x => string.Equals(x, rating.UserName, StringComparison.OrdinalIgnoreCase)))
                {
                    userList.Add(rating.UserName);
                }
            }
            foreach (var rating in _ultraManager.RatingList)
            {
                if (!movieList.Exists(x => string.Equals(x, rating.MovieTitle, StringComparison.OrdinalIgnoreCase)))
                {
                    movieList.Add(rating.MovieTitle);
                }
            }

            int nbrOfUsers          = userList.Count;
            int userInsertionIndex  = 0;
            int nbrOfMovies         = movieList.Count;
            int movieInsertionIndex = 0;

            double[,] ratingTable = new double[nbrOfUsers, nbrOfMovies];

            foreach (var rating in _ultraManager.RatingList)
            {
                userInsertionIndex  = userList.FindIndex(x => x.StartsWith(rating.UserName));
                movieInsertionIndex = movieList.FindIndex(x => x.StartsWith(rating.MovieTitle));
                ratingTable[userInsertionIndex, movieInsertionIndex] = rating.RatingValue;
            }

            // calculate mean rating for each user
            double[] meanRatings = new double[nbrOfUsers];
            for (int i = 0; i < nbrOfUsers; ++i)
            {
                double ratingSum  = 0;
                int    nbrOfRated = 0;
                for (int j = 0; j < nbrOfMovies; ++j)
                {
                    if (ratingTable[i, j] > 0)
                    {
                        ratingSum = ratingSum + ratingTable[i, j];
                        ++nbrOfRated;
                    }
                }
                if (ratingSum > 0 && nbrOfRated > 0)
                {
                    meanRatings[i] = ratingSum / nbrOfRated;
                }
            }

            // calculate Pearson correlation
            List <double> simToUser = new List <double> {
                0
            };                                               // TODO: use dictionary

            for (int i = 1; i < nbrOfUsers; ++i)
            {
                List <int> setRatedBoth = new List <int> {
                };
                for (int j = 0; j < nbrOfMovies; ++j)
                {
                    if (ratingTable[0, j] > 0 && ratingTable[i, j] > 0)
                    {
                        setRatedBoth.Add(j);
                    }
                }

                double sum1 = 0;
                double sum2 = 0;
                double sum3 = 0;
                for (int k = 0; k < setRatedBoth.Count; ++k)
                {
                    sum1 = sum1 + (ratingTable[0, setRatedBoth[k]] - meanRatings[0]) * (ratingTable[i, setRatedBoth[k]] - meanRatings[i]);
                    sum2 = sum2 + Math.Pow(ratingTable[0, setRatedBoth[k]] - meanRatings[0], 2);
                    sum3 = sum3 + Math.Pow(ratingTable[i, setRatedBoth[k]] - meanRatings[i], 2);
                }
                simToUser.Add(sum1 / (Math.Sqrt(sum2 * sum3)));
            }

            // Get most similar user
            int mostSimilarUser = simToUser.IndexOf(simToUser.Max());

            Debug.WriteLine(userList[mostSimilarUser]);

            // Return random unseen movie
            List <string> unseenMovies = new List <string> {
            };

            for (int j = 0; j < nbrOfMovies; ++j)
            {
                if (ratingTable[0, j] == 0 && ratingTable[mostSimilarUser, j] > 5)
                {
                    unseenMovies.Add(movieList[j]);
                }
            }
            Boolean noMoreRecommendations = false;

            if (unseenMovies.Count > 0)
            {
                int              randomIndex    = ownerAgent.RandomNumberGenerator.Next(0, unseenMovies.Count);
                string           recommendation = unseenMovies[randomIndex];
                StringMemoryItem rateMemoryItem = new StringMemoryItem();
                rateMemoryItem.TagList = new List <string>()
                {
                    outputQueryTag
                };
                rateMemoryItem.SetContent(recommendation);
                ownerAgent.WorkingMemory.AddItem(rateMemoryItem);
            }
            else
            {
                noMoreRecommendations = true;
            }


            AsynchronousDialogueItemEventArgs e = new AsynchronousDialogueItemEventArgs(originalContext, outputAction.TargetContext, outputAction.TargetID);

            OnRunCompleted(e);
        }
Example #11
0
        public override Boolean Run(List <object> parameterList, out string targetContext, out string targetID)
        {
            base.Run(parameterList, out targetContext, out targetID);
            List <double> operandList = new List <double>();

            foreach (string inputQueryTag in inputQueryTagList)
            {
                MemoryItem itemSought       = ownerAgent.WorkingMemory.GetLastItemByTag(inputQueryTag);
                string     itemSoughtString = (string)itemSought.GetContent();
                double     operand;
                Boolean    inputOK = double.TryParse(itemSoughtString, out operand);
                if (inputOK)
                {
                    operandList.Add(operand);
                }
                else
                {
                    return(false);
                }
            }
            double output = 0;

            if (operation.ToLower() == "addition")
            {
                output = 0;
                foreach (double operand in operandList)
                {
                    output += operand;
                }
            }
            else if (operation.ToLower() == "subtraction")
            {
                if (operandList.Count == 2)
                {
                    output = operandList[0] - operandList[1];
                }
                else
                {
                    return(false);
                }
            }
            else if (operation.ToLower() == "multiplication")
            {
                output = 1;
                foreach (double operand in operandList)
                {
                    output *= operand;
                }
            }
            else
            {
                return(false);
            }
            StringMemoryItem matchMemoryItem = new StringMemoryItem();

            matchMemoryItem.TagList = new List <string>()
            {
                outputQueryTag
            };
            matchMemoryItem.SetContent(output.ToString());
            ownerAgent.WorkingMemory.AddItem(matchMemoryItem);
            targetContext = outputTargetContext;
            targetID      = outputTargetID;
            return(true);
        }
        public override Boolean Run(List <object> parameterList, out string targetContext, out string targetID)
        {
            base.Run(parameterList, out targetContext, out targetID);
            List <StringMemoryItem> queryMemoryItemList = new List <StringMemoryItem>();

            if (queryTagList != null)
            {
                foreach (string queryTag in queryTagList)
                {
                    StringMemoryItem queryMemoryItem = (StringMemoryItem)ownerAgent.WorkingMemory.GetLastItemByTag(queryTag);
                    if (queryMemoryItem != null)
                    {
                        queryMemoryItemList.Add(queryMemoryItem);
                    }
                }
            }
            //   StringMemoryItem queryMemoryItem = null;
            //   if (queryTagList != null) { queryMemoryItem = (StringMemoryItem)ownerAgent.WorkingMemory.GetLastItemByTagList(queryTagList); }
            //   string outputString = patternAction.GetString(ownerAgent.RandomNumberGenerator, queryMemoryItem);
            string outputString;

            if (repetitionCount <= maximumRepetitionCount)
            {
                if (useVerbatimString)
                {
                    outputString = outputAction.GetVerbatimString();
                }
                else
                {
                    outputString = outputAction.GetString(ownerAgent.RandomNumberGenerator, queryMemoryItemList);
                }


                if (outputString != null)
                {
                    if (target == AgentConstants.SPEECH_OUTPUT_TAG)
                    {
                        ownerAgent.SendSpeechOutput(outputString);
                    }
                    else if (target == AgentConstants.FACE_EXPRESSION_OUTPUT_TAG)
                    {
                        ownerAgent.SendExpression(outputString);
                    }
                    else if (target == AgentConstants.INTERNET_OUTPUT_TAG)
                    {
                        ownerAgent.SendInternetRequest(outputString);
                    }
                }
                //   if (outputString != null) { ownerAgent.SendSpeechOutput(outputString); }
                //  if (expression != null) { ownerAgent.SendExpression(expression); }
                targetContext = outputAction.TargetContext;
                targetID      = outputAction.TargetID;
            }
            else
            {
                outputString  = "";
                targetContext = "";
                targetID      = "";
            }
            return(true);
        }
Example #13
0
        // The message should be formatted as [<dest>][{tag1, ..., tagN}][<content>]
        // where <dest> is either "WorkingMemory" or "LongTermMemory". The tag list is optional for items
        // inserted into working memory, but must be present for long-term memory items. If tags are included,
        // they are added to the tag list of the memory item. Then the content (specified in <content>, without
        // the < >) is added as well.
        // Note that the message must have PRECISELY the shape defined above!
        private void ProcessInternetInput(string message)
        {
            StringMemoryItem internetInputItem        = new StringMemoryItem();
            char             leftSeparationCharacter  = AgentConstants.INTERNET_INPUT_LEFT_SEPARATION_CHARACTER;
            char             rightSeparationCharacter = AgentConstants.INTERNET_INPUT_RIGHT_SEPARATION_CHARACTER;
            List <string>    messageSplit             = message.Split(new char[] { leftSeparationCharacter, rightSeparationCharacter }, StringSplitOptions.RemoveEmptyEntries).ToList();

            if (messageSplit.Count == 2)  // No tags
            {
                if (messageSplit[0] == AgentConstants.WORKING_MEMORY_NAME)
                {
                    string content = messageSplit[1];
                    if (content != null)
                    {
                        if (content.Length > 0)
                        {
                            internetInputItem.SetContent(content);
                            internetInputItem.TagList.Add(internetInputTag);
                            workingMemory.AddItem(internetInputItem);
                            timeOfLastInternetInput = internetInputItem.InsertionTime;
                            //         if (!busy) { HandleInput(internetInputItem); }
                        }
                    }
                }
            }
            else if (messageSplit.Count == 3)
            {
                if (messageSplit[0] == AgentConstants.WORKING_MEMORY_NAME)
                {
                    string content = messageSplit[2];
                    if (content != null)
                    {
                        if (content.Length > 0)
                        {
                            internetInputItem.SetContent(content);
                            internetInputItem.TagList.Add(internetInputTag);
                            char          leftListCharacter  = AgentConstants.INTERNET_INPUT_TAG_LIST_LEFT_CHARACTER;
                            char          rightListCharacter = AgentConstants.INTERNET_INPUT_TAG_LIST_RIGHT_CHARACTER;
                            char          separator          = AgentConstants.INTERNET_INPUT_TAG_LIST_SEPARATOR_CHARACTER;
                            List <string> tagListSplit       = messageSplit[1].Split(new char[] { leftListCharacter, rightListCharacter, separator },
                                                                                     StringSplitOptions.RemoveEmptyEntries).ToList();
                            if (tagListSplit != null)
                            {
                                if (tagListSplit.Count > 0)
                                {
                                    foreach (string tag in tagListSplit)
                                    {
                                        internetInputItem.TagList.Add(tag);
                                    }
                                }
                            }
                            workingMemory.AddItem(internetInputItem);
                            timeOfLastInternetInput = internetInputItem.InsertionTime;
                            //      if (!busy) { HandleInput(internetInputItem); }
                        }
                    }
                }
                else if (messageSplit[0] == AgentConstants.LONG_TERM_MEMORY_NAME)
                {
                    // Insertions on long-term memory do not trigger actions by the agent, but the contents
                    // will of course be available for later use.
                    // Also, for long-term memory items, tags are _required_. If no tags are present, the
                    // input is simply ignored.
                    char          leftListCharacter  = AgentConstants.INTERNET_INPUT_TAG_LIST_LEFT_CHARACTER;
                    char          rightListCharacter = AgentConstants.INTERNET_INPUT_TAG_LIST_RIGHT_CHARACTER;
                    char          separator          = AgentConstants.INTERNET_INPUT_TAG_LIST_SEPARATOR_CHARACTER;
                    List <string> tagListSplit       = messageSplit[1].Split(new char[] { leftListCharacter, rightListCharacter, separator },
                                                                             StringSplitOptions.RemoveEmptyEntries).ToList();
                    if (tagListSplit != null)
                    {
                        if (tagListSplit.Count > 0)
                        {
                            foreach (string tag in tagListSplit)
                            {
                                internetInputItem.TagList.Add(tag);
                            }
                            string content = messageSplit[2];
                            if (content != null)
                            {
                                if (content.Length > 0)
                                {
                                    internetInputItem.SetContent(content);
                                    longtermMemory.AddItem(internetInputItem);
                                    timeOfLastInternetInput = internetInputItem.InsertionTime;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #14
0
 private void importMemoryItemsButton_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog openFileDialog = new OpenFileDialog())
     {
         string longTermMemoryDirectoryPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + agent.LongTermMemoryRelativePath;
         openFileDialog.InitialDirectory = longTermMemoryDirectoryPath;
         openFileDialog.Filter           = "text files (*.txt)|*.txt";
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             List <MemoryItem> addedItemsList   = new List <MemoryItem>();
             StreamReader      memoryItemReader = new StreamReader(openFileDialog.FileName);
             string            errorString      = "Errors on lines: ";
             Boolean           errorsFound      = false;
             int lineNumber = 0;
             while (!memoryItemReader.EndOfStream)
             {
                 string information = memoryItemReader.ReadLine();
                 if (information != null)
                 {
                     Boolean       itemOK          = false;
                     List <string> tagsContentList = information.Split(new string[] { "[Tags]", "[Content]" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                     if (tagsContentList.Count == 2)
                     {
                         if (information.IndexOf("Tags") < information.IndexOf("Content"))
                         {
                             string tagInformation = tagsContentList[0];
                             if ((!tagInformation.Contains("=")) && (!tagInformation.Contains(":")))  // Make sure that the user does not accidentally add a "=" or ":"
                             {
                                 List <string> tagList = tagInformation.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                                 if (tagList.Count > 0)
                                 {
                                     string content = tagsContentList[1];
                                     if (content != null)
                                     {
                                         if (content != "")
                                         {
                                             itemOK = true;
                                             StringMemoryItem item = new StringMemoryItem();
                                             item.TagList = tagList;
                                             item.SetContent(content);
                                             item.InsertionTime = DateTime.Now;
                                             addedItemsList.Add(item);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if (!itemOK)
                     {
                         errorsFound  = true;
                         errorString += lineNumber.ToString() + ",";
                     }
                 }
             }
             if (addedItemsList.Count > 0)
             {
                 agent.LongTermMemory.AddItems(addedItemsList);
             }
             if (errorsFound)
             {
                 MessageBox.Show("Import errors", errorString);
             }
         }
     }
 }