dictionary

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Overview

Chinese-English dictionary database functions

Package for looking up words and multiword expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDBCon added in v0.0.5

func InitDBCon() (*sql.DB, error)

func LoadDict

func LoadDict(ctx context.Context, database *sql.DB) (map[string]dicttypes.Word, error)

Loads all words from the database

Types

type Results

type Results struct {
	Words []dicttypes.Word
}

Encapsulates term lookup recults

type Searcher added in v0.0.5

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

Encapsulates dictionary searcher

func NewSearcher added in v0.0.5

func NewSearcher(ctx context.Context, database *sql.DB) (*Searcher, error)

Initialize SQL statements

func (*Searcher) FindWordsByEnglish added in v0.0.5

func (searcher *Searcher) FindWordsByEnglish(ctx context.Context,
	query string) ([]dicttypes.WordSense, error)

Returns the word senses with English approximate or Pinyin exact match

func (*Searcher) LookupSubstr added in v0.0.5

func (searcher *Searcher) LookupSubstr(ctx context.Context,
	query, topic_en, subtopic_en string) (*Results, error)

Lookup a term based on a substring and a topic

Jump to

Keyboard shortcuts

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