Skip to content

Commit

Permalink
Merge pull request #2 from ikawaha/develop
Browse files Browse the repository at this point in the history
kagome のインターフェース変更への対応
  • Loading branch information
kurehajime committed Sep 28, 2015
2 parents 4d41654 + 8ee2b67 commit 8522f95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
18 changes: 6 additions & 12 deletions dajarep.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
package main

import (
"github.com/ikawaha/kagome"
"math"
"regexp"
"strings"
)

var (
token *kagome.Tokenizer
"github.com/ikawaha/kagome/tokenizer"
)

func init() {
tokenizer.SysDic()
}

//単語
type word struct {
str string
Expand Down Expand Up @@ -87,7 +88,7 @@ func fixSentence(text string) string {
//テキストからsentenceオブジェクトを作る。
func getSentences(text string) []sentence {
var sentences []sentence
t:= getTokenizer()
t := tokenizer.New()

text = strings.Replace(text, "。", "\n", -1)
text = strings.Replace(text, ".", "\n", -1)
Expand Down Expand Up @@ -122,10 +123,3 @@ func getSentences(text string) []sentence {
}
return sentences
}
//Tokenizerを取得
func getTokenizer() *kagome.Tokenizer{
if token == nil {
token = kagome.NewTokenizer()
}
return token
}
3 changes: 0 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ func main() {
os.Exit(1)
}

//あらかじめTokenizerを読み込んで時短
_ = getTokenizer()

if interactive == false {
text, err := transEnc(text, encode)
if err != nil {
Expand Down

0 comments on commit 8522f95

Please sign in to comment.