Skip to content

Instantly share code, notes, and snippets.

@flatfisher
Last active December 9, 2018 14:06
Show Gist options
  • Save flatfisher/0b04dcaa339144639d1209f23d53e84f to your computer and use it in GitHub Desktop.
Save flatfisher/0b04dcaa339144639d1209f23d53e84f to your computer and use it in GitHub Desktop.
Slackでよく使われる単語をまとめてみた ref: https://qiita.com/flatfisher/items/4000f54e15e471f83def
$ brew insatll mecab mecab-ipadic
$ which mecab-config
/usr/local/bin/mecab-config //こんな感じになればOK
// 環境変数を作成
$ export CGO_LDFLAGS="`mecab-config --libs`"
$ export CGO_CFLAGS="-I`mecab-config --inc-dir`"
$ [こちら 結婚式 土曜日 日曜日 結婚式 チャンネル]
$ [{お答え 1} {大丈夫 10} {どちら 2} {どっち 1} {タイミング 3} {マグロ 2}]
$ [{大丈夫 10} {タイミング 3} {どちら 2} {マグロ 2} {お答え 1} {どっち 1}]
チャンネル => 92
お願い => 58
イベント => 57
こちら => 24
オンライン => 22
申し込み => 16
みたい => 16
ページ => 14
スピーカー => 13
大丈夫 => 10
コード => 9
みんな => 9
レポート => 7
カレー => 7
フォーム => 7
スライド => 7
セッション => 7
みなさん => 7
トピック => 6
package main
import (
"log"
"sort"
)
type Buzzword struct {
Word string
Count int
}
type Buzzwords []Buzzword
func (p Buzzwords) Len() int {
return len(p)
}
func (p Buzzwords) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}
type ByCount struct {
Buzzwords
}
func (b ByCount) Less(i, j int) bool {
return b.Buzzwords[i].Count > b.Buzzwords[j].Count
}
func main() {
var people Buzzwords = []Buzzword{
{"お答え", 1},
{"大丈夫", 10},
{"どちら", 2},
{"どっち", 1},
{"タイミング", 3},
{"マグロ", 2},
}
sort.Sort(ByCount{people})
log.Println(people)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment