Make "engine" feature configurable, not much of an engine though, yet.

This commit is contained in:
asofold 2012-09-02 08:14:26 +02:00
parent 386a70eda4
commit fe439d014f
4 changed files with 11 additions and 2 deletions

View File

@ -73,6 +73,7 @@ public class ChatConfig implements CheckConfig {
public final ActionList colorActions; public final ActionList colorActions;
public final boolean globalChatCheck; public final boolean globalChatCheck;
public final boolean globalChatEngineCheck;
public final Set<String> globalChatCommands; public final Set<String> globalChatCommands;
public final float globalChatFrequencyFactor; public final float globalChatFrequencyFactor;
public final float globalChatFrequencyWeight; public final float globalChatFrequencyWeight;
@ -147,6 +148,7 @@ public class ChatConfig implements CheckConfig {
colorActions = data.getActionList(ConfPaths.CHAT_COLOR_ACTIONS, Permissions.CHAT_COLOR); colorActions = data.getActionList(ConfPaths.CHAT_COLOR_ACTIONS, Permissions.CHAT_COLOR);
globalChatCheck = data.getBoolean(ConfPaths.CHAT_GLOBALCHAT_CHECK); globalChatCheck = data.getBoolean(ConfPaths.CHAT_GLOBALCHAT_CHECK);
globalChatEngineCheck = data.getBoolean(ConfPaths.CHAT_GLOBALCHAT_ENGINE_CHECK);
final List<String> commands = data.getStringList(ConfPaths.CHAT_GLOBALCHAT_COMMANDS); final List<String> commands = data.getStringList(ConfPaths.CHAT_GLOBALCHAT_COMMANDS);
globalChatCommands = new HashSet<String>(); globalChatCommands = new HashSet<String>();
if (commands != null){ if (commands != null){

View File

@ -135,8 +135,12 @@ public class GlobalChat extends Check{
score += wWords; score += wWords;
// Engine: // Engine:
final float wEngine = engine.feed(letterCounts); if (cc.globalChatEngineCheck){
score += wEngine; final float wEngine = engine.feed(letterCounts);
score += wEngine;
}
// System.out.println(score);
// Wrapping it up. -------------------- // Wrapping it up. --------------------
// Add weight to frequency counts. // Add weight to frequency counts.

View File

@ -141,6 +141,8 @@ public abstract class ConfPaths {
public static final String CHAT_GLOBALCHAT = CHAT + "globalchat."; public static final String CHAT_GLOBALCHAT = CHAT + "globalchat.";
public static final String CHAT_GLOBALCHAT_CHECK = CHAT_GLOBALCHAT + "active"; public static final String CHAT_GLOBALCHAT_CHECK = CHAT_GLOBALCHAT + "active";
public static final String CHAT_GLOBALCHAT_ENGINE = CHAT_GLOBALCHAT + "engine.";
public static final String CHAT_GLOBALCHAT_ENGINE_CHECK = CHAT_GLOBALCHAT_ENGINE + "active";
public static final String CHAT_GLOBALCHAT_COMMANDS = CHAT_GLOBALCHAT + "commands"; public static final String CHAT_GLOBALCHAT_COMMANDS = CHAT_GLOBALCHAT + "commands";
public static final String CHAT_GLOBALCHAT_FREQUENCY = CHAT_GLOBALCHAT + "frequency."; public static final String CHAT_GLOBALCHAT_FREQUENCY = CHAT_GLOBALCHAT + "frequency.";
public static final String CHAT_GLOBALCHAT_FREQUENCY_WEIGHT = CHAT_GLOBALCHAT_FREQUENCY + "weight"; public static final String CHAT_GLOBALCHAT_FREQUENCY_WEIGHT = CHAT_GLOBALCHAT_FREQUENCY + "weight";

View File

@ -130,6 +130,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.CHAT_GLOBALCHAT_CHECK, true); set(ConfPaths.CHAT_GLOBALCHAT_CHECK, true);
set(ConfPaths.CHAT_GLOBALCHAT_COMMANDS, new LinkedList<String>(Arrays.asList( set(ConfPaths.CHAT_GLOBALCHAT_COMMANDS, new LinkedList<String>(Arrays.asList(
new String[]{"/me"}))); new String[]{"/me"})));
set(ConfPaths.CHAT_GLOBALCHAT_ENGINE_CHECK, true);
set(ConfPaths.CHAT_GLOBALCHAT_FREQUENCY_FACTOR, 0.9D); set(ConfPaths.CHAT_GLOBALCHAT_FREQUENCY_FACTOR, 0.9D);
set(ConfPaths.CHAT_GLOBALCHAT_FREQUENCY_WEIGHT, 6.0D); set(ConfPaths.CHAT_GLOBALCHAT_FREQUENCY_WEIGHT, 6.0D);
set(ConfPaths.CHAT_GLOBALCHAT_LEVEL, 45D); set(ConfPaths.CHAT_GLOBALCHAT_LEVEL, 45D);