public static ArrayList<String> processLine(String line, boolean hasLabel) {
		StringTokenizer tokenizer = new StringTokenizer(line, "\t");
		ArrayList<String> filteredTokens = new ArrayList<String>();
		if (hasLabel) {
			filteredTokens.add(tokenizer.nextToken()); // push click
			filteredTokens.add(tokenizer.nextToken()); // push impression
		}
		tokenizer.nextToken(); // ignore displayURL
		tokenizer.nextToken(); // ignore AdID
		tokenizer.nextToken(); // ignore AdvertiserID
		filteredTokens.add(tokenizer.nextToken()); // push depth
		filteredTokens.add(tokenizer.nextToken()); // push position

		// replace query id with query tokens
		int queryid = Integer.valueOf(tokenizer.nextToken().trim());
		if (queryid < Features.queryFeature.size()) {
			filteredTokens.add(StringUtil.implode(
					Features.queryFeature.get(queryid).iterator(), ","));
		} else {
			filteredTokens.add("-1");
			System.err.println("Warning: unknown queryid=" + queryid);
			System.err.println("Line: " + line);
		}

		// replace keyword id with keyword tokens
		int keywordid = Integer.valueOf(tokenizer.nextToken().trim());
		if (keywordid < Features.keywordFeature.size()) {
			filteredTokens.add(StringUtil.implode(
					Features.keywordFeature.get(keywordid).iterator(), ","));
		} else {
			filteredTokens.add("-1");
			System.err.println("Warning: unknown keyword id=" + keywordid);
			System.err.println("Line: " + line);
		}

		// replace title id with title tokens
		int titleid = Integer.valueOf(tokenizer.nextToken().trim());
		if (titleid < Features.titleFeature.size()) {
			filteredTokens.add(StringUtil.implode(
					Features.titleFeature.get(titleid).iterator(), ","));
		} else {
			filteredTokens.add("-1");
			System.err.println("Warning: unknown title id=" + titleid);
			System.err.println("Line: " + line);
		}

		// replace description id with description tokens.
		int descriptionid = Integer.valueOf(tokenizer.nextToken().trim());
		if (descriptionid < Features.descriptionFeature.size()) {
			filteredTokens.add(StringUtil.implode(Features.descriptionFeature
					.get(descriptionid).iterator(), ","));
		} else {
			filteredTokens.add("-1");
			System.err.println("Warning: unknown descriptionid="
					+ descriptionid);
			System.err.println("Line: " + line);
		}

		// replace description id with description tokens
		int userid = Integer.valueOf(tokenizer.nextToken().trim());
		if (userid < Features.userFeature.size()) {
			filteredTokens
					.add(userid
							+ ","
							+ StringUtil.implode(
									Features.userFeature.get(userid), ","));
		} else {
			filteredTokens.add(userid + ",0,0");
			System.err.println("Warning: unknown userid=" + userid);
			System.err.println("Line: " + line);
		}
		return filteredTokens;
	}