parse_input¶
anki_deck_from_text.parse_input ¶
Contains functions to go from a path to a text file to a dictionary in the format {question: answer}
generate_question_answer_dict ¶
Parse an input file and return a {question: answer} dict.
Tries UTF-8 first, then falls back to chardet-detected encoding.
Source code in src/anki_deck_from_text/parse_input.py
get_card_details ¶
Open a file with the given encoding and extract card details.
Source code in src/anki_deck_from_text/parse_input.py
fill_question_answer_dict ¶
Filter marked lines from file_obj and split into question/answer pairs.
Source code in src/anki_deck_from_text/parse_input.py
question_answer_split ¶
Split a marked line into (front, back) card content.
Strips the marker from the left, splits on the separator, and returns (right-of-separator, left-of-separator) as (front, back).
Source code in src/anki_deck_from_text/parse_input.py
detect_encoding ¶
Detect encoding and return encoding and confidence level.