fix: Update production API base URL in documentation and configuration files. Correct the URL in the desktop app README, migration documentation, and Vite configuration. Enhance ONNX model feature handling in the processing pipeline to align with the updated feature set, ensuring compatibility with the latest model version. Add tests for feature extraction to validate changes.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package pipeline
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestExtractRowFeaturesServiceTablePattern(t *testing.T) {
|
||||
group := []indexedBox{
|
||||
{Text: "890701", X: 10, Y: 200, Cluster: 0},
|
||||
{Text: "CONSULTA", X: 100, Y: 201, Cluster: 0},
|
||||
{Text: "16,277.00", X: 400, Y: 200, Cluster: 0},
|
||||
{Text: "1", X: 500, Y: 201, Cluster: 0},
|
||||
{Text: "16,277.00", X: 600, Y: 200, Cluster: 0},
|
||||
}
|
||||
row := extractRowFeatures(group, 1000, 2000)
|
||||
if row.Features[2] != 1 {
|
||||
t.Fatalf("has_service_table_pattern = %v, want 1", row.Features[2])
|
||||
}
|
||||
if row.Features[4] != 1 {
|
||||
t.Fatalf("currency_at_row_end = %v, want 1", row.Features[4])
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildFeaturesContinuation(t *testing.T) {
|
||||
boxes := []indexedBox{
|
||||
{Text: "890701", X: 10, Y: 100, Cluster: 0},
|
||||
{Text: "CONSULTA", X: 100, Y: 100, Cluster: 0},
|
||||
{Text: "16,277.00", X: 400, Y: 100, Cluster: 0},
|
||||
{Text: "1", X: 500, Y: 100, Cluster: 0},
|
||||
{Text: "16,277.00", X: 600, Y: 100, Cluster: 0},
|
||||
{Text: "DE", X: 100, Y: 120, Cluster: 1},
|
||||
{Text: "SEGUIMIENTO", X: 200, Y: 120, Cluster: 1},
|
||||
}
|
||||
rows := buildFeatureRows(boxes, 1000, 2000)
|
||||
if len(rows) != 2 {
|
||||
t.Fatalf("rows = %d, want 2", len(rows))
|
||||
}
|
||||
if rows[0].Features[2] != 1 {
|
||||
t.Fatal("first row should have service table pattern")
|
||||
}
|
||||
if rows[1].Features[6] != 1 {
|
||||
t.Fatal("second row should be likely continuation")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFeatureCount(t *testing.T) {
|
||||
if FeatureCount != 14 {
|
||||
t.Fatalf("FeatureCount = %d, want 14", FeatureCount)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user