/// <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) { } }