lemma

package
v0.0.0-...-58581c8 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

lemma is like model package. It contains structure for jisho and wadoku packages and also can compose results from them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccentDirectionStrings

func AccentDirectionStrings() []string

AccentDirectionStrings returns a slice of all String values of the enum

func Enrich

func Enrich(lemmas []*Lemma, pitchedLemmas []*PitchedLemma)

Enrich add pitch infromation from pitches to lemmas. Modifies lemmas, if you need: make copy.

Types

type AccentDirection

type AccentDirection int
const (
	AccentDirectionUp AccentDirection = iota
	AccentDirectionRight
	AccentDirectionDown
	AccentDirectionLeft
)

func AccentDirectionString

func AccentDirectionString(s string) (AccentDirection, error)

AccentDirectionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func AccentDirectionValues

func AccentDirectionValues() []AccentDirection

AccentDirectionValues returns all values of the enum

func (AccentDirection) IsAAccentDirection

func (i AccentDirection) IsAAccentDirection() bool

IsAAccentDirection returns "true" if the value is listed in the enum definition. "false" otherwise

func (AccentDirection) MarshalGQL

func (i AccentDirection) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface for AccentDirection

func (AccentDirection) MarshalText

func (i AccentDirection) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for AccentDirection

func (AccentDirection) String

func (i AccentDirection) String() string

func (*AccentDirection) UnmarshalGQL

func (i *AccentDirection) UnmarshalGQL(value interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface for AccentDirection

func (*AccentDirection) UnmarshalText

func (i *AccentDirection) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for AccentDirection

type Audio

type Audio struct {
	// MediaType is one of the specified audo media types by iana:
	// https://www.iana.org/assignments/media-types/media-types.xhtml#audio
	MediaType string `json:"Format,omitempty"`
	Source    string `json:"Source,omitempty"`
}

type Furigana

type Furigana []FuriganaChar

type FuriganaChar

type FuriganaChar struct {
	Kanji    string `json:"Kanji,omitempty"`
	Hiragana string `json:"Hiragana,omitempty"`
}

type Lemma

type Lemma struct {
	Slug   Word        `json:"Slug,omitempty"`
	Tags   []string    `json:"Tags,omitempty"`
	Forms  []Word      `json:"Forms,omitempty"`
	Senses []WordSense `json:"Senses,omitempty"`
	Audio  []Audio     `json:"Audio,omitempty"`
}

type PitchShape

type PitchShape struct {
	Hiragana   string            `json:"Hiragana,omitempty"`
	Directions []AccentDirection `json:"Directions,omitempty"`
}

type PitchedLemma

type PitchedLemma struct {
	Slug        string
	Hiragana    string
	PitchShapes []PitchShape
}

PitchedLemma is data that we extract from wadoku dictionary.

type ProjectedLemma

type ProjectedLemma struct {
	Slug          Word     `json:"Slug,omitempty"`
	Tags          []string `json:"Tags,omitempty"`
	Forms         []Word   `json:"Forms,omitempty"`
	Definitions   []string `json:"Definitions,omitempty"`
	PartsOfSpeech []string `json:"PartsOfSpeech,omitempty"`
	SenseTags     []string `json:"SenseTags,omitempty"`
	Audio         []Audio  `json:"Audio,omitempty"`
}

ProjectedLemma is more specific variant of Lemma. This structure include only one meaning.

type Word

type Word struct {
	Word     string   `json:"Word,omitempty"`
	Hiragana string   `json:"Hiragana,omitempty"`
	Furigana Furigana `json:"Furigana,omitempty"`
	// PitchShapes is encoded pitch for moras
	// TODO: implement normalization: left direction is prefered,
	// so we say generally say that (a|)(b) should be written as (a)(|b) or
	// (AccentDirectionUD1 AccentDirectionRight)-(AccentDirectionUD2 should be substitute by
	// (AccentDirectionUD1)-(AccentDirectionUD2 AccentDirectionLeft)
	PitchShapes []PitchShape `json:"Pitches,omitempty"`
}

type WordSense

type WordSense struct {
	// Definition is slice of synonymous definitions in english
	Definition   []string `json:"Definition,omitempty"`
	PartOfSpeech []string `json:"PartOfSpeech,omitempty"`
	Tags         []string `json:"Tags,omitempty"`
}

Jump to

Keyboard shortcuts

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