diff options
| author | Christine Dodrill <me@christine.website> | 2019-02-02 09:19:13 -0800 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2019-02-02 09:19:13 -0800 |
| commit | 337f35b437b8f1e8b64b789e7297dd115d378ed7 (patch) | |
| tree | 98894e7ce7fb1d8d05ae4648432b062acaf84ebc | |
| parent | 22674d6d479afa2e19262ccd30265020964f37fc (diff) | |
| download | x-337f35b437b8f1e8b64b789e7297dd115d378ed7.tar.xz x-337f35b437b8f1e8b64b789e7297dd115d378ed7.zip | |
tokipona: add dictionary json
| -rw-r--r-- | go.mod | 1 | ||||
| -rw-r--r-- | go.sum | 2 | ||||
| -rw-r--r-- | tokipona/internal/bindata.go | 233 | ||||
| -rw-r--r-- | tokipona/internal/data/tokipona.json | 1 | ||||
| -rw-r--r-- | tokipona/internal/generate.go | 3 | ||||
| -rw-r--r-- | tokipona/nimi.go | 31 | ||||
| -rw-r--r-- | tokipona/nimi_test.go | 10 | ||||
| -rw-r--r-- | tools.go | 1 | ||||
| -rw-r--r-- | tools_install.go | 2 |
9 files changed, 283 insertions, 1 deletions
@@ -20,6 +20,7 @@ require ( github.com/fogleman/gg v1.1.0 // indirect github.com/fogleman/primitive v0.0.0-20170926175833-69506c928bef github.com/garyburd/redigo v1.6.0 + github.com/go-bindata/go-bindata v1.0.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/google/go-github v17.0.0+incompatible github.com/google/go-querystring v1.0.0 // indirect @@ -45,6 +45,8 @@ github.com/fogleman/primitive v0.0.0-20170926175833-69506c928bef h1:b2hzCO7V6vnD github.com/fogleman/primitive v0.0.0-20170926175833-69506c928bef/go.mod h1:Tm6t8LbdhSCXNfpjTwoL1mdjCnyKHkMyf6PqQXo7Or8= github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc= github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/go-bindata/go-bindata v1.0.0 h1:DZ34txDXWn1DyWa+vQf7V9ANc2ILTtrEjtlsdJRF26M= +github.com/go-bindata/go-bindata v1.0.0/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= diff --git a/tokipona/internal/bindata.go b/tokipona/internal/bindata.go new file mode 100644 index 0000000..3f7ca4d --- /dev/null +++ b/tokipona/internal/bindata.go @@ -0,0 +1,233 @@ +// Code generated by go-bindata. DO NOT EDIT. +// sources: +// data/tokipona.json +package internal + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +func (fi bindataFileInfo) Name() string { + return fi.name +} +func (fi bindataFileInfo) Size() int64 { + return fi.size +} +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} +func (fi bindataFileInfo) IsDir() bool { + return false +} +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _tokiponaJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x59\xbb\x96\xdb\x36\x10\xed\xf3\x15\x36\x6b\x9d\x6c\xef\x26\x75\xbe\xc1\xc7\x05\x44\x8d\xc4\x11\x01\x0c\x8c\xc7\x72\x95\x9c\xfc\x7b\x8e\xb8\x1b\x1b\x17\x00\x41\xc6\xdd\x4a\x8b\x79\x60\x1e\x77\xee\x40\x5f\xff\x1e\xac\x32\x34\x7c\x19\xd4\x70\x1a\x6e\x5a\x42\x78\xfe\x3d\x3d\x3f\x78\x65\x8c\xf2\xc3\x97\xaf\x03\xdb\x48\xfe\x3e\x7c\xfb\xe7\xf4\xf3\xf8\x4c\x81\x87\xd3\x30\xaa\x48\x37\xf1\x8f\xe7\x57\x96\x8d\xd2\x99\x1a\x4f\x2e\xb2\x26\xd4\x65\x51\x8d\xce\xed\x5a\xc1\xb3\x46\x2e\xc3\x69\xb0\xc3\xa9\xe9\x81\xe6\xdc\x65\xad\x4b\x3b\xa7\x55\x1e\x44\xac\xcb\xcd\x25\x7b\x21\x7f\x44\x2a\x52\x26\x75\xe1\xeb\x95\x3c\xd9\xd8\x96\x3c\x0d\xa3\xd8\xfb\x70\x1a\x5e\x63\xa1\x25\x61\xb8\x02\x39\xe5\x55\x14\x9f\xe9\x96\xc2\x9d\x55\x15\x68\x59\xc8\x42\x84\x8d\x62\x8b\x32\xaf\xfc\x6e\xbc\xbe\x08\x1d\x70\xe0\x7c\xa7\x31\x7e\x32\xca\xcf\x65\x68\x02\x39\xd4\x66\xf7\xd5\x29\x7b\xd9\xb9\x10\x85\x94\x5f\x28\x4c\xe2\x7a\xf5\xc2\x77\xc9\x4e\xc7\x89\xed\x6d\x2b\x0d\x45\xfc\x79\xce\x93\x48\xaf\xac\x5b\xb5\xf6\x51\x67\xef\x45\xb7\x06\xf1\x95\x51\x8d\x06\x07\x44\xaa\xb2\x83\xd3\x36\xe4\x05\xc7\x36\xf0\xa5\xea\x87\x3a\x51\x77\x35\x33\x54\x9c\x8f\x8f\xad\xce\x58\x9d\x6c\xb4\xc7\x5d\xd9\x9d\xf6\x74\xe4\x83\xd8\x83\xe1\xbb\xd3\x7a\xf1\x4c\xdf\x28\x1a\x72\xfd\x20\xad\x65\xa9\xdd\x04\x2d\x79\xf0\x26\xf5\x5a\xc4\x62\xbd\x0b\x46\x70\x7e\x47\x88\xde\x3d\xae\x1c\xa6\x5e\x12\x9e\x2a\x4c\x9e\x86\x20\xa9\xac\x4b\xfb\x9e\xe9\xea\xda\x33\x4a\x8e\x62\x4a\x97\xf9\x23\x0f\xcd\xa8\xcd\x2a\xe4\x89\x74\x5a\xd5\xb0\x01\xe7\xa1\xbb\x9d\x84\xc0\xe7\x12\x40\x7f\x58\x2c\x6d\x91\x23\x94\x4f\xa1\x15\x5f\xe7\x8b\x46\x9e\x19\x90\xf4\xea\x13\xf7\x9d\x64\x0b\xc0\x1b\x1a\xa8\x8d\xe7\x0b\xd0\x92\x71\x6e\x57\x33\x48\xe5\xa5\x12\xbe\x27\x0e\xd3\xa3\xeb\x95\x58\x4c\xf1\x81\x79\x30\x27\x4d\x90\x5d\x5d\x02\xf0\x76\x66\x93\x4e\x2e\x65\xc2\x37\x2f\xa9\x82\xae\x96\x49\x18\x26\x9a\x43\xa4\x12\xc0\x5b\xd8\x5d\x76\x41\x0b\x6d\xd9\x7e\x1a\xc5\x46\x7a\x8b\x7d\xe4\xd6\xca\x11\x0c\x91\xd0\x98\x65\x6b\x99\xd5\x5e\x84\x1d\x14\x38\xeb\x44\x2f\x37\x4f\xe5\xa5\x6a\x4d\x4b\xde\x58\x13\xa9\x46\x47\x36\x23\xaf\xa1\x98\x46\x2d\xb1\xdb\xfd\x9a\x62\x91\xe3\xc3\x86\xf8\x40\xc8\xc3\x4e\xa8\xb1\xb7\x82\xa9\x78\xca\x86\x69\x7b\x07\xc4\x8a\xbe\x31\xe9\x50\x02\xaa\xd1\x29\x57\x53\x1b\x38\x2f\x77\xea\x67\xd2\xd3\x65\x27\x85\xd0\x71\x5a\x9e\xba\x0a\x91\x15\x6b\xaa\x19\xaa\xd3\x0c\xb9\xaf\x58\x82\x2d\x8f\x03\xe2\x04\x6a\xc1\x5a\xbb\x5e\x13\x10\xbe\x49\xfa\x6c\x14\xb0\x5e\xef\xb8\x65\xde\x47\x43\x77\xc2\xaa\x6d\x9e\x88\xaa\x6c\x5e\x25\x46\x2c\x75\xb1\xce\x50\x59\x9b\xf5\x50\x24\xa3\xea\xcb\x36\x4c\xe7\x86\xff\x7c\x59\x0e\x89\x94\xa5\x53\x59\x3f\x68\x5b\xe6\xbc\x66\xaf\x22\xad\xa9\x1c\x0b\x19\x68\xa8\x0b\xa9\xba\xfd\x4f\x1d\x0e\x6c\xc4\xc2\x48\x3e\xab\x72\x18\x35\x3d\x4d\x90\x1e\xf9\xbc\xbb\x1f\x19\xa0\xb5\x46\xb6\x88\x16\xca\x94\x6c\xa1\xaa\x82\x1f\x50\xd5\xe0\x2a\x06\x47\x8b\x51\xb6\x47\x1a\x73\x49\xab\x8c\x82\x79\x4b\x6f\xd1\xab\x7d\x87\x6d\xb1\x50\xd9\x64\xce\x7d\xd8\xb1\x0a\x08\xf1\xe8\xd5\x5f\x4d\x27\x2b\x07\x03\x40\x80\x51\xd6\xee\x18\x22\x9b\x1b\x3a\x27\xd3\xdd\x2b\xa0\xff\xe2\x54\xc2\x7a\x75\x71\x86\xbe\x59\xbf\xed\x69\x17\x00\x3c\x4d\x5d\x28\xcf\x13\xc1\xc6\x91\x57\x91\x4b\xa6\x1c\x56\x5c\x6d\xd4\x9d\x60\x1e\x1f\x5d\xbf\x44\x33\x42\x78\x69\x66\x73\x36\x8a\xc5\xe9\xfd\x12\x26\x7a\xa9\x69\x63\x5d\x32\xe2\x60\x7c\xff\xf7\x11\xc0\x3c\x3f\xef\xd4\x8c\x6f\x04\x17\x0a\xd1\x4b\xa3\x31\x7e\x4e\x81\x46\x58\x1c\xbe\x16\x18\x35\xf7\x6e\x5a\x4d\xac\xa7\x38\x14\xae\xaf\xa1\x0a\xcf\x5b\xa0\x86\xd5\x92\x5e\x1d\xcf\x95\xdf\xaa\x74\x37\x16\x23\x77\x80\x9d\xc8\xb5\xcf\x4e\x1c\x63\x01\x5c\x89\x1a\xac\xb9\x85\x35\x8e\x0d\xdd\xd5\x1e\x15\xac\xb0\x75\x13\x81\x1c\x43\x07\x52\x6b\x3f\x6b\x16\xa2\xe3\x32\x10\xd5\x30\x62\x1b\x68\xec\x6e\x34\x0e\xfb\x73\x7b\x49\x6f\x6c\x4f\x4e\x60\x57\x3f\xcb\x5b\xdf\x12\x66\xba\x39\xf2\x8a\xa7\x88\xf2\xc6\xf9\x2c\x8a\x32\xf3\x27\x27\x96\x5b\x14\xfe\xc7\xa8\xc8\xc5\x43\xb1\x0b\xb3\x61\xad\x7c\x2b\x4d\xd5\x55\x03\x41\x13\x2d\xca\x9b\x83\x59\x0a\x04\xcf\x26\x21\xf9\xab\x1a\xbb\xd0\x14\xc8\xe4\xc3\x6c\x99\xd4\xe1\x0b\xd2\x02\x94\x3b\x39\xf2\xbc\xb5\xd7\x81\x20\xdf\xd1\xcd\xb3\x5c\xba\x34\x2c\xe0\x9b\xd2\xc8\x7e\x3c\x42\x7b\x70\x94\x59\x6a\xbc\x99\xd4\x01\x64\xa8\x9b\x87\xa4\x43\x76\x1c\xb6\xb7\x97\xfe\xf3\x43\xe0\x48\xb8\x5e\x5d\xbc\x5a\x76\x39\x59\xc0\xa2\x5e\x38\x5c\xa4\x51\x19\x2d\x60\x0d\xb2\xec\x73\x59\xf3\x54\xd3\x7d\x67\x0b\x09\x2a\xf3\xcc\xb7\x8d\x98\x96\x28\x1a\x92\xcd\x33\xae\xf9\x36\xf5\x23\x84\x0b\x45\x54\xd5\xf3\x4c\x79\x1e\x8b\x71\x21\xda\xae\x63\x8c\x6a\x84\x19\x72\xa6\x51\x55\xef\x39\x1f\xeb\x95\x2d\xe4\x42\x7e\x25\xb1\xba\xc9\xb0\xaa\x97\xd8\x88\x1b\xb9\xa9\xc8\xc0\xcf\x65\xae\xf3\xe2\x15\xb1\x85\x34\x7f\x4f\xbc\xcf\xea\x23\x59\x07\xef\xaa\xdc\x27\x54\x11\x41\x37\x2a\x3d\xf7\x5f\x82\xb7\x99\x41\x14\x03\x8f\x92\x52\x45\xb9\xd5\x5b\x11\x40\x78\xd9\xf8\xdd\x22\x97\x48\x48\x95\x03\x55\x73\xa2\x47\x40\x52\xc4\xdc\xa4\xd6\xd6\x53\x3a\x99\x22\x52\x27\x15\x63\x73\xdb\x29\x92\xb1\xa8\xbd\xa7\xde\x65\xe2\x48\xfb\x57\x5e\xa0\x82\xc5\x6e\x88\x34\x1c\x28\x5f\x99\x2a\x48\x38\xb3\xef\x12\xb0\x05\x8b\xd9\xc9\xb2\xf5\x4b\x4f\x6d\x9d\x80\x0c\xa8\xa5\xdc\xc2\xb6\xfd\x66\x78\x4e\xb4\x54\x3e\x87\x7c\x00\x50\x9d\xa9\xdf\xf7\xb9\xdc\x3a\xc5\x9e\xfa\xe2\xc3\xbd\xd3\x00\x3b\xc6\xa4\x22\x97\x9b\xe5\xfa\x0f\xd0\xfe\xc7\xbe\xf6\xef\x89\xc2\x87\xaa\xff\xaf\xff\xf3\xbe\x7e\x7a\x1b\xb5\x32\xea\x97\x4d\x7c\xd9\x37\xf1\x2c\xd2\x5f\x53\x7e\x3a\xa2\xdc\xac\xb4\xe9\xa8\xf2\x6f\xbf\xfd\x1b\x00\x00\xff\xff\x2b\x91\x08\x5b\x5a\x1d\x00\x00") + +func tokiponaJsonBytes() ([]byte, error) { + return bindataRead( + _tokiponaJson, + "tokipona.json", + ) +} + +func tokiponaJson() (*asset, error) { + bytes, err := tokiponaJsonBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "tokipona.json", size: 7514, mode: os.FileMode(420), modTime: time.Unix(1549126899, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "tokipona.json": tokiponaJson, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} +var _bintree = &bintree{nil, map[string]*bintree{ + "tokipona.json": &bintree{tokiponaJson, map[string]*bintree{}}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} + diff --git a/tokipona/internal/data/tokipona.json b/tokipona/internal/data/tokipona.json new file mode 100644 index 0000000..8d96443 --- /dev/null +++ b/tokipona/internal/data/tokipona.json @@ -0,0 +1 @@ +[{"name":"a","gloss":"ah","grammar":["interj"]},{"name":"akesi","category":"animal","gloss":"reptile","grammar":["n"]},{"name":"ala","gloss":"no","grammar":["mod","n","interj"]},{"name":"ali","gloss":"all","grammar":["n","mod"]},{"name":"anpa","gloss":"under","grammar":["n","mod"]},{"name":"ante","gloss":"different","grammar":["n","mod","conj","vt"]},{"name":"anu","category":"separator","gloss":"or","grammar":["conj"]},{"name":"awen","gloss":"remain","grammar":["vi","vt","mod"]},{"name":"e","category":"separator","gloss":"object marker","grammar":["sep"]},{"name":"en","category":"separator","gloss":"and","grammar":["conj"]},{"name":"esun","gloss":"shop","grammar":["n"]},{"name":"ijo","gloss":"thing","grammar":["n","mod","vt"]},{"name":"ike","gloss":"evil","grammar":["mod","interj","n","vt","vi"]},{"name":"ilo","gloss":"tool","grammar":["n"]},{"name":"insa","gloss":"inside","grammar":["n","mod"]},{"name":"jaki","gloss":"dirty","grammar":["mod","n","vt","interj"]},{"name":"jan","category":"animal","gloss":"person","grammar":["n","mod","vt"]},{"name":"jelo","category":"color","gloss":"yellow","grammar":["mod"]},{"name":"jo","gloss":"have","grammar":["vt","n"]},{"name":"kala","category":"animal","gloss":"fish","grammar":["n"]},{"name":"kalama","gloss":"sound","grammar":["n","vi","vt"]},{"name":"kama","gloss":"come","grammar":["vi","n","mod","vt"]},{"name":"kasi","gloss":"plant","grammar":["n"]},{"name":"ken","gloss":"possible","grammar":["vi","n","vt"]},{"name":"kepeken","gloss":"use","grammar":["vt","prep"]},{"name":"kili","gloss":"fruit","grammar":["n"]},{"name":"kin","gloss":"also","grammar":["mod"]},{"name":"kiwen","gloss":"rock","grammar":["mod","n"]},{"name":"ko","gloss":"squishy","grammar":["n"]},{"name":"kon","gloss":"soul","grammar":["n","mod"]},{"name":"kule","gloss":"color","grammar":["n","mod","vt"]},{"name":"kulupu","gloss":"group","grammar":["n","mod"]},{"name":"kute","gloss":"listen","grammar":["vt","mod"]},{"name":"la","category":"separator","gloss":"in context","grammar":["sep"]},{"name":"lape","gloss":"rest","grammar":["n","vi","mod"]},{"name":"laso","category":"color","gloss":"blue/green","grammar":["mod"]},{"name":"lawa","gloss":"head","grammar":["n","mod","vt"]},{"name":"len","gloss":"cloth","grammar":["n"]},{"name":"lete","gloss":"cold","grammar":["n","mod","vt"]},{"name":"li","category":"separator","gloss":"is","grammar":["sep"]},{"name":"lili","gloss":"small","grammar":["mod","vt"]},{"name":"linja","gloss":"string","grammar":["n"]},{"name":"lipu","gloss":"paper","grammar":["n"]},{"name":"loje","category":"color","gloss":"red","grammar":["mod"]},{"name":"lon","gloss":"located","grammar":["prep","vi"]},{"name":"luka","gloss":"hand","grammar":["n"]},{"name":"lukin","gloss":"see","grammar":["vt","vi","mod"]},{"name":"lupa","gloss":"hole","grammar":["n"]},{"name":"ma","gloss":"land","grammar":["n"]},{"name":"mama","category":"animal","gloss":"parent","grammar":["n","mod"]},{"name":"mani","gloss":"money","grammar":["n"]},{"name":"meli","category":"animal","gloss":"female","grammar":["n","mod"]},{"name":"mi","gloss":"I/we","grammar":["n","mod"]},{"name":"mije","category":"animal","gloss":"male","grammar":["n","mod"]},{"name":"moku","gloss":"food","grammar":["n","vt"]},{"name":"moli","gloss":"death","grammar":["n","vi","vt","mod"]},{"name":"monsi","gloss":"back","grammar":["n","mod"]},{"name":"mu","gloss":"moo!","grammar":["interj"]},{"name":"mun","gloss":"moon","grammar":["n","mod"]},{"name":"musi","gloss":"play","grammar":["n","mod","vi","vt"]},{"name":"mute","gloss":"many","grammar":["mod","n","vt"]},{"name":"namako","gloss":"extra","grammar":["n","mod"]},{"name":"nanpa","gloss":"number","grammar":["n"]},{"name":"nasa","gloss":"crazy","grammar":["mod","vt"]},{"name":"nasin","gloss":"manner","grammar":["n"]},{"name":"nena","gloss":"bump","grammar":["n"]},{"name":"ni","gloss":"this","grammar":["mod"]},{"name":"nimi","gloss":"name","grammar":["n"]},{"name":"noka","gloss":"leg","grammar":["n"]},{"name":"o","gloss":"imperative","grammar":["sep","interj"]},{"name":"oko","gloss":"eye","grammar":["n"]},{"name":"olin","gloss":"love","grammar":["n","mod","vt"]},{"name":"ona","gloss":"he/she/it","grammar":["n","mod"]},{"name":"open","gloss":"open","grammar":["vt"]},{"name":"pakala","gloss":"destroy","grammar":["n","vt","vi","interj"]},{"name":"pali","gloss":"make","grammar":["n","mod","vt","vi"]},{"name":"palisa","gloss":"rod","grammar":["n"]},{"name":"pan","gloss":"grain","grammar":["n"]},{"name":"pana","gloss":"give","grammar":["vt","n"]},{"name":"pi","category":"separator","gloss":"of","grammar":["sep"]},{"name":"pilin","gloss":"feel","grammar":["n","vi","vt"]},{"name":"pimeja","category":"color","gloss":"black","grammar":["mod","n","vt"]},{"name":"pini","gloss":"end","grammar":["n","mod","vt"]},{"name":"pipi","category":"animal","gloss":"insect","grammar":["n"]},{"name":"poka","gloss":"side","grammar":["n","mod","prep"]},{"name":"poki","gloss":"box","grammar":["n"]},{"name":"pona","gloss":"good","grammar":["n","mod","interj","vt"]},{"name":"pu","gloss":"toki ponist","grammar":["n","mod","vi"]},{"name":"sama","gloss":"similar","grammar":["mod","prep"]},{"name":"seli","gloss":"warm","grammar":["n","mod","vt"]},{"name":"selo","gloss":"surface","grammar":["n"]},{"name":"seme","gloss":"what","grammar":["n","mod","vi"]},{"name":"sewi","gloss":"superior","grammar":["n","mod"]},{"name":"sijelo","gloss":"body","grammar":["n"]},{"name":"sike","gloss":"circle","grammar":["n","mod"]},{"name":"sin","gloss":"new","grammar":["mod","vt"]},{"name":"sina","gloss":"you","grammar":["n","mod"]},{"name":"sinpin","gloss":"front","grammar":["n"]},{"name":"sitelen","gloss":"draw","grammar":["n","vt"]},{"name":"sona","gloss":"wisdom","grammar":["n","vt","vi"]},{"name":"soweli","category":"animal","gloss":"mammal","grammar":["n"]},{"name":"suli","gloss":"big","grammar":["mod","vt","n"]},{"name":"suno","gloss":"light","grammar":["n"]},{"name":"supa","gloss":"table","grammar":["n"]},{"name":"suwi","gloss":"sweet","grammar":["n","mod","vt"]},{"name":"tan","gloss":"because","grammar":["prep","n"]},{"name":"taso","gloss":"only","grammar":["mod","conj"]},{"name":"tawa","gloss":"move","grammar":["prep","vi","n","mod","vt"]},{"name":"telo","gloss":"liquid","grammar":["n","vt"]},{"name":"tenpo","gloss":"time","grammar":["n"]},{"name":"toki","gloss":"talking","grammar":["n","mod","vt","vi","interj"]},{"name":"tomo","gloss":"house","grammar":["n","mod"]},{"name":"tu","gloss":"two","grammar":["mod","n"]},{"name":"unpa","gloss":"sex","grammar":["n","mod","vt","vi"]},{"name":"uta","gloss":"mouth","grammar":["n","mod"]},{"name":"utala","gloss":"attack","grammar":["n","vt"]},{"name":"walo","category":"color","gloss":"white","grammar":["mod","n"]},{"name":"wan","gloss":"one","grammar":["mod","n","vt"]},{"name":"waso","category":"animal","gloss":"bird","grammar":["n"]},{"name":"wawa","gloss":"power","grammar":["n","mod","vt"]},{"name":"weka","gloss":"away","grammar":["mod","n","vt"]},{"name":"wile","gloss":"need","grammar":["vt","n","mod"]},{"name":".","category":"separator","gloss":"period","type":"punctuation","grammar":["punct"]},{"name":"?","category":"separator","gloss":"question","type":"punctuation","grammar":["punct"]},{"name":"!","category":"separator","gloss":"exclamation","type":"punctuation","grammar":["punct"]},{"name":":","category":"separator","gloss":"colon","type":"punctuation","grammar":["punct"]},{"name":",","category":"separator","gloss":"comma","type":"punctuation","grammar":["punct"]}] diff --git a/tokipona/internal/generate.go b/tokipona/internal/generate.go new file mode 100644 index 0000000..8b57a5b --- /dev/null +++ b/tokipona/internal/generate.go @@ -0,0 +1,3 @@ +package internal + +//go:generate go-bindata -prefix data/ -pkg internal data diff --git a/tokipona/nimi.go b/tokipona/nimi.go new file mode 100644 index 0000000..55226c6 --- /dev/null +++ b/tokipona/nimi.go @@ -0,0 +1,31 @@ +package tokipona + +import ( + "bytes" + "encoding/json" + + "github.com/Xe/x/tokipona/internal" +) + +// Word is a single word in the Toki Pona dictionary. +type Word struct { + Name string `json:"name"` + Gloss string `json:"gloss"` + Grammar []string `json:"grammar"` + Category string `json:"category,omitempty"` + Type string `json:"type,omitempty"` +} + +// LoadWords loads the embedded Toki Pona dictionary. +func LoadWords() ([]Word, error) { + data, err := internal.Asset("tokipona.json") + fin := bytes.NewBuffer(data) + + var result []Word + err = json.NewDecoder(fin).Decode(&result) + if err != nil { + return nil, err + } + + return result, nil +} diff --git a/tokipona/nimi_test.go b/tokipona/nimi_test.go new file mode 100644 index 0000000..c10b512 --- /dev/null +++ b/tokipona/nimi_test.go @@ -0,0 +1,10 @@ +package tokipona + +import "testing" + +func TestLoadWords(t *testing.T) { + _, err := LoadWords() + if err != nil { + t.Fatal(err) + } +} @@ -3,6 +3,7 @@ package main import ( + _ "github.com/go-bindata/go-bindata/go-bindata" _ "github.com/robertkrimen/godocdown/godocdown" ) diff --git a/tools_install.go b/tools_install.go index 636b5c5..98ddcd4 100644 --- a/tools_install.go +++ b/tools_install.go @@ -16,7 +16,7 @@ func main() { env := append(os.Environ(), []string{"GO111MODULE=on"}...) - for _, tool := range []string{"github.com/robertkrimen/godocdown/godocdown"} { + for _, tool := range []string{"github.com/robertkrimen/godocdown/godocdown", "github.com/go-bindata/go-bindata/go-bindata"} { yeet.ShouldWork(ctx, env, yeet.WD, "go", "install", tool) } } |
