detection

package
v0.0.0-...-457a45f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

type Detector struct {
	// contains filtered or unexported fields
}

Detector handles data format detection tasks.

func NewDetector

func NewDetector(s *sources.Database) *Detector

NewDetector starts a new background processor and returns the newly created Detector instance.

func (*Detector) Start

func (d *Detector) Start(fname string) string

Start a background detection process on the given filename. Returns a job token that can be used to check job status

func (*Detector) Status

func (d *Detector) Status(token string) (res *Result, done bool)

Status checks for a Result using the given job-token.

type FieldInfo

type FieldInfo struct {
	// Header or name of the Field if present
	Header string

	// Type of the Field (floats, integers, prefixed integers, text, etc)
	Type string

	// Order of the field in the record.
	Order int
}

FieldInfo describes a Field in a Record.

type Result

type Result struct {
	// Token for retrieving result metadata.
	Token string `json:"token"`

	// InputFilename is the source filename (relative to upload directory).
	InputFilename string `json:"input_file"`

	// DetectedSources reports, for each field of the input, the detected
	// data Sources, percentage hit ratio, and other stats.
	DetectedSources map[string]map[string]*sources.SourceHit `json:"detected"`

	// Fields reports the detected data types of each field.
	Fields []*FieldInfo `json:"fields"`

	// Maps reports the possible direct translation destinations for each
	// data source that was possibly detected in the input.
	Maps map[string][]string `json:"maps"`

	// Sources is the list of sources used for detection.
	Sources map[string]*sources.Source `json:"sources"`
}

Result encodes the results of a detection task on a data file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL