modbot.environment.RunConfig

class modbot.environment.RunConfig(file_name=None, args=None)[source]

Bases: BaseConfig

Config class to hold run time config parameters

Methods

get_config([file_name, config])

Get configuration from file

save(outpath)

Save config to json file

update_config(args)

Update config with args

Attributes

ACT_PMIN

Threshold probability for moderation

BERT_ENCODER

Path to bert encoder

BERT_PREPROCESS

Path to bert preprocess model

CHANNEL

Channel to moderate

CHATTY_DIR

Path to Chatty data for training

CHECK_PMIN

Threshold probability to check for new classification

DATA_DIR

Directory where training data and model is stored

FILE_NAME

config file path

INFILE

file for training

LOGGER_LEVEL

Log level.

LOG_DIR

Directory to write logs

LOG_PATH

Get default log file name

MODEL_PATH

Path to ML model

MODEL_TYPE

Type of model to use for moderation

NICKNAME

Bot username

NOLINKS

Whether to allow links in chat or not

OFFENSIVE_WEIGHT

Ratio of ones to total number of samples for training data

PMSG_ON

Whether to send message in chat when probability is exceeded

WRITE_LOG

Whether to write chat messages to log file

attrs

Config attributes info

public_attrs

Get public attributes

ACT_PMIN = 0.6

Threshold probability for moderation

BERT_ENCODER = 'https://tfhub.dev/tensorflow/small_bert/bert_en_uncased_L-2_H-128_A-2/2'

Path to bert encoder

BERT_PREPROCESS = 'https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/3'

Path to bert preprocess model

CHANNEL = None

Channel to moderate

CHATTY_DIR = None

Path to Chatty data for training

CHECK_PMIN = 0.4

Threshold probability to check for new classification

DATA_DIR = '/home/runner/work/modbot/modbot/data'

Directory where training data and model is stored

FILE_NAME = None

config file path

INFILE = None

file for training

LOGGER_LEVEL = 'VERBOSE'

Log level.

LOG_DIR = '/home/runner/work/modbot/modbot/data/logs'

Directory to write logs

property LOG_PATH

Get default log file name

MODEL_PATH = None

Path to ML model

MODEL_TYPE = 'SVM'

Type of model to use for moderation

NICKNAME = None

Bot username

Whether to allow links in chat or not

OFFENSIVE_WEIGHT = 0.01

Ratio of ones to total number of samples for training data

PMSG_ON = False

Whether to send message in chat when probability is exceeded

WRITE_LOG = True

Whether to write chat messages to log file

property attrs

Config attributes info

get_config(file_name=None, config=None)

Get configuration from file

Parameters
  • file_name (str) – Path to configuration file

  • config (RunConfig) – Optional config class with stored parameters

Returns

Config class with run time configuration stored in attributes

Return type

RunConfig

property public_attrs

Get public attributes

Returns

Dictionary of public global attributes

Return type

dict

save(outpath)

Save config to json file

Parameters

outpath (str) – Path to save public attrs

update_config(args)

Update config with args

Parameters

args (parser.parse_args) – Args from argparser with which to update config