本文整理汇总了C#中Feature.getRelationshipParent方法的典型用法代码示例。如果您正苦于以下问题:C# Feature.getRelationshipParent方法的具体用法?C# Feature.getRelationshipParent怎么用?C# Feature.getRelationshipParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feature
的用法示例。
在下文中一共展示了Feature.getRelationshipParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LeadingTopic
//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
//.........这里部分代码省略.........