Skip to content

Commit

Permalink
update program
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed May 27, 2024
1 parent 00dc443 commit 8c1582d
Show file tree
Hide file tree
Showing 33 changed files with 746 additions and 118 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Release

on: push

jobs:
build-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.0
id: go

- name: Install Packages
run: |
sudo apt-get install libgtk-3-dev -y
- name: Build for Linux
run: |
# Create build directory
build_dir="rikaitan-import-linux"
mkdir -p "$build_dir"
# Build
go build -o "$build_dir" ./rikaitan
go build -o "$build_dir" ./rikaitan-gtk
# Zip the build directory
zip -r "$build_dir.zip" "$build_dir"
- name: Upload Release Artifacts
uses: actions/upload-artifact@v3
with:
path: rikaitan-import-linux.zip
name: rikaitan-import-linux

- name: Release on Tag Creation
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
rikaitan-import-linux.zip
draft: true
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Yomichan Import

*Note: this project is no longer maintained. Please see [this
post](https://foosoft.net/posts/sunsetting-the-yomichan-project/) for more information.*

Yomichan Import allows users of the [Yomichan](https://foosoft.net/projects/yomichan) extension to import custom
# Rikaitan Import

> :wave: **This project is a community fork of Yomichan-import** which was is no longer maintained.
>
> The primary goal is to **keep the project alive by providing long-term support and fixing bugs**. (Feature improvements are considered secondary.)
>
> Since this is a distributed effort,
> we highly welcome new contributors!
> Feel free to browse the issue tracker,
> and you can find us on [DJT Matrix](https://tatsumoto.neocities.org/blog/join-our-community)
> at [#tools](https://matrix.to/#/#tools:midov.pl).
Rikaitan Import allows users of the [Rikaitan](https://github.com/Ajatt-Tools/rikaitan) extension to import custom
dictionary files. It currently supports the following formats:

* [JMdict XML](http://www.edrdg.org/jmdict/edict_doc.html)
Expand All @@ -19,23 +26,21 @@ dictionary files. It currently supports the following formats:
* [Kojien](https://ja.wikipedia.org/wiki/%E5%BA%83%E8%BE%9E%E8%8B%91) (広辞苑第六版 • 付属資料)
* [Gakken](https://ja.wikipedia.org/wiki/%E5%AD%A6%E7%A0%94%E3%83%9B%E3%83%BC%E3%83%AB%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0%E3%82%B9) (学研国語大辞典 • 古語辞典 • 故事ことわざ辞典 • 学研漢和大字典)

Yomichan Import is being expanded to support other EPWING dictionaries based on user demand. This is a mostly
Rikaitan Import is being expanded to support other EPWING dictionaries based on user demand. This is a mostly
non-technical (although laborious) process that requires writing regular expressions and creating font tables; volunteer
contributions are welcome.

![](img/import.png)

## Installation and Usage

Follow the steps outlined below to import your custom dictionary into Yomichan:
Follow the steps outlined below to import your custom dictionary into Rikaitan:

1. Download a pre-built binary for Linux, Mac OS X or Windows from the [project
page](https://github.com/FooSoft/yomichan-import/releases).
2. Launch the `yomichan-gtk` executable after extracting the entire archive (or `yomichan` from the command line).
1. Download a pre-built binary for Linux, Mac OS X or Windows from the
[project page](https://github.com/Ajatt-Tools/rikaitan-import/releases).
2. Launch the `rikaitan-gtk` executable after extracting the entire archive (or `rikaitan` from the command line).
3. Specify the source path of the dictionary you wish to convert.
4. Specify the target path of the dictionary ZIP archive that you wish to create.
5. Press the button labeled *Import dictionary...* and wait for processing to complete.
6. On the Yomichan options page, browse to the dictionary ZIP archive file you created.
6. On the Rikaitan options page, browse to the dictionary ZIP archive file you created.
7. Wait for the import progress to complete before closing the options page.

**Notice**: When converting EPWING dictionaries on Windows, it is important that the dictionary path you provide does
Expand Down
6 changes: 3 additions & 3 deletions common.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yomichan
package rikaitan

import (
"archive/zip"
Expand Down Expand Up @@ -158,10 +158,10 @@ func (index *dbIndex) setDefaults() {
index.Format = 3
}
if index.Author == "" {
index.Author = "yomichan-import"
index.Author = "rikaitan-import"
}
if index.Url == "" {
index.Url = "https://github.com/FooSoft/yomichan-import"
index.Url = "https://github.com/Ajatt-Tools/rikaitan-import"
}
}

Expand Down
11 changes: 8 additions & 3 deletions daijirin.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package yomichan
package rikaitan

import (
"regexp"
"strings"

zig "foosoft.net/projects/zero-epwing-go"
zig "github.com/Ajatt-Tools/zero-epwing-go"
)

type daijirinExtractor struct {
Expand Down Expand Up @@ -113,7 +113,7 @@ func (e *daijirinExtractor) exportRules(term *dbTerm, tags []string) {
}

func (*daijirinExtractor) getRevision() string {
return "daijirin2"
return "daijirin3"
}

func (*daijirinExtractor) getFontNarrow() map[int]string {
Expand Down Expand Up @@ -947,6 +947,7 @@ func (*daijirinExtractor) getFontWide() map[int]string {
42615: "蘞",
42616: "莕",
42617: "蒅",
42618: "𫈇",
42619: "芿",
42620: "悆",
42621: "忞",
Expand Down Expand Up @@ -1034,6 +1035,7 @@ func (*daijirinExtractor) getFontWide() map[int]string {
42867: "瞟",
42868: "瞍",
42869: "眶",
42870: "𥉁",
42871: "畾",
42872: "矪",
42873: "矬",
Expand Down Expand Up @@ -1302,6 +1304,7 @@ func (*daijirinExtractor) getFontWide() map[int]string {
43623: "鐖",
43624: "鑯",
43625: "闋",
43626: "𨵦",
43627: "鏱",
43628: "鈼",
43629: "𨫤",
Expand Down Expand Up @@ -1641,6 +1644,7 @@ func (*daijirinExtractor) getFontWide() map[int]string {
44611: "衤",
44612: "飠",
44613: "𩙿",
44618: "ϒ", /* ♈︎ is also similar (for 雁点)*/
44619: "𤣥", /* FIXME: 欠画 */
44621: "⺩",
44622: "⺏", /* FIXME: 尢, this but with with leg stretched as in 尩 */
Expand Down Expand Up @@ -1709,6 +1713,7 @@ func (*daijirinExtractor) getFontWide() map[int]string {
45125: "♥",
45126: "𝄐", /* FIXME: フェルマータ */
45127: "℥",
45129: "乀",
45130: "♩",
45131: "𝄉", /* FIXME: ダルセーニョ */
45132: "𝄪", /* FIXME: 重嬰記号 */
Expand Down
6 changes: 3 additions & 3 deletions daijisen.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package yomichan
package rikaitan

import (
"regexp"
"strings"

zig "foosoft.net/projects/zero-epwing-go"
zig "github.com/Ajatt-Tools/zero-epwing-go"
)

type daijisenExtractor struct {
Expand Down Expand Up @@ -1246,7 +1246,7 @@ func (*daijisenExtractor) getFontWide() map[int]string {
0xbc70: "异",
0xbc72: "麀",
0xbc73: "𥫱",
0xbc74: "",
0xbc74: "𦬸",
0xbc75: "𧐐",
0xbd5c: "慒",
0xbd5d: "𪙉",
Expand Down
4 changes: 2 additions & 2 deletions epwing.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package yomichan
package rikaitan

import (
"fmt"
"regexp"
"strconv"
"strings"

zig "foosoft.net/projects/zero-epwing-go"
zig "github.com/Ajatt-Tools/zero-epwing-go"
)

type epwingExtractor interface {
Expand Down
2 changes: 1 addition & 1 deletion frequency.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yomichan
package rikaitan

import (
"bufio"
Expand Down
4 changes: 2 additions & 2 deletions gakken.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package yomichan
package rikaitan

import (
"regexp"
"strings"

zig "foosoft.net/projects/zero-epwing-go"
zig "github.com/Ajatt-Tools/zero-epwing-go"
)

type gakkenExtractor struct {
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module foosoft.net/projects/yomichan-import
module github.com/Ajatt-Tools/rikaitan-import

go 1.18

require (
foosoft.net/projects/jmdict v0.0.0-20220704034116-2e3194aa18d5
foosoft.net/projects/zero-epwing-go v0.0.0-20220704035039-bc008453615d
github.com/andlabs/ui v0.0.0-20200610043537-70a69d6ae31e
github.com/mattn/go-sqlite3 v1.14.14
github.com/Ajatt-Tools/jmdict-go v0.0.0-20230321060422-fa8f5d54f364
github.com/Ajatt-Tools/zero-epwing-go v0.0.0-20230320143722-0af367763d6c
golang.org/x/exp v0.0.0-20221207211629-99ab8fa1c11f
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
foosoft.net/projects/jmdict v0.0.0-20220704034116-2e3194aa18d5 h1:OSA3YcWT9bUg4ut4bTuUtrW1wMg9wJen1VUBbLKqyTQ=
foosoft.net/projects/jmdict v0.0.0-20220704034116-2e3194aa18d5/go.mod h1:ZrjLCcE7ZrND28ZOSGYMd78tL+Dffiv2g+NjOMKgnew=
foosoft.net/projects/zero-epwing-go v0.0.0-20220704035039-bc008453615d h1:GDyxif1+wM5gml2yTb9zy+9KE9NcTrtFxplpQCt/ksQ=
foosoft.net/projects/zero-epwing-go v0.0.0-20220704035039-bc008453615d/go.mod h1:ux61lX0Tn9Pd3xz/48Obt2I/A5LPWoNtV2x6rZpWuPM=
github.com/andlabs/ui v0.0.0-20200610043537-70a69d6ae31e h1:wSQCJiig/QkoUnpvelSPbLiZNWvh2yMqQTQvIQqSUkU=
github.com/andlabs/ui v0.0.0-20200610043537-70a69d6ae31e/go.mod h1:5G2EjwzgZUPnnReoKvPWVneT8APYbyKkihDVAHUi0II=
github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw=
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/Ajatt-Tools/jmdict-go v0.0.0-20230321060422-fa8f5d54f364 h1:JSSM5osTN5FCoj7uErWoMVY+IbDh+OG0aRJnKsxgngc=
github.com/Ajatt-Tools/jmdict-go v0.0.0-20230321060422-fa8f5d54f364/go.mod h1:M9O+lJXOwrOqpN4VUv8Qkn1gsZ/SZaSAiF7nj0m1NZk=
github.com/Ajatt-Tools/zero-epwing-go v0.0.0-20230320143722-0af367763d6c h1:32GHNc47Ff2l+zkixRhK2Q4GqosXI4D5w0PjDNMAo68=
github.com/Ajatt-Tools/zero-epwing-go v0.0.0-20230320143722-0af367763d6c/go.mod h1:O6+Fn5z4McOG0I8tS1X2HqYx9n0KPW1KQccYyoXzSR4=
golang.org/x/exp v0.0.0-20221207211629-99ab8fa1c11f h1:90Jq/vvGVDsqj8QqCynjFw9MCerDguSMODLYII416Y8=
golang.org/x/exp v0.0.0-20221207211629-99ab8fa1c11f/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
Expand Down
12 changes: 9 additions & 3 deletions jmdict.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yomichan
package rikaitan

import (
"errors"
Expand All @@ -7,7 +7,7 @@ import (
"strconv"
"strings"

"foosoft.net/projects/jmdict"
jmdict "github.com/Ajatt-Tools/jmdict-go"
"golang.org/x/exp/slices"
)

Expand Down Expand Up @@ -64,7 +64,13 @@ func doDisplaySenseNumberTag(headword headword, entry jmdict.JmdictEntry, meta j

func jmdictPublicationDate(dictionary jmdict.Jmdict) string {
unknownDate := "unknown"
idx := len(dictionary.Entries) - 1
idx := -1
for i, entry := range dictionary.Entries {
if entry.Sequence == 9999999 {
idx = i
break
}
}
if len(dictionary.Entries) == 0 {
return unknownDate
} else if len(dictionary.Entries[idx].Sense) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion jmdict_constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yomichan
package rikaitan

type LangCode struct {
language string
Expand Down
4 changes: 2 additions & 2 deletions jmdict_forms.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package yomichan
package rikaitan

import (
"os"
"strings"

"foosoft.net/projects/jmdict"
jmdict "github.com/Ajatt-Tools/jmdict-go"
"golang.org/x/exp/slices"
)

Expand Down
4 changes: 2 additions & 2 deletions jmdict_glossary.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package yomichan
package rikaitan

import (
"fmt"
"strconv"

"foosoft.net/projects/jmdict"
jmdict "github.com/Ajatt-Tools/jmdict-go"
)

func glossaryContainsLanguage(glossary []jmdict.JmdictGlossary, language string) bool {
Expand Down
6 changes: 3 additions & 3 deletions jmdict_headword.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package yomichan
package rikaitan

import (
"fmt"
"hash/fnv"
"regexp"
"strconv"

"foosoft.net/projects/jmdict"
jmdict "github.com/Ajatt-Tools/jmdict-go"
"golang.org/x/exp/slices"
)

Expand Down Expand Up @@ -235,7 +235,7 @@ func extractHeadwords(entry jmdict.JmdictEntry) []headword {
if allKanjiAreIrregular {
// Adding the reading-only terms before kanji+reading
// terms here for the sake of the Index property,
// which affects the yomichan term ranking.
// which affects the rikaitan term ranking.
for _, reading := range entry.Readings {
h := newHeadword(nil, &reading)
h.Index = len(headwords)
Expand Down
4 changes: 2 additions & 2 deletions jmdict_metadata.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package yomichan
package rikaitan

import (
"strings"

"foosoft.net/projects/jmdict"
jmdict "github.com/Ajatt-Tools/jmdict-go"
"golang.org/x/exp/slices"
)

Expand Down
2 changes: 1 addition & 1 deletion jmdict_references.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yomichan
package rikaitan

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion jmdict_tags.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yomichan
package rikaitan

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions jmnedict.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package yomichan
package rikaitan

import (
"os"
"regexp"

"foosoft.net/projects/jmdict"
jmdict "github.com/Ajatt-Tools/jmdict-go"
)

func jmnedictPublicationDate(dictionary jmdict.Jmnedict) string {
Expand Down
Loading

0 comments on commit 8c1582d

Please sign in to comment.