一个用于自动化处理学术论文格式的Python工具,支持智能识别文档结构并应用指定格式要求。
- 🔍 智能识别文档结构(标题、摘要、关键词、章节等)
- 📝 支持多种格式识别方式(样式解析、传统解析、AI辅助)
- 🎨 灵活的格式规范配置
- 🤖 可选的AI辅助分析和格式建议
- 📋 预设格式模板支持
- 🔧 自定义格式要求
src/
├── __init__.py
├── config/
│ ├── __init__.py
│ ├── config.yaml # Global configuration file 全局配置文件
│ └── config_manager.py # Configuration manager 配置管理器
├── core/
│ ├── __init__.py
│ ├── ai_assistant.py # AI assistance functions AI辅助功能
│ ├── document.py # Core document processing 文档处理核心
│ ├── format_spec.py # Formatting specifications 格式规范定义
│ ├── formatter.py # Formatting implementations 格式化实现
│ └── presets/
│ └── default.yaml # Default formatting template 默认格式模板
└── test/
└── test.docx # Sample document for testing 测试用文档
-
Install Dependencies
安装依赖:pip install -r requirements.txt
-
Run the Application
启动程序:python main.py
from src.config.config_manager import ConfigManager
from src.core.formatter import WordFormatter
from src.core.document import Document# Load configuration 加载配置
config_manager = ConfigManager()
# Load the document 加载文档
doc = Document("path/to/your/document.docx")
# Initialize the formatter 初始化格式化工具
formatter = WordFormatter(doc, config_manager)formatter.format()doc.save("output.docx")The primary configuration file is located at src/config/config.yaml. Below is an example configuration:
主要配置文件位于 src/config/config.yaml。以下是示例配置:
ai_assistant:
enabled: false # Enable or disable AI assistance 是否启用AI辅助
model: "gpt-3.5-turbo" # Specify the AI model 使用的AI模型
formatting:
use_default_template: true # Use the default formatting template 是否使用默认模板
template_path: "src/core/presets/default.yaml" # Path to the template 模板路径You can modify these options to tailor the tool to your requirements.
可以根据需求修改这些选项。
- Fork the repository and create your feature branch (
git checkout -b feature/AmazingFeature).
Fork项目并创建功能分支(git checkout -b feature/AmazingFeature)。 - Commit your changes (
git commit -m 'Add some AmazingFeature').
提交更改(git commit -m 'Add some AmazingFeature')。 - Push to the branch (
git push origin feature/AmazingFeature).
推送分支(git push origin feature/AmazingFeature)。 - Open a pull request.
发起Pull Request。
- Ensure Python 3.8+ is installed.
确保已安装Python 3.8或更高版本。 - When using AI-assisted features, ensure your API credentials for OpenAI are correctly configured.
使用AI辅助功能时,请确保正确配置了OpenAI的API凭据。 - Contributions and bug reports are welcome!
欢迎贡献代码和提交问题反馈!