INNER CODE UNIT · Python

main

RQLuo/MixTeX-Latex-OCR · mixtex_data_gen/gen.py:162

def main(input_text_file, input_tex_file, output_folder):
    # Step 1: Clean the input text file by removing non-English characters
    cleaned_text_file = 'en_only.txt'
    remove_non_english_characters(input_text_file, cleaned_text_file)

    # Step 2: Extract LaTeX formulas from the input LaTeX file
    formulas = extract_latex_formulas(input_tex_file)

    # Step 3: Process the cleaned text and insert LaTeX formulas randomly
    processed_text_file = 'en_line.txt'
    process_text(cleaned_text_file, processed_text_file, formulas)

    # Step 4: Read in the processed text and further format it with LaTeX commands
    with open(processed_text_file, 'r', encoding='utf-8') as f:
        txt_content = f.read()
    with open(cleaned_text_file, 'r', encoding='utf-8') as f:
        lines = f.readlines()
    txt_content = remove_symbols(txt_content)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…