lattice

package
v0.0.0-...-920bcd1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MainInd = "1"

MainInd ord line indicator

View Source
var SilWord = "<eps>"

SilWord indicate sil word in lattice

Functions

func Duration

func Duration(str string) time.Duration

Duration return duration from string as seconds (eg.: "2.50")

func DurationToText

func DurationToText(d time.Duration) string

DurationToText converts duration to text

func FixPuncts

func FixPuncts(data []*Part)

FixPuncts drop `.` if the last word contains dot

func IsSilence

func IsSilence(w *Word) bool

IsSilence test if word is silence word

func SilDuration

func SilDuration(data []*Part, i int) time.Duration

SilDuration return duration between main last word of data[i-1] and first main word of data[i]

func ToDuration

func ToDuration(v float64) time.Duration

ToDuration convert second as float to duration

func WordDuration

func WordDuration(w *Word) time.Duration

WordDuration return duration from word line

func Write

func Write(data []*Part, writer io.Writer) error

Write writes lattice file

Types

type Part

type Part struct {
	Speaker string
	Num     int
	Words   []*Word
}

Part is some lattice data

func Read

func Read(src io.Reader) ([]*Part, error)

Read reads lattice file

type Word

type Word struct {
	Main  string
	From  string
	To    string
	Text  string
	Words []string // may be several words separated by '_'
	Punct string
}

Word is one line in lattice file

Jump to

Keyboard shortcuts

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