Skip to content

Commit

Permalink
Merge pull request #240 from mh-northlander/fetch-latest-dictionary
Browse files Browse the repository at this point in the history
`fetch_dictionary.sh` now fetches latest dictionary. Github workflows use it with explicit dictionary versions.
  • Loading branch information
mh-northlander authored Feb 27, 2024
2 parents 4be2781 + 0fa9580 commit 533c3ac
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-python-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v3

- name: Download dictionary
run: bash fetch_dictionary.sh
run: bash fetch_dictionary.sh "20220519" "core"

- uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-upload-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- uses: actions/checkout@v3

- name: Download dictionary
run: bash fetch_dictionary.sh
run: bash fetch_dictionary.sh "20220519" "core"

- uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Download dictionary
run: bash fetch_dictionary.sh
run: bash fetch_dictionary.sh "20220519" "core"

- uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-noncached.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Download dictionary
run: bash fetch_dictionary.sh
run: bash fetch_dictionary.sh "20220519" "core"
- name: Run tests (Debug)
run: cargo test --verbose
- name: Run tests (Release)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Download dictionary
run: bash fetch_dictionary.sh
run: bash fetch_dictionary.sh "20220519" "core"

- uses: actions/cache@v3
with:
Expand Down
15 changes: 8 additions & 7 deletions fetch_dictionary.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/bin/sh

DICT_NAME_BASE="sudachi-dictionary-20220519"
DICT_TYPE="core"
DICT_NAME="${DICT_NAME_BASE}-${DICT_TYPE}"
DICT_VERSION=${1:-"latest"}
DICT_TYPE=${2:-"core"}

DICT_NAME="sudachi-dictionary-${DICT_VERSION}-${DICT_TYPE}"

echo "Downloading a dictionary file \`${DICT_NAME}\` ..."
echo

curl -L \
http://sudachi.s3-website-ap-northeast-1.amazonaws.com/sudachidict/${DICT_NAME}.zip \
https://d2ej7fkh96fzlu.cloudfront.net/sudachidict/${DICT_NAME}.zip \
> ${DICT_NAME}.zip

unzip ${DICT_NAME}.zip
unzip -j ${DICT_NAME}.zip -d ${DICT_NAME}

mv ${DICT_NAME_BASE}/system_${DICT_TYPE}.dic resources/system.dic
mv ${DICT_NAME}/system_${DICT_TYPE}.dic resources/system.dic

rm -rf ${DICT_NAME}.zip ${DICT_NAME_BASE}
rm -rf ${DICT_NAME}.zip ${DICT_NAME}

echo
echo "Placed a dictionary file to \`resources/system.dic\` ."

0 comments on commit 533c3ac

Please sign in to comment.