punctuation

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute starts the server

func NewRouter

func NewRouter(data *ServiceData) *mux.Router

NewRouter creates the router for HTTP service

func StartWebServer

func StartWebServer(data *ServiceData) error

StartWebServer starts the HTTP service and listens for the requests

Types

type DataProvider

type DataProvider interface {
	GetVocab() (io.Reader, error)
	GetData() (*api.Data, error)
}

DataProvider provides data to initializer

type Input

type Input struct {
	Text string `json:"text"`
}

Input contains punctuation input text

type InputArray

type InputArray struct {
	Words []string `json:"input"`
}

InputArray contains punctuation input words array

type Output

type Output struct {
	PunctuatedText string   `json:"punctuatedText"`
	Original       []string `json:"original"`
	Punctuated     []string `json:"punctuated"`
	WordIDs        []int32  `json:"wordIDs"`
	PunctIDs       []int32  `json:"punctIDs"`
}

Output contains punctuation output

type Punctuator

type Punctuator interface {
	Process(data []string) (*api.PResult, error)
}

Punctuator invokes TF to retrieve punctuation

type PunctuatorImpl

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

PunctuatorImpl implements punctuator service

func NewPunctuatorImpl

func NewPunctuatorImpl(d DataProvider, tfWrap TFWrap) (*PunctuatorImpl, error)

NewPunctuatorImpl creates instance

func (*PunctuatorImpl) Process

func (p *PunctuatorImpl) Process(text []string) (*api.PResult, error)

Process is main Punctuator method

type ServiceData

type ServiceData struct {
	Port int
	// contains filtered or unexported fields
}

ServiceData keeps data required for service work

type SettingsDataProviderImpl

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

SettingsDataProviderImpl provides punctuator data from settings

func NewSettingsDataProviderImpl

func NewSettingsDataProviderImpl(dir string) (*SettingsDataProviderImpl, error)

NewSettingsDataProviderImpl inits SettingsDataProviderImpl from directory

func (*SettingsDataProviderImpl) GetData

func (p *SettingsDataProviderImpl) GetData() (*api.Data, error)

GetData gets data

func (*SettingsDataProviderImpl) GetVocab

func (p *SettingsDataProviderImpl) GetVocab() (io.Reader, error)

GetVocab return reader to word vocabulary

type TFWrap

type TFWrap interface {
	Invoke([]int32) ([]int32, error)
}

TFWrap makes real call to tensorflow service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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