//�����������֣��������Ľ������<code>Word word</code> public void parseDetail(string related, Word word) { bool isSpecial = false; // �Ƿ���� //�����ж��Ƿ���ʣ��������{firstPerson|��,mass|��} if (related.StartsWith(SPECIAL_SYMBOL)) { isSpecial = true;//����� related = related.Substring(1, related.Length - 2); } //����,�ֿ� ���ӣ�aValue|����ֵ,attachment|����,#country|����,ProperName|ר string[] parts = related.Split(','); bool isFirst = true;//�Ƿ�Ϊ��һ������Ҫ��Ϊ�˻�ȡ��һ��ԭ�����õIJ��� bool isRelational = false;//�Ƿ��ǹ�ϵ��ԭ bool isSimbol = false;//�Ƿ������ԭ string chinese = null;//�Ƿ������� string relationalPrimitiveKey = null;//��ϵ��ԭ��KEYֵ string simbolKey = null;//���ŵ�KEY for (int i = 0; i < parts.Length; i++) { if (isSpecial == true) { string[] strs = parts[i].Split('|'); if (strs.Length > 1) { // |����������ĵ�ֵVALUE word.addStructruralWord(strs[1]); } else { //���û�����IJ��֣���ʹ��Ӣ�Ĵ� word.addStructruralWord(strs[0]); } continue; } //����Ǿ���ʣ��������ſ�ʼ�ͽ�β: (Afghanistan|������) if (parts[i].StartsWith("(")) { //ȥ�����ʵ������������ţ�ʣ�µ�parts[i]��ŵ��Ǿ���ʱ��� parts[i] = parts[i].Substring(1, parts[i].Length - 1); // parts[i] = parts[i].Replace("\\s+", ""); } //��ϵ��ԭ��֮��Ķ��ǹ�ϵ��ԭ if (parts[i].Contains("=")) { isRelational = true;//��ϵ��ԭ��־TRUE // format: content=fact|���� string[] strs = parts[i].Split('='); relationalPrimitiveKey = strs[0];//�Ⱥ�ǰ�����KEY string[] values = strs[1].Split('|'); if (values.Length > 1) { //�Ⱥź����|����������ĵ�ֵVALUE if (relationalPrimitiveKey != string.Empty) { word.addRelationalPrimitive(relationalPrimitiveKey, values[1]);//��ӹ�ϵ��ԭ } } //������һ��ѭ�� continue; } //��ȡ���IJ���chinese string[] strss = parts[i].Split('|'); // �������IJ��ֵĴ���,�������û�����Ľ��� if (strss.Length > 1) { //��ȡ|��������IJ��� chinese = strss[1]; } //�������IJ��֣����п��ܴ����� ����� if (chinese != null && (chinese.EndsWith(")") || chinese.EndsWith("}"))) { //С���0��ʼ����Ϊ��(Europe|ŷ��) 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.setFirstPrimitive(chinese); isFirst = false; continue; } else { word.addOtherPrimitive(chinese); continue; } } // ��ϵ���ű� if (type == 1) { isSimbol = true; isRelational = false; //ȡ��ǰ��ĵ�һ�����ţ�����ϵ��ԭ�ķ���!@#$%*�� simbolKey = (strss[0].ToCharArray()[0]).ToString(); //��ӵ���ϵ������ԭ�������� word.addRelationSimbolPrimitive(simbolKey, chinese); continue; } } }