Documentation ¶
Index ¶
- Constants
- func NaturalLanguageUnderstanding(text string, license License) (*nlu.AnalysisResults, error)
- func Vision(ocrRequest OcrRequest) ([]*pb.EntityAnnotation, error)
- func VisionObj(ocrRequest OcrRequest) ([]*pb.LocalizedObjectAnnotation, error)
- type ConvertPdf
- type FlagFunction
- type IdentityPreprocessor
- type License
- type MockEngine
- type OcrEngine
- type OcrEngineType
- type OcrHttpHandler
- type OcrHttpMultipartHandler
- type OcrRequest
- type OcrResult
- type OcrRpcClient
- type OcrRpcWorker
- type Preprocessor
- type PreprocessorRpcWorker
- type QREngine
- type RabbitConfig
- type StrokeWidthTransformer
- type TesseractEngine
- type TesseractEngineArgs
- type VisionEngine
- type Yandex
Constants ¶
View Source
const ( ENGINE_TESSERACT = OcrEngineType(iota) ENGINE_VISION = OcrEngineType(iota) ENGINE_QR = OcrEngineType(iota) ENGINE_GO_TESSERACT ENGINE_MOCK )
View Source
const MOCK_ENGINE_RESPONSE = "mock engine decoder response"
View Source
const PreprocessorConvertPdf = "convert-pdf"
View Source
const PreprocessorIdentity = "identity"
View Source
const PreprocessorStrokeWidthTransform = "stroke-width-transform"
View Source
const (
RPC_RESPONSE_TIMEOUT = time.Second * 120
)
Variables ¶
This section is empty.
Functions ¶
func NaturalLanguageUnderstanding ¶
func NaturalLanguageUnderstanding(text string, license License) (*nlu.AnalysisResults, error)
func Vision ¶
func Vision(ocrRequest OcrRequest) ([]*pb.EntityAnnotation, error)
func VisionObj ¶
func VisionObj(ocrRequest OcrRequest) ([]*pb.LocalizedObjectAnnotation, error)
Types ¶
type ConvertPdf ¶
type ConvertPdf struct { }
type FlagFunction ¶
type FlagFunction func()
func NoOpFlagFunction ¶
func NoOpFlagFunction() FlagFunction
type IdentityPreprocessor ¶
type IdentityPreprocessor struct { }
type MockEngine ¶
type MockEngine struct { }
func (MockEngine) ProcessRequest ¶
func (m MockEngine) ProcessRequest(ocrRequest OcrRequest) (OcrResult, error)
type OcrEngine ¶
type OcrEngine interface {
ProcessRequest(ocrRequest OcrRequest) (OcrResult, error)
}
func NewOcrEngine ¶
func NewOcrEngine(engineType OcrEngineType) OcrEngine
type OcrEngineType ¶
type OcrEngineType int
func (OcrEngineType) String ¶
func (e OcrEngineType) String() string
func (*OcrEngineType) UnmarshalJSON ¶
func (e *OcrEngineType) UnmarshalJSON(b []byte) (err error)
type OcrHttpHandler ¶
type OcrHttpHandler struct {
RabbitConfig RabbitConfig
}
func NewOcrHttpHandler ¶
func NewOcrHttpHandler(r RabbitConfig) *OcrHttpHandler
func (*OcrHttpHandler) ServeHTTP ¶
func (s *OcrHttpHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type OcrHttpMultipartHandler ¶
type OcrHttpMultipartHandler struct {
RabbitConfig RabbitConfig
}
func NewOcrHttpMultipartHandler ¶
func NewOcrHttpMultipartHandler(r RabbitConfig) *OcrHttpMultipartHandler
func (*OcrHttpMultipartHandler) ServeHTTP ¶
func (s *OcrHttpMultipartHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type OcrRequest ¶
type OcrRequest struct { ImgUrl string `json:"img_url"` ImgBase64 string `json:"img_base64"` EngineType OcrEngineType `json:"engine"` ImgBytes []byte `json:"img_bytes"` PreprocessorChain []string `json:"preprocessors"` PreprocessorArgs map[string]interface{} `json:"preprocessor-args"` EngineArgs map[string]interface{} `json:"engine_args"` // decode ocr in http handler rather than putting in queue InplaceDecode bool `json:"inplace_decode"` }
func (OcrRequest) String ¶
func (o OcrRequest) String() string
type OcrResult ¶
type OcrResult struct {
Text string
}
func HandleOcrRequest ¶
func HandleOcrRequest(ocrRequest OcrRequest, rabbitConfig RabbitConfig) (OcrResult, error)
type OcrRpcClient ¶
type OcrRpcClient struct {
// contains filtered or unexported fields
}
func NewOcrRpcClient ¶
func NewOcrRpcClient(rc RabbitConfig) (*OcrRpcClient, error)
func (*OcrRpcClient) DecodeImage ¶
func (c *OcrRpcClient) DecodeImage(ocrRequest OcrRequest) (OcrResult, error)
type OcrRpcWorker ¶
type OcrRpcWorker struct { Done chan error // contains filtered or unexported fields }
func NewOcrRpcWorker ¶
func NewOcrRpcWorker(rc RabbitConfig) (*OcrRpcWorker, error)
func (OcrRpcWorker) Run ¶
func (w OcrRpcWorker) Run() error
func (*OcrRpcWorker) Shutdown ¶
func (w *OcrRpcWorker) Shutdown() error
type Preprocessor ¶
type Preprocessor interface {
// contains filtered or unexported methods
}
type PreprocessorRpcWorker ¶
type PreprocessorRpcWorker struct { Done chan error // contains filtered or unexported fields }
func NewPreprocessorRpcWorker ¶
func NewPreprocessorRpcWorker(rc RabbitConfig, preprocessor string) (*PreprocessorRpcWorker, error)
func (PreprocessorRpcWorker) Run ¶
func (w PreprocessorRpcWorker) Run() error
func (*PreprocessorRpcWorker) Shutdown ¶
func (w *PreprocessorRpcWorker) Shutdown() error
type QREngine ¶
type QREngine struct { }
func (QREngine) ProcessRequest ¶
func (m QREngine) ProcessRequest(ocrRequest OcrRequest) (OcrResult, error)
type RabbitConfig ¶
type RabbitConfig struct { AmqpURI string Exchange string ExchangeType string RoutingKey string Reliable bool }
func DefaultConfigFlagsOverride ¶
func DefaultConfigFlagsOverride(flagFunction FlagFunction) RabbitConfig
func DefaultTestConfig ¶
func DefaultTestConfig() RabbitConfig
type StrokeWidthTransformer ¶
type StrokeWidthTransformer struct { }
type TesseractEngine ¶
type TesseractEngine struct { }
This variant of the TesseractEngine calls tesseract via exec
func (TesseractEngine) ProcessRequest ¶
func (t TesseractEngine) ProcessRequest(ocrRequest OcrRequest) (OcrResult, error)
type TesseractEngineArgs ¶
type TesseractEngineArgs struct {
// contains filtered or unexported fields
}
func NewTesseractEngineArgs ¶
func NewTesseractEngineArgs(ocrRequest OcrRequest) (*TesseractEngineArgs, error)
func (TesseractEngineArgs) Export ¶
func (t TesseractEngineArgs) Export() []string
return a slice that can be passed to tesseract binary as command line args, eg, ["-c", "tessedit_char_whitelist=0123456789", "-c", "foo=bar"]
type VisionEngine ¶
type VisionEngine struct { Annotations []*pb.EntityAnnotation ObjAnnotations []*pb.LocalizedObjectAnnotation Tags *nlu.AnalysisResults Translation string }
func (VisionEngine) ProcessRequest ¶
func (m VisionEngine) ProcessRequest(ocrRequest OcrRequest) (OcrResult, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.