Documentation ¶
Index ¶
- Constants
- Variables
- type Conj
- type Docker
- type Gloss
- type JSONToken
- type JSONTokens
- func (tokens JSONTokens) Gloss() string
- func (tokens JSONTokens) GlossParts() (parts []string)
- func (tokens JSONTokens) Kana() string
- func (tokens JSONTokens) KanaParts() (parts []string)
- func (tokens JSONTokens) Roman() string
- func (tokens JSONTokens) RomanParts() (parts []string)
- func (tokens JSONTokens) ToMorphemes() JSONTokens
- func (tokens JSONTokens) Tokenized() string
- func (tokens JSONTokens) TokenizedParts() (parts []string)
- type Prop
Constants ¶
const (
ContainerName = "ichiran-main-1"
)
Variables ¶
var (
QueryTO = 1 * time.Hour
)
Functions ¶
This section is empty.
Types ¶
type Conj ¶
type Conj struct { Prop []Prop `json:"prop"` // Conjugation properties Reading string `json:"reading"` // Base form reading Gloss []Gloss `json:"gloss"` // Base form meanings ReadOk bool `json:"readok"` // Reading validity flag }
Conj represents conjugation information
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
func (*Docker) SetLogLevel ¶
SetLogLevel updates the logging level
type Gloss ¶
type Gloss struct { Pos string `json:"pos"` // Part of speech Gloss string `json:"gloss"` // English meaning Info string `json:"info"` // Additional information }
Gloss represents the English glosses and part of speech
type JSONToken ¶
type JSONToken struct { Surface string `json:"text"` // Original text IsToken bool // Whether this is a Japanese token or non-Japanese text Reading string `json:"reading"` // Reading with kanji and kana Kana string `json:"kana"` // Kana reading Romaji string // Romanized form from ichiran Score int `json:"score"` // Analysis score Seq int `json:"seq"` // Sequence number Gloss []Gloss `json:"gloss"` // English meanings Conj []Conj `json:"conj,omitempty"` // Conjugation information Alternative []JSONToken `json:"alternative"` // Alternative interpretations Compound []string `json:"compound"` // Delineable elements of compound expressions Components []JSONToken `json:"components"` // Details of delineable elements of compound expressions Raw []byte `json:"-"` // Raw JSON for future processing }
JSONToken represents a single token with all its analysis information
type JSONTokens ¶
type JSONTokens []*JSONToken
JSONTokens is a slice of token pointers representing a complete analysis result.
func Analyze ¶
func Analyze(text string) (*JSONTokens, error)
Analyze performs morphological analysis on the input Japanese text. Returns parsed tokens or an error if analysis fails. Analyze performs Japanese text analysis using ichiran
func (JSONTokens) Gloss ¶
func (tokens JSONTokens) Gloss() string
Gloss returns a formatted string containing tokens and their English glosses including morphemes and alternative interpretations.
func (JSONTokens) GlossParts ¶
func (tokens JSONTokens) GlossParts() (parts []string)
GlossParts returns a slice of strings containing tokens and their English glosses, including morphemes and alternative interpretations.
func (JSONTokens) Kana ¶
func (tokens JSONTokens) Kana() string
Kana returns a string of all tokens in kana form where available.
func (JSONTokens) KanaParts ¶
func (tokens JSONTokens) KanaParts() (parts []string)
KanaParts returns a slice of all tokens in kana form where available.
func (JSONTokens) Roman ¶
func (tokens JSONTokens) Roman() string
Roman returns a string of all tokens in romanized form.
func (JSONTokens) RomanParts ¶
func (tokens JSONTokens) RomanParts() (parts []string)
RomanParts returns a slice of all tokens in romanized form.
func (JSONTokens) ToMorphemes ¶
func (tokens JSONTokens) ToMorphemes() JSONTokens
ToMorphemes returns a new slice of tokens where compound tokens are replaced by their constituent morphemes
func (JSONTokens) Tokenized ¶
func (tokens JSONTokens) Tokenized() string
TokenizedStr returns a string of all tokens separated by spaces or commas.
func (JSONTokens) TokenizedParts ¶
func (tokens JSONTokens) TokenizedParts() (parts []string)
TokenizedParts returns a slice of all token surfaces.