-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinterface.go
43 lines (33 loc) · 1.4 KB
/
interface.go
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
package gnparser
import (
"context"
"github.com/gnames/gnfmt"
"github.com/gnames/gnlib/ent/gnvers"
"github.com/gnames/gnparser/ent/nameidx"
"github.com/gnames/gnparser/ent/parsed"
)
// GNparser is the main use-case interface. It provides methods required
// for parsing scientific names.
type GNparser interface {
// ChangeConfig allows to modify settings of GNparser. Changing settings
// might modify parsing process, and the final output of results.
ChangeConfig(opts ...Option) GNparser
// Debug parses a string and outputs raw AST tree from PEG engine.
Debug(s string) []byte
// Format returns currently chosen desired output format of a JSON or
// CSV output.
Format() gnfmt.Format
// GetVersion provides a version and a build timestamp of gnparser.
GetVersion() gnvers.Version
// ParseName takes a name-string, and returns parsed results for the name.
ParseName(string) parsed.Parsed
// ParseNameStream takes a context, an input channel that takes a
// a name-string and its position in the input. It returns parsed results
// that come in the same order as the input.
ParseNameStream(context.Context, <-chan nameidx.NameIdx, chan<- parsed.Parsed)
// ParseNames takes a slice of name-strings, and returns a slice of
// parsed results in the same order as the input.
ParseNames([]string) []parsed.Parsed
// WebLogs returns a boolean to show or not the web-service logs.
WebLogs() bool
}