gomamayo

package module
v0.0.0-...-d85dd33 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 3 Imported by: 0

README

go-mamayo

MIT LICENSE GitHub go.mod Go version GoDev

Gomamayo provides checking a term if it is Gomamayo.

What is Gomamayo ?

Gomamayo is a term which has consecutive pronunciation between words, like Goma-mayo salad and Ghost Trick.

Getting Started

Usage

First, import go-mamayo to your project.

go get github.com/jugesuke/gomamayo
import "github.com/jugesuke/gomamayo"

Next, create *gomamayo.GoMamayo.

g, err := gomamayo.Init()
if err != nil {
  panic(err)
}

Next, use Analyze function.

result := g.Analyze("ゴママヨサラダ")

To get the result if the term is Gomamayo, use result.IsGomamayo.

result := g.Analyze("ゴママヨサラダ")
if result.IsGomamayo {
  fmt.Println("This is Gomamayo")
} else {
  fmt.Println("This is not Gomamayo")
}

References

Documentation

Overview

Package gomamayo provides checking a term if it is Gomamayo.

How to Use

You can check if a term is Gomamayo with Analyze function, like below.

g, err := gomamayo.Init()
if err != nil {
	panic(err)
}
result := g.Analyze("ゴママヨサラダ")
if result.IsGomamayo {
	fmt.Println("This is Gomamayo")
} else {
	fmt.Println("This is not Gomamayo")
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoMamayo

type GoMamayo struct {
	*tokenizer.Tokenizer
	// contains filtered or unexported fields
}

func Init

func Init() (*GoMamayo, error)

Set dictionary. You must do this first. Set dictionary you like. You can use a Kagome Dictionary. https://github.com/ikawaha/kagome#dictionaries

func (*GoMamayo) Analyze

func (g *GoMamayo) Analyze(s string) *Result

Analyze checks if a sentence is Dajare.

type Result

type Result struct {
	// If it is Dajare, this field is True, else False.
	IsGomamayo bool

	Ary    int // n項
	Degree int // n次

	Sentence string
	Reading  string

	Tokens []string
}

Result has a result of IsDajare function.

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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