本文整理汇总了C#中Word.AddRelationSimbolPrimitive方法的典型用法代码示例。如果您正苦于以下问题:C# Word.AddRelationSimbolPrimitive方法的具体用法?C# Word.AddRelationSimbolPrimitive怎么用?C# Word.AddRelationSimbolPrimitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Word
的用法示例。
在下文中一共展示了Word.AddRelationSimbolPrimitive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseDetail
/// <summary>
/// 解析具体概念部分
/// </summary>
/// <param name="related"></param>
/// <param name="word"></param>
public void ParseDetail(string related, Word word)
{
try
{
string[] parts = related.Split(',');
bool isFirst = true;
bool isRelational = false;
bool isSimbol = false;
string chinese = null;
string relationalPrimitiveKey = null;
string simbolKey = null;
for (int i = 0; i < parts.Length; i++)
{
if (parts[i].StartsWith("("))
{
parts[i] = parts[i].Substring(1, parts[i].Length - 1);
}
if (parts[i].Contains("="))
{
isRelational = true;
string[] strs = parts[i].Split('=');
relationalPrimitiveKey = strs[0];
string value = strs[1].Split('|')[1];//[BUG]等号后面的|后面的是中文的值VALUE
word.AddRelationalPrimitive(relationalPrimitiveKey, value);
continue;
}
string[] strss = parts[i].Split('|');
if (strss.Length > 1)
{
chinese = strss[1];
}
if (chinese != null && (chinese.EndsWith(")") || chinese.EndsWith("}")))
{
chinese = chinese.Substring(0, chinese.Length - 1);
}
int type = GetPrimitiveType(strss[0]);
if (type == 0)
{
if (isRelational)
{
word.AddRelationalPrimitive(relationalPrimitiveKey, chinese);
continue;
}
if (isSimbol)
{
word.AddRelationSimbolPrimitive(simbolKey, chinese);
continue;
}
if (isFirst)
{
word.FirstPrimitive = chinese;
isFirst = false;
continue;
}
word.OtherPrimitives.Add(chinese);
continue;
}
if (type == 1)
{
isSimbol = true;
isRelational = false;
simbolKey = (strss[0].ToCharArray()[0]).ToString();
word.AddRelationSimbolPrimitive(simbolKey, chinese);
continue;
}
if (type == 2)
{
isSimbol = false;
isRelational = true;
if (strss[0].StartsWith("{"))
{
string englishi = strss[0].Substring(1);
if (chinese != null)
{
word.AddStructruralWord(chinese);
continue;
}
word.AddStructruralWord(englishi);
}
}
}
}
catch (Exception ex)
{
}
}