本文整理匯總了Java中edu.stanford.nlp.tagger.maxent.MaxentTagger.tagString方法的典型用法代碼示例。如果您正苦於以下問題:Java MaxentTagger.tagString方法的具體用法?Java MaxentTagger.tagString怎麽用?Java MaxentTagger.tagString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.stanford.nlp.tagger.maxent.MaxentTagger
的用法示例。
在下文中一共展示了MaxentTagger.tagString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generateFeature
import edu.stanford.nlp.tagger.maxent.MaxentTagger; //導入方法依賴的package包/類
private List<LinkedHashMap<Integer, Double>> generateFeature(String rawDataset, String tokenizedDataset, String POSFile) {
String line = null;
try {
PrintWriter write = new PrintWriter(POSFile);
BufferedReader reader = new BufferedReader(new FileReader(new File(rawDataset)));
MaxentTagger tagger = new MaxentTagger(rootDirectory + "\\resources\\stanford-postagger-full-2015-04-20\\models\\english-left3words-distsim.tagger");
//HashMap<String, Double> scoreMap = new HashMap<String, Double>();
while ((line = reader.readLine()) != null) {
String part[] = line.split("\\|");
String tagged = tagger.tagString(part[3]);
//String[] str = line.split("\\|");
//String tagged = tagger.tagString(str[3]);
write.println(tagged);
//System.out.println(line);
//System.out.println(tagged);
//scoreMap.put(str[0], Double.parseDouble(str[1]));
//System.out.println(str[1]);
}
reader.close();
write.close();
} catch (IOException e) {
System.out.println(e);
}
return generateFeatureHelper(POSFile, tokenizedDataset);
}
示例2: generateFeature
import edu.stanford.nlp.tagger.maxent.MaxentTagger; //導入方法依賴的package包/類
private List<LinkedHashMap<Integer, Double>> generateFeature(String rawDataset, String tokenizedDataset, String POSFile) {
String line = null;
try {
PrintWriter write = new PrintWriter(POSFile);
BufferedReader reader = new BufferedReader(new FileReader(new File(rawDataset)));
MaxentTagger tagger = new MaxentTagger(rootDirectory + "\\resources\\stanford-postagger-full-2015-04-20\\models\\english-left3words-distsim.tagger");
//HashMap<String, Double> scoreMap = new HashMap<String, Double>();
while ((line = reader.readLine()) != null) {
String tagged = tagger.tagString(line);
//String[] str = line.split("\\|");
//String tagged = tagger.tagString(str[3]);
write.println(tagged);
//System.out.println(line);
//System.out.println(tagged);
//scoreMap.put(str[0], Double.parseDouble(str[1]));
//System.out.println(str[1]);
}
reader.close();
write.close();
} catch (IOException e) {
System.out.println(e);
}
return generateFeatureHelper(POSFile, tokenizedDataset);
}