0
我已標記的20句,這是我的代碼:XML格式
public class myTag {
public static void main(String[] args) {
Properties props = new Properties();
try {
props.load(new FileReader("D:/tagger/english-bidirectional-distsim.tagger.props"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MaxentTagger tagger = new MaxentTagger("D:/tagger/english-bidirectional-distsim.tagger",props);
//==================================================================================================
try (BufferedReader br = new BufferedReader(new FileReader("C:/Users/chelsea/Desktop/EN/EN.txt")))
{
String sCurrentLine;
while ((sCurrentLine = br.readLine()) != null) {
String tagged = tagger.tagString(sCurrentLine);
System.out.println(tagged);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
這是輸出:
img http://i59.tinypic.com/2w5pp4o.png
,你可以在句子節點看到它有一個Id屬性,這裏它不斷= 0它不應該be.i期望值= 0,1,2,3,4,... 我不明白我的代碼有什麼問題。