-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.go
More file actions
46 lines (41 loc) · 1.06 KB
/
Copy pathoptions.go
File metadata and controls
46 lines (41 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package edocuenta
// Option configures a Processor.
type Option func(*Processor)
// WithExtractor overrides the default PDF text extractor.
func WithExtractor(extractor TextExtractor) Option {
return func(p *Processor) {
if extractor != nil {
p.extractor = extractor
}
}
}
// WithRescueExtractor overrides the optional OCR rescue extractor used after a
// parser reports unsupported or insufficient text from the primary extraction.
//
// Rescue extraction is opt-in; the default processor does not enable OCR
// automatically.
func WithRescueExtractor(extractor TextExtractor) Option {
return func(p *Processor) {
if extractor != nil {
p.rescueExtractor = extractor
}
}
}
// WithParser registers a single bank parser.
func WithParser(parser Parser) Option {
return func(p *Processor) {
if parser != nil {
p.parsers.Add(parser)
}
}
}
// WithParsers registers multiple bank parsers.
func WithParsers(parsers ...Parser) Option {
return func(p *Processor) {
for _, parser := range parsers {
if parser != nil {
p.parsers.Add(parser)
}
}
}
}