使用stanford postagger词性标注

		//标注
		String model = "models/chinese.tagger";
		String content = "你们 是 祖国 美丽 盛开 的 花朵";
		MaxentTagger tagger = new MaxentTagger(model);
		List<ArrayList<? extends HasWord>> sentences = MaxentTagger.tokenizeText(new BufferedReader(new StringReader(content)));
		for (ArrayList<? extends HasWord> sentence : sentences) {
		   ArrayList<edu.stanford.nlp.ling.TaggedWord> tSentence = tagger.tagSentence(sentence);
		   System.out.println(tSentence);
		}
		
		//训练
		Map<String,String> param = new HashMap<String, String>();
		param.put("model", "models/modelFile.tagger");
		param.put("trainFile", "train/199801.txt");
		MaxentTagger.main(new String[]{
				//"-prop",(String)param.get("prop"), 
	    		"-model" ,(String)param.get("model") ,
	    		"-trainFile" ,(String)param.get("trainFile")}
	    );
 

你可能感兴趣的:(post)