//optional parameter for_additional_info, if set true, will avoid any actual leading statements //except for relationship mentions. If no relationship mention can be made, then blank string //is returned. private string LeadingTopic(Feature last, Feature first, bool for_additional_info = false) { string return_message = ""; string first_data_en = first.Data; string first_data_cn = first.Data; if (first.Data.Contains("##")) { first_data_en = first.Data.Split(new string[] { "##" }, StringSplitOptions.None)[0]; first_data_cn = first.Data.Split(new string[] { "##" }, StringSplitOptions.None)[1]; } Console.WriteLine("In LeadingTopic, first_data_en " + first_data_en + " first_data_cn " + first_data_cn); string last_data_en = last.Data; string last_data_cn = last.Data; if (last.Data.Contains("##")) { last_data_en = last.Data.Split(new string[] { "##" }, StringSplitOptions.None)[0]; last_data_cn = last.Data.Split(new string[] { "##" }, StringSplitOptions.None)[1]; } Console.WriteLine("In LeadingTopic, last_data_en " + last_data_en + " last_data_cn " + last_data_cn); //First is the current node (the one that has just been traversed to) //A set of possible lead-in statements. List<string> lead_in_statements = new List<string>(); lead_in_statements.Add("{There's also " + first_data_en + ".} " + "##" + "{还有" + first_data_cn + "呢。} " + "##"); lead_in_statements.Add("{But let's talk about " + first_data_en + ".} " + "##" + "{我们来聊聊" + first_data_cn + "吧。} " + "##"); lead_in_statements.Add("{And have I mentioned " + first_data_en + "?} " + "##" + "{之前我说过" + first_data_cn + "吗?} " + "##"); lead_in_statements.Add("{Now, about " + first_data_en + ".} " + "##" + "{接下来是" + first_data_cn + "。} " + "##"); lead_in_statements.Add("{Now, let's talk about " + first_data_en + ".} " + "##" + "{接着我们说说" + first_data_cn + "吧。} " + "##"); lead_in_statements.Add("{I should touch on " + first_data_en + ".} " + "##" + "{我要谈谈关于" + first_data_cn + "。} " + "##"); lead_in_statements.Add("{Have you heard of " + first_data_en + "?} " + "##" + "{你听说过" + first_data_cn + "吗?} " + "##"); //A set of lead-in statements for non-novel nodes List<string> non_novel_lead_in_statements = new List<string>(); non_novel_lead_in_statements.Add("{There's also " + first_data_en + ".} " + "##" + "{还有" + first_data_cn + "呢。} " + "##"); non_novel_lead_in_statements.Add("{Let's talk about " + first_data_en + ".} " + "##" + "{我们谈谈" + first_data_cn + "吧。} " + "##"); non_novel_lead_in_statements.Add("{I'll mention " + first_data_en + " real quick.} " + "##" + "{我想简要提提" + first_data_cn + "。} " + "##"); non_novel_lead_in_statements.Add("{So, about " + first_data_en + ".} " + "##" + "{那么,说说" + first_data_cn + "。} " + "##"); non_novel_lead_in_statements.Add("{Now then, about " + first_data_en + ".} " + "##" + "{现在谈谈" + first_data_cn + "吧。} " + "##"); non_novel_lead_in_statements.Add("{Let's talk about " + first_data_en + " for a moment.} " + "##" + "{我们聊一会儿" + first_data_cn + " 吧。} " + "##"); non_novel_lead_in_statements.Add("{Have I mentioned " + first_data_en + "?} " + "##" + "{之前我说过" + first_data_cn + "吗?} " + "##"); non_novel_lead_in_statements.Add("{Now, about " + first_data_en + ".} " + "##" + "{接着是" + first_data_cn + "。} " + "##"); non_novel_lead_in_statements.Add("{Now, let's talk about " + first_data_en + ".} " + "##" + "{现在我们谈谈" + first_data_cn + "吧。} " + "##"); non_novel_lead_in_statements.Add("{I should touch on " + first_data_en + ".} " + "##" + "{我要说说" + first_data_cn + "。} " + "##"); //A set of lead-in statements for novel nodes //TODO: Author these again; things like let's talk about something different now. List<string> novel_lead_in_statements = new List<string>(); novel_lead_in_statements.Add("{Let's talk about something different. " + "##" + "{我们聊点别的吧。" + "##"); novel_lead_in_statements.Add("{Let's talk about something else. " + "##" + "{我们说点其他的吧。" + "##"); novel_lead_in_statements.Add("{Let's switch gears. " + "##" + "{我们换个话题吧。" + "##"); Random rand = new Random(); // Check if there is a relationship between two nodes if (last.getNeighbor(first.Data) != null || first.getNeighbor(last.Data) != null) { string relationship_neighbor_en = last.getRelationshipNeighbor(first.Data); string relationship_neighbor_cn = last.getRelationshipNeighbor(first.Data); string relationship_parent_en = last.getRelationshipParent(first.Data); string relationship_parent_cn = last.getRelationshipParent(first.Data); Console.WriteLine("In LeadingTopic, relationship_neighbor_en " + relationship_neighbor_en + " relationship_neighbor_cn " + relationship_neighbor_cn); if (relationship_neighbor_en.Contains("##")) { relationship_neighbor_en = relationship_neighbor_en.Split(new string[] { "##" }, StringSplitOptions.None)[0]; relationship_neighbor_cn = relationship_neighbor_cn.Split(new string[] { "##" }, StringSplitOptions.None)[1]; } if (relationship_parent_en.Contains("##")) { relationship_parent_en = relationship_parent_en.Split(new string[] { "##" }, StringSplitOptions.None)[0]; relationship_parent_cn = relationship_parent_cn.Split(new string[] { "##" }, StringSplitOptions.None)[1]; }//end if // Check if last has first as its neighbor if (!last.getRelationshipNeighbor (first.Data).Equals("") && !(last.getRelationshipNeighbor (first.Data) == null)) { return_message = "{" + last_data_en + " " + relationship_neighbor_en + " " + first_data_en + ".} " + "##" + "{" + last_data_cn + " " + relationship_neighbor_cn + " " + first_data_cn + ".} " + "##"; return return_message; }//end if // If last is a child node of first (first is a parent of last) else if (!last.getRelationshipParent (first.Data).Equals("") && !(last.getRelationshipParent(first.Data) == null)) { return_message = "{" + last_data_en + " " + relationship_parent_en + " " + first_data_en + ".} " + "##" + "{" + last_data_cn + " " + relationship_parent_cn + " " + first_data_cn + ".} " + "##"; return return_message; }//end else if }//end if // Neither neighbor or parent/child. //If this is for additional info, return blank string; the two nodes //are not neighbors or have a blank relationship. if (for_additional_info) return ""; // NEED TO consider novelty value (low) //else if (last.getNeighbor(first.Data) == null || first.getNeighbor(last.Data) == null) //If the novelty is high enough, always include a novel topic lead-in statement. if (noveltyValue >= 0.6) return_message += novel_lead_in_statements[rand.Next(novel_lead_in_statements.Count)]; //Otherwise, include a non-novel topic lead-in statement. else { return_message += non_novel_lead_in_statements[rand.Next(non_novel_lead_in_statements.Count)]; }//end if //!FindSpeak(first).Contains<string>(first.Data) return return_message; }