New API

class pyborg.pyborg.PyborgExperimental(brain: pathlib.Path, words: Dict[KT, VT], lines: Dict[KT, VT], settings_file: pathlib.Path = '/home/docs/.config/pyborg/pyborg.toml', settings: pyborg.pyborg.FakeCfg2 = FakeCfg2(aliases={}, num_aliases=0, ignore_list=[], max_words=6000, num_words=0, num_contexts=0, no_save=False, learning=True), internal_commands: Dict[KT, VT] = {'checkdict': InternalCommand(name='checkdict', function=<function _internal_commands_generate.<locals>.<lambda>>, help='check the brain for broken links (legacy)')}, ver_string: str = 'I am a version 2.0a3 Pyborg', saves_version: str = '1.4.0')[source]
classmethod from_brain(brain: pathlib.Path)[source]
learn(body: str) → None[source]
make_reply(body: str) → str[source]
save() → None[source]

Save brain as 1.4.0 JSON-Unsigned format

Old API

The core of pyborg is contained in the pyborg.pyborg module.

class pyborg.pyborg.pyborg(brain=None)[source]
learn(body, num_context=1)[source]

Lines should be cleaned (filter_message()) before passing to this.

replace(old, new)[source]

Replace all occuraces of ‘old’ in the dictionary with ‘new’. Nice for fixing learnt typos.

reply(body)[source]

Reply to a line of text.

unlearn(context)[source]

Unlearn all contexts containing ‘context’. If ‘context’ is a single word then all contexts containing that word will be removed, just like the old !unlearn <word>