spacy nlp ner

This commit is contained in:
m
2026-07-12 22:11:57 +02:00
parent 6ed51daa6b
commit 010cb2cb49
22 changed files with 480 additions and 8 deletions
+9
View File
@@ -17,6 +17,7 @@ type OCRJob struct {
type OCRService struct {
client *ocr.Client
fileSvc *FileService
nlpSvc *NLPService
jobs chan OCRJob
}
@@ -28,6 +29,10 @@ func NewOCRService(cfg *config.Config, fileSvc *FileService) *OCRService {
}
}
func (s *OCRService) SetNLPService(nlpSvc *NLPService) {
s.nlpSvc = nlpSvc
}
func (s *OCRService) Start() {
go s.worker()
log.Println("[OCR] Worker started")
@@ -72,6 +77,10 @@ func (s *OCRService) process(job OCRJob) {
}
log.Printf("[OCR] Completed file %s (%d chars)", job.FileID, len(text))
if s.nlpSvc != nil {
s.nlpSvc.Enqueue(job.FileID, job.FilePath, text)
}
}
func (s *OCRService) RecognizeFromBytes(data []byte) ([]ocr.TextBlock, error) {