mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-21 07:01:04 +08:00
Refactor: migrate pdf_parser.py to golang (#16323)
### What problem does this PR solve? Http API based on onnx model. pdf_parser.py to golang ### Type of change - [x] Refactoring
This commit is contained in:
22
internal/deepdoc/parser/pdf/table_builder.go
Normal file
22
internal/deepdoc/parser/pdf/table_builder.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"image"
|
||||
)
|
||||
|
||||
// TableBuilder encapsulates TSR model-specific cell detection and grouping.
|
||||
// Each TSR model implements its own Builder, producing a unified row-column
|
||||
// grid consumed by the shared downstream pipeline.
|
||||
type TableBuilder interface {
|
||||
// Name returns the model identifier for logging and diagnostics.
|
||||
Name() string
|
||||
|
||||
// DetectCells detects all cells from a cropped table image.
|
||||
// The Label field on returned TSRCells is consumed only by the Builder
|
||||
// itself during GroupCells; shared code does not depend on Label semantics.
|
||||
DetectCells(ctx context.Context, cropped image.Image) ([]TSRCell, error)
|
||||
|
||||
// GroupCells groups cells into a row-column grid (pure computation, no I/O).
|
||||
GroupCells(cells []TSRCell) [][]TSRCell
|
||||
}
|
||||
Reference in New Issue
Block a user