spacy nlp ner
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user