city

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

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

README

github.com/mozillazg/go-pinyin 库有问题 多音字识别会出错

  • 比如说重庆 识别为 zhongqing 瓜皮

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlatData = make([]*TreeNode, 0)
View Source
var TreeData = make([]*TreeNode, 0)

Functions

func GetAllCityStr

func GetAllCityStr(hasSuffix bool) []string

func GetGytStr

func GetGytStr() []string

GetGytStr 获取港澳台

func GetZcsStr

func GetZcsStr(hasSuffix bool) []string

GetZcsStr 获取直辖市

func GroupCityByP1

func GroupCityByP1() map[string][]*TreeNode

func GroupCityByP1String

func GroupCityByP1String(hasSuffix bool) map[string][]string

func ProvinceGetCityStr

func ProvinceGetCityStr(provinceName string, hasSuffix bool) ([]string, bool)

Types

type TreeBase

type TreeBase struct {
	Adcode string `json:"adcode"` // 唯一id 数字的
	Name   string `json:"name"`   // 名称
	Suffix string `json:"suffix"` // 后缀
}

func GetAllCityBase

func GetAllCityBase() []TreeBase

func GetZscBase

func GetZscBase() []TreeBase

type TreeNode

type TreeNode struct {
	TreeBase
	Parent     string      `json:"parent"`      // 这个是父级的adcode
	Py         string      `json:"py"`          // 拼音
	Pf         string      `json:"pf"`          // 拼音首字符
	P1         string      `json:"p1"`          // 拼音首字母
	IsProvince bool        `json:"is_province"` // 省份
	IsCity     bool        `json:"is_city"`     // 城市
	IsNyc      bool        `json:"is_nyc"`      // 直辖市
	Lat        float64     `json:"lat" `
	Lng        float64     `json:"lng"`
	Children   []*TreeNode `json:"children"`
}

func AdCodeGet

func AdCodeGet(code string) *TreeNode

func GetAllCity

func GetAllCity() []TreeNode

GetAllCity 获取所有市

func GetCodes

func GetCodes(codes ...string) []TreeNode

GetCodes 合并获取多个code内容

func GetProvince

func GetProvince() []TreeNode

GetProvince 获取所有省份

func GetZsc

func GetZsc() []TreeNode

func Match

func Match(name string) (*TreeNode, bool)

func ProvinceGetCity

func ProvinceGetCity(provinceName string) ([]TreeNode, bool)

ProvinceGetCity 省份名称获取下属城市

func RandomGet

func RandomGet(count uint8, exclude ...string) []TreeNode

RandomGet 随机取n条 exclude包含即排除

func Search(name string) []TreeNode

Jump to

Keyboard shortcuts

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