Skip to content

Commit

Permalink
Fix to stabilize the serialization (#116)
Browse files Browse the repository at this point in the history
* Fix to stabilize the serialization of the index table and the unk index table
* Rebuild dictionaries
* Drop support of go 1.6 and 1.7
  • Loading branch information
ikawaha committed Jan 5, 2018
1 parent 9d92079 commit a01f016
Show file tree
Hide file tree
Showing 32 changed files with 328 additions and 179 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: go

go:
- 1.6.4
- 1.7.6
- 1.8.3
- 1.9
- tip
Expand Down
13 changes: 7 additions & 6 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified _sample/ipa.dic
Binary file not shown.
Binary file modified _sample/uni.dic
Binary file not shown.
31 changes: 2 additions & 29 deletions cmd/_dictool/ipa/mkdic.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ type IpaDic struct {
InvokeList []bool
GroupList []bool

UnkMorphs []dic.Morph
UnkIndex map[int32]int32
UnkIndexDup map[int32]int32
UnkContents [][]string
dic.UnkDic
}

type ipaDicPath struct {
Expand Down Expand Up @@ -223,31 +220,7 @@ func saveIpaDic(d *IpaDic, base string, archive bool) error {
if err != nil {
return err
}

var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
if err := enc.Encode(d.UnkMorphs); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
return err
}
if err := enc.Encode(d.UnkIndex); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
return err
}
if err := enc.Encode(d.UnkIndexDup); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
return err
}
if err := enc.Encode(d.UnkContents); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
if _, err := d.UnkDic.WriteTo(out); err != nil {
return err
}
return nil
Expand Down
31 changes: 2 additions & 29 deletions cmd/_dictool/uni/mkdic.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ type UniDic struct {
InvokeList []bool
GroupList []bool

UnkMorphs []dic.Morph
UnkIndex map[int32]int32
UnkIndexDup map[int32]int32
UnkContents [][]string
dic.UnkDic
}

type uniDicPath struct {
Expand Down Expand Up @@ -219,31 +216,7 @@ func saveUniDic(d *UniDic, base string, archive bool) error {
if err != nil {
return err
}

var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
if err := enc.Encode(d.UnkMorphs); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
return err
}
if err := enc.Encode(d.UnkIndex); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
return err
}
if err := enc.Encode(d.UnkIndexDup); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
return err
}
if err := enc.Encode(d.UnkContents); err != nil {
return err
}
if _, err := buf.WriteTo(out); err != nil {
if _, err := d.UnkDic.WriteTo(out); err != nil {
return err
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion internal/dic/data/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions internal/dic/data/bindata00.go

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions internal/dic/data/bindata01.go

Large diffs are not rendered by default.

Loading

0 comments on commit a01f016

Please sign in to comment.