leipzig

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFile

func NewFile() corpus.File

NewFile returns a new File

func NewLeipzigCorpus

func NewLeipzigCorpus() corpus.Corpus

NewLeipzigCorpus returns a new Leipzig corpus

func NewPayload

func NewPayload(line string) corpus.Payload

NewPayload returns a new Payload from a line in the corpus.

Types

type File

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

File implements the corpus.File interface.

func (File) CacheDir

func (f File) CacheDir() string

CacheDir is the directory where files are cached

func (File) FilePath

func (f File) FilePath() string

FilePath is the path to the cached file

func (File) WithCacheDir

func (f File) WithCacheDir(cacheDir string) corpus.File

WithCacheDir sets the cache directory

func (File) WithFileName added in v1.1.2

func (f File) WithFileName(fileName string) corpus.File

WithFileName sets the filename

type LeipzigCorpus

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

LeipzigCorpus is a corpus of text data. Implements the Corpus interface.

func (*LeipzigCorpus) FetchCorpusFile

func (c *LeipzigCorpus) FetchCorpusFile() corpus.File

FetchCorpusFile gets the file from the remote url. We assume that the file is compressed somehow, and we want to get a file from the container.

func (*LeipzigCorpus) GetIterator

func (c *LeipzigCorpus) GetIterator(cache corpus.File) corpus.Iterator

GetIterator returns an iterator for the corpus

func (*LeipzigCorpus) Language

func (c *LeipzigCorpus) Language() string

Language returns the language of the corpus

func (*LeipzigCorpus) Size

func (c *LeipzigCorpus) Size() string

Size returns the size of the corpus

func (*LeipzigCorpus) Source

func (c *LeipzigCorpus) Source() string

Source returns the source of the corpus

func (*LeipzigCorpus) URL

func (c *LeipzigCorpus) URL() string

URL returns the URL of the corpus

func (*LeipzigCorpus) WithLanguage

func (c *LeipzigCorpus) WithLanguage(lang string) corpus.Corpus

WithLanguage sets the language of the corpus

func (*LeipzigCorpus) WithSize

func (c *LeipzigCorpus) WithSize(size string) corpus.Corpus

WithSize sets the size of the corpus

func (*LeipzigCorpus) WithSource

func (c *LeipzigCorpus) WithSource(source string) corpus.Corpus

WithSource sets the source of the corpus

func (*LeipzigCorpus) WithURL

func (c *LeipzigCorpus) WithURL(url string) corpus.Corpus

WithURL sets the URL of the corpus The URL corresponds to the base URI where the corpus is stored. Then the corpusFile will be added.

func (*LeipzigCorpus) WithYear

func (c *LeipzigCorpus) WithYear(year string) corpus.Corpus

WithYear sets the year of the corpus

func (*LeipzigCorpus) Year

func (c *LeipzigCorpus) Year() string

Year returns the year of the corpus

type LeipzigIterator

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

Implements the Iterator interface.

func (*LeipzigIterator) HasNext

func (c *LeipzigIterator) HasNext() bool

HasNext returns true if there is another sentence in the corpus

func (*LeipzigIterator) Next

func (c *LeipzigIterator) Next() corpus.Payload

Next returns the next sentence from the corpus

type Payload

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

Payload implements the corpus.Payload interface.

func (*Payload) Content

func (p *Payload) Content() string

Content returns the payload given a line from the Corpus Iterator

func (*Payload) LineNumber

func (p *Payload) LineNumber() int

LineNumber returns the payload given a line from the Corpus Iterator If the line number is not a number, it will return -1

func (*Payload) SetContent

func (p *Payload) SetContent(content string)

SetContent sets the content of the payload

func (*Payload) SetLineNumber

func (p *Payload) SetLineNumber(line int)

SetLineNumber sets the line number of the payload

Jump to

Keyboard shortcuts

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