danoan.perchance_tools.core.api module
- danoan.perchance_tools.core.api.create_dict_from_markdown(markdown_stream: TextIO) WordDict [source]
Create a dictionary from markdown text.
Header titles are mapped to keys which values are dictionaries themselves created from theirs sub-headers.
The text level is stored in the key words within its closest header-level dictionary. The words key stores the lines of the text.
- Parameters:
markdown_stream (TextIO)
- Return type:
- danoan.perchance_tools.core.api.find_corrections(word_dict: WordDict, language) List[ReplaceInstructions] [source]
Find typos and mispelled words in the dictionary.
Runs a prompt over a LLM to find mispelled words in the WordDict and return a list of ReplaceInstructions.
- Parameters:
word_dict (WordDict)
- Return type:
List[ReplaceInstructions]
- danoan.perchance_tools.core.api.replace_words(word_dict: WordDict, correction_instructions: List[ReplaceInstructions])[source]
Executes a series of replace operations in a WordDict.
The ReplaceInstruction has a key and a list of replace pairs with old and new word.
- Parameters:
word_dict (WordDict)
correction_instructions (List[ReplaceInstructions])