Skip to content

Commit

Permalink
archive name change
Browse files Browse the repository at this point in the history
  • Loading branch information
phoepsilonix committed Oct 21, 2024
1 parent 47e0a95 commit 7670773
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
run: |
binary_name="dict-to-mozc"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
dirname="$binary_name-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.os }}" == "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
Expand Down
227 changes: 227 additions & 0 deletions Cargo.lock

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

49 changes: 42 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,53 @@
[package]
name = "dict-to-mozc"
[workspace]
members = [
"crates/*",
]
resolver = "2"

[workspace.package]
version = "0.3.1"
authors = ["Masato TOYOSHIMA", "phoepsilonix <[email protected]>"]
edition = "2021"
rust-version = "1.82"
homepage = "https://github.com/phoepsilonix/dict-to-mozc"
documentation = "https://github.com/phoepsilonix/dict-to-mozc"
repository = "https://github.com/phoepsilonix/dict-to-mozc"
license = "MIT"
authors = ["Masato TOYOSHIMA", "phoepsilonix <[email protected]>"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
[workspace.dependencies]
lib-dict-to-mozc = { path = "./crates/dict-to-mozc" }
argh = "0.1.12"
csv = "1.3.0"
kanaria = { git = "https://github.com/phoepsilonix/kanaria.git", rev = "18ca812a1fe8c7f30a753aecc2681db1f18031e8", version = "0.2.1" }
lazy-regex = "3.1.0"
regex = "1.10.3"

[profile.release]
strip = "symbols"
strip = true
lto = "fat"
overflow-checks = true
codegen-units = 1

[workspace.metadata.release]
allow-branch = ["main"]
shared-version = true
tag = false

[package]
name = "dict-to-mozc"
edition.workspace = true
authors.workspace = true
rust-version.workspace = true
repository.workspace = true
license.workspace = true
version.workspace = true

[dependencies]
lib-dict-to-mozc = { workspace = true }

[package.metadata.release]
tag = true
tag-prefix =""

[[bin]]
name = "dict-to-mozc"
19 changes: 19 additions & 0 deletions crates/dict-to-mozc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "lib-dict-to-mozc"
edition.workspace = true
version.workspace = true
authors.workspace = true
rust-version.workspace = true
repository.workspace = true
license.workspace = true

[dependencies]
argh = { workspace = true }
csv = { workspace = true }
kanaria = { workspace = true }
lazy-regex = { workspace = true }
regex = { workspace = true }

[package.metadata.release]
tag = true
tag-prefix =""
8 changes: 4 additions & 4 deletions src/main.rs → crates/dict-to-mozc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ mod utils {
use super::*;

// カタカナから読みを平仮名へ
pub fn convert_to_hiragana(text: &str) -> String {
pub(crate) fn convert_to_hiragana(text: &str) -> String {
let target: Vec<char> = text.chars().collect();
let mut pronunciation: String = UCSStr::convert(&target, ConvertType::Hiragana, ConvertTarget::ALL).iter().collect();
pronunciation = pronunciation.replace("ゐ", "い").replace("ゑ", "え");
pronunciation
}

// Unicode Escapeの記述が含まれる場合、それを変換する。
pub fn unicode_escape_to_char(text: &str) -> String {
pub(crate) fn unicode_escape_to_char(text: &str) -> String {
regex_replace_all!(r#"\\u([0-9a-fA-F]{4})"#, text, |_, num: &str| {
let num: u32 = u32::from_str_radix(num, 16).unwrap();
std::char::from_u32(num).unwrap().to_string()
}).to_string()
}

// コスト計算
pub fn adjust_cost(cost: i32) -> i32 {
pub(crate) fn adjust_cost(cost: i32) -> i32 {
if cost < MIN_COST {
8000
} else if cost > MAX_COST {
Expand Down Expand Up @@ -1080,7 +1080,7 @@ fn id_expr(clsexpr: &str, _id_def: &mut IdDef, class_map: &mut HashMap<String, i
}
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Args = argh::from_env();
let config = args.into_config()?;

Expand Down
5 changes: 5 additions & 0 deletions src/bin/dict-to-mozc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use lib_dict_to_mozc::main as dict_to_mozc_main;

fn main() -> Result<(), Box<dyn std::error::Error>> {
dict_to_mozc_main()
}

0 comments on commit 7670773

Please sign in to comment.