-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update Implementation Details documentation
- Expand core processing flow documentation for BabelDOC translation - Add detailed stages of PDF translation process - Include comprehensive technical overview of translation workflow - Link to specific implementation details and source code references
- Loading branch information
Showing
2 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Implementation Details | ||
|
||
```{note} | ||
This documentation may contain AI-generated content. While we strive for accuracy, there might be inaccuracies. Please report any issues via: | ||
- [GitHub Issues](https://github.com/funstory-ai/BabelDOC/issues) | ||
- Community contribution (PRs welcome!) | ||
``` | ||
|
||
## Core Processing Flow | ||
|
||
The BabelDOC translation process consists of several key stages, executed in the following order: | ||
|
||
1. **PDF Parsing and IL Creation** | ||
- Extract text content while preserving character-level information | ||
- Maintain font and style information | ||
- Create structured intermediate layer (IL) representation | ||
|
||
2. **Layout OCR** | ||
- Process document layout information | ||
- Handle page boundaries and figure elements | ||
- Manage coordinate systems | ||
|
||
3. **Paragraph Recognition** | ||
- Group characters into meaningful paragraphs | ||
- Handle special cases like table of contents | ||
- Maintain layout information for typesetting | ||
|
||
4. **Style and Formula Processing** | ||
- Identify and preserve mathematical formulas | ||
- Detect and maintain text styles | ||
- Handle special cases like subscripts/superscripts | ||
|
||
5. **IL Translation** | ||
- Translate text while preserving document structure | ||
- Maintain formulas and special formatting | ||
- Support concurrent translation | ||
|
||
6. **Typesetting** | ||
- Fit components within original paragraph bounds | ||
- Handle mixed language text spacing | ||
- Support first line indentation | ||
|
||
7. **Font Mapping** | ||
- Map font identifiers | ||
- Handle font encoding | ||
- Manage font resources | ||
|
||
8. **PDF Generation** | ||
- Create new PDF with translated content | ||
- Preserve original formatting and styles | ||
- Support both monolingual and dual-language output | ||
|
||
## Technical Details | ||
|
||
For detailed implementation information about each stage, please refer to: | ||
|
||
```{toctree} | ||
:maxdepth: 1 | ||
PDFParsing/PDFParsing | ||
ParagraphFinding/ParagraphFinding | ||
StylesAndFormulas/StylesAndFormulas | ||
ILTranslator/ILTranslator | ||
Typesetting/Typesetting | ||
PDFCreation/PDFCreation | ||
AsyncTranslate/AsyncTranslate | ||
``` | ||
|
||
```{note} | ||
Some implementation details are available directly in the source code: | ||
- [Layout OCR](https://github.com/funstory-ai/BabelDOC/blob/main/babeldoc/document_il/midend/layout_parser.py) | ||
- [Font Mapping](https://github.com/funstory-ai/BabelDOC/blob/main/babeldoc/document_il/utils/fontmap.py) | ||
``` | ||
|
||
## API Reference | ||
|
||
For information about using the asynchronous translation API, see: | ||
|
||
- [Async Translation API](AsyncTranslate/AsyncTranslate.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters