<commit_before>package com.gmail.inverseconduit.javadoc;

import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.gmail.inverseconduit.datatype.ChatMessage;
import com.gmail.inverseconduit.utils.ChatBuilder;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;

/**
 * Generates chat message responses to the "javadoc" command. Also generates
 * responses to numeric chat messages that users enter when the javadoc command
 * presents them with a list of choices.
 */
public class JavaDocAccessor {
	private final JavadocDao dao;

	private List<String> prevChoices = new ArrayList<>();
	private long prevChoicesPinged = 0;
	private final long choiceTimeout = TimeUnit.SECONDS.toMillis(30);

	/**
	 * "Flags" that a class can have. They are defined in a List because, if a
	 * class has multiple modifiers, I want them to be displayed in a consistent
	 * order.
	 */
	private static final List<String> classModifiers;
	static {
		ImmutableList.Builder<String> b = new ImmutableList.Builder<>();
		b.add("abstract", "final");
		classModifiers = b.build();
	}

	/**
	 * The list of possible "class types". Each class *should* have exactly one
	 * type, but there's no explicit check for this (things shouldn't break if a
	 * class does not have exactly one).
	 */
	private static final Set<String> classTypes;
	static {
		ImmutableSet.Builder<String> b = new ImmutableSet.Builder<>();
		b.add("annotation", "class", "enum", "exception", "interface");
		classTypes = b.build();
	}

	/**
	 * The method modifiers to ignore when outputting a method to the chat.
	 */
	private static final Set<String> methodModifiersToIgnore;
	static {
		ImmutableSet.Builder<String> b = new ImmutableSet.Builder<>();
		b.add("private");
		b.add("protected");
		b.add("public");
		methodModifiersToIgnore = b.build();
	}

	/**
	 * @param dir the directory to the Javadocs folder
	 * @throws IOException if there's a problem reading a Javadoc file
	 */
	public JavaDocAccessor(Path dir) throws IOException {
		dao = new JavadocDao(dir);
	}

	/**
	 * Processes a Javadoc command.
	 * @param chatMessage the chat message (e.g. "**javadoc: arraylist")
	 * @param commandText the command text (e.g. "arraylist")
	 * @return the chat response
	 */
	public String javadoc(ChatMessage chatMessage, String commandText) {
		String response = generateResponse(commandText.trim());

		ChatBuilder cb = new ChatBuilder();
		cb.reply(chatMessage);
		cb.append(response);
		return cb.toString();
	}
<commit_msg>Put all items in the same method call.<commit_after>package com.gmail.inverseconduit.javadoc;

import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.gmail.inverseconduit.datatype.ChatMessage;
import com.gmail.inverseconduit.utils.ChatBuilder;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;

/**
 * Generates chat message responses to the "javadoc" command. Also generates
 * responses to numeric chat messages that users enter when the javadoc command
 * presents them with a list of choices.
 */
public class JavaDocAccessor {
	private final JavadocDao dao;

	/**
	 * 
	 */
	private List<String> prevChoices = new ArrayList<>();
	private long prevChoicesPinged = 0;
	private final long choiceTimeout = TimeUnit.SECONDS.toMillis(30);

	/**
	 * "Flags" that a class can have. They are defined in a List because, if a
	 * class has multiple modifiers, I want them to be displayed in a consistent
	 * order.
	 */
	private static final List<String> classModifiers;
	static {
		ImmutableList.Builder<String> b = new ImmutableList.Builder<>();
		b.add("abstract", "final");
		classModifiers = b.build();
	}

	/**
	 * The list of possible "class types". Each class *should* have exactly one
	 * type, but there's no explicit check for this (things shouldn't break if a
	 * class does not have exactly one).
	 */
	private static final Set<String> classTypes;
	static {
		ImmutableSet.Builder<String> b = new ImmutableSet.Builder<>();
		b.add("annotation", "class", "enum", "exception", "interface");
		classTypes = b.build();
	}

	/**
	 * The method modifiers to ignore when outputting a method to the chat.
	 */
	private static final Set<String> methodModifiersToIgnore;
	static {
		ImmutableSet.Builder<String> b = new ImmutableSet.Builder<>();
		b.add("private", "protected", "public");
		methodModifiersToIgnore = b.build();
	}

	/**
	 * @param dir the directory to the Javadocs folder
	 * @throws IOException if there's a problem reading a Javadoc file
	 */
	public JavaDocAccessor(Path dir) throws IOException {
		dao = new JavadocDao(dir);
	}

	/**
	 * Processes a Javadoc command.
	 * @param chatMessage the chat message (e.g. "**javadoc: arraylist")
	 * @param commandText the command text (e.g. "arraylist")
	 * @return the chat response
	 */
	public String javadoc(ChatMessage chatMessage, String commandText) {
		String response = generateResponse(commandText.trim());

		ChatBuilder cb = new ChatBuilder();
		cb.reply(chatMessage);
		cb.append(response);
		return cb.toString();
	}

{'fraction_non_alphanumeric': 0.11205744822979292, 'fraction_numerical': 0.001002004008016032, 'mean_word_length': 4.474405850091408, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5217900', 'n_tokens_mistral': 1884, 'n_tokens_neox': 1762, 'n_words': 563}