Saturday, 4 April 2015

xml format in stanford pos tagger



i have tagged 20 sentences and this is my code:



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();
}

}

}


this is the output:


img


as you can see in sentence node it has a Id attribute and here it's constantly=0 which it should not be.i expect the value=0,1,2,3,4,... i don't understand what is wrong with my code.


No comments:

Post a Comment