0
Ich habe den classifier standfordNER verwendet, um Text zu klassifizieren. Hier ist der Code.Wie erzeuge ich eine XML-Ausgabe von Standfordner Classifier?
string docText = fileContent;
string txt = "";
var classified = Classifier.classifyToCharacterOffsets(docText).toArray();
for (int i = 0; i < classified.Length; i++)
{
Triple triple = (Triple)classified[i];
int second = Convert.ToInt32(triple.second().ToString());
int third = Convert.ToInt32(triple.third().ToString());
txt = txt + ('\t' + triple.first().ToString() + '\t' + docText.Substring(second, third - second));
string s = Classifier.classifyWithInlineXML(txt);
string s1 = Classifier.classifyToString(s, "xml", true);
Panel1.GroupingText = s1;
}
Panel1.Visible = true;
und das ist das löschte:
LOCATION Lanka LOCATION colombo ORGANIZATION microsoft
Aber ich brauche eine im XML-Format ausgegeben wie diese
<LOCATION> Lanka </LOCATION> <LOCATION>colombo</LOCATION> <ORGANIZATION> microsoft</ORGANIZATION>
In meinem Code habe ich verwendet,
string s = Classifier.classifyWithInlineXML(txt);
string s1 = Classifier.classifyToString(s, "xml", true);
um die XML zu bekommen, aber es funktioniert nicht. Da ich neu in diesem Bereich bin, bitte hilf mir, das Problem zu lösen. Vielen Dank