Last active
February 4, 2019 09:13
-
-
Save kariyayo/21b2ceb0c6a91afb1c47a1e041397122 to your computer and use it in GitHub Desktop.
すもも も もも も もも の うち
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
mecab "github.com/shogo82148/go-mecab" | |
) | |
func main() { | |
tagger, err := mecab.New(map[string]string{"output-format-type": "wakati"}) | |
if err != nil { | |
panic(err) | |
} | |
defer tagger.Destroy() | |
// avoid GC problem with MeCab 0.996 (see https://github.com/taku910/mecab/pull/24) | |
tagger.Parse("") | |
node, err := tagger.ParseToNode("すもももももももものうち") | |
if err != nil { | |
panic(err) | |
} | |
for ; !node.IsZero(); node = node.Next() { | |
fmt.Printf("%s\t%s\n", node.Surface(), node.Feature()) | |
} | |
} |
Author
kariyayo
commented
Feb 3, 2019
$ go run word_frequency.go
BOS/EOS,*,*,*,*,*,*,*,*
すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
の 助詞,連体化,*,*,*,*,の,ノ,ノ
うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
BOS/EOS,*,*,*,*,*,*,*,*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment