class pyborg.pyborg.PyborgExperimental(brain: pathlib.Path, words: Dict[str, Dict[str, int]], lines: Dict[int, Tuple[str, int]], settings_file: pathlib.Path = PosixPath('/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[str, pyborg.pyborg.InternalCommand] = {'checkdict': InternalCommand(name='checkdict', function=<function checkdict>, help='check the brain for broken links (legacy)', input=False), 'known': InternalCommand(name='known', function=<function known_command>, help=True, input=True)}, ver_string: str = 'I am a version 2.1.0a1 Pyborg', saves_version: str = '1.4.0', ready: bool = False)[source]
classmethod from_brain(brain: pathlib.Path) pyborg.pyborg.PyborgExperimental[source]
learn(body: str) None[source]
make_reply(body: str) str[source]
save() None[source]

Save brain as 1.4.0 JSON-Unsigned format


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

class pyborg.pyborg.pyborg(brain: Optional[Union[str, pathlib.Path]] = None)[source]
learn(body: str, num_context: int = 1) None[source]

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

replace(old: str, new: str) str[source]

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

reply(body) Optional[str][source]

Reply to a line of text.

unlearn(context: str) None[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>