private static void dealTrain(String path, String toTrainFile,
			String resultFile, Classifier<String, String> bayes) {

		BufferedReader reader = null;
		FileWriter writer = null;
		try {
			File file = new File(path + toTrainFile);

			// 打开一个写文件器，构造函数中的第二个参数true表示以追加形式写文件
			writer = new FileWriter(path + resultFile);

			reader = new BufferedReader(new FileReader(file));
			String temp = null;
			String type = null;
			// 一次读入一行，直到读入null为文件结束
			while ((temp = reader.readLine()) != null) {
				// type = getClassification(temp.split(" "));
				type = bayes.classify(Arrays.asList(temp.split(" ")))
						.getCategory();
				writer.write(temp + "\t" + type);
				writer.write("\n");
			}

			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e1) {
					e1.printStackTrace();
				}
			}
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e1) {
					e1.printStackTrace();
				}
			}
		}
	}