Update document_processor.py
Browse files6 unmodified lines789101112131415161718196 unmodified lineslogger = setup_logger('document_processor')def load_documents(folder_path):documents = []for file_path in tqdm(glob.glob(os.path.join(folder_path, '*.txt')), desc="Loading documents"):try:with open(file_path, 'r', encoding='utf-8') as file:content = clean_text(file.read())documents.append({'path': file_path, 'content': content})except Exception as e:logger.error(f"Error reading {file_path}: {e}")return pd.DataFrame(documents)6 unmodified lines78910111213141516176 unmodified lineslogger = setup_logger('document_processor')def load_single_document(file_path):try:with open(file_path, 'r', encoding='utf-8') as file:content = clean_text(file.read())return pd.DataFrame([{'path': file_path, 'content': content}])except Exception as e:logger.error(f"Error reading {file_path}: {e}")return pd.DataFrame()
document_processor.py+8-10