@Override
	public void batchAddNgram(LinkedList<Ngram> list) {
		System.out.println("The total ngram is :" + list.size());

		int count = 0;
		Connection conn = JDBC.createConnection();
		Ngram ngram;

		String sql = "insert ignore into ngram(wordGroup,wordAttribute) values";
		for (int index = 0; index < list.size(); index++) {

			ngram = list.get(index);
			String wordAfterHandle = ngram.getWordGroup();
			char tmp;
			StringBuffer sb = new StringBuffer();

			for (int offset = 0; offset < wordAfterHandle.length(); offset++) {
				if ((tmp = wordAfterHandle.charAt(offset)) == '\'') {
					sb.append('\\');
					sb.append('\'');
				} else {
					sb.append(tmp);
				}
			}

			wordAfterHandle = sb.toString();

			if (index == list.size() - 1) {

				// sql = sql.substring(0, sql.length() - 1) + ";";
				// System.out.println("the end sql :" + sql);

				sql = sql + "('" + wordAfterHandle + "','"
						+ ngram.getWordAttribute() + "');";

				PreparedStatement stat = JDBC.getSatement(conn, sql);
				try {
					stat.executeUpdate();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					System.out.println("here:" + sql);
					e.printStackTrace();
				}
				JDBC.close(stat);
				JDBC.close(conn);
				return;
			}

			// if (findNgram(wordAfterHandle) == null) {
			if (count < 1000) {
				sql = sql + "('" + wordAfterHandle + "','"
						+ ngram.getWordAttribute() + "'),";
				count++;
			} else if (count == 1000) {
				sql = sql + "('" + wordAfterHandle + "','"
						+ ngram.getWordAttribute() + "');";

				// System.out.println("the sql is " + sql);
				PreparedStatement stat = JDBC.getSatement(conn, sql);
				try {
					stat.executeUpdate();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					System.out.println("error:" + sql);
					e.printStackTrace();
				}
				JDBC.close(stat);

				sql = "insert into ngram(wordGroup,wordAttribute) values";
				count = 0;
			}
			// }
		}
		JDBC.close(conn);
	}