From 812c3cc41a3b43c12eb21dae4679e763c72a9e2e Mon Sep 17 00:00:00 2001 From: Minoru Osuka Date: Fri, 6 Dec 2024 13:08:19 +0900 Subject: [PATCH 1/2] Fix package name --- Cargo.lock | 2 +- Cargo.toml | 7 ++-- Makefile | 2 -- README.md | 2 +- examples/tokenize.py | 2 +- examples/tokenize_with_decompose.py | 2 +- examples/tokenize_with_filters.py | 2 +- examples/tokenize_with_userdict.py | 2 +- pyproject.toml | 4 +-- src/lib.rs | 52 +---------------------------- tests/test_tokenize_ipadic.py | 2 +- 11 files changed, 14 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4bcf1c..6aa7228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -916,7 +916,7 @@ dependencies = [ [[package]] name = "lindera-py" -version = "0.38.2" +version = "0.38.3" dependencies = [ "lindera", "openssl", diff --git a/Cargo.toml b/Cargo.toml index dcd4611..7919451 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lindera-py" -version = "0.38.2" +version = "0.38.3" edition = "2021" description = "Python binding for Lindera." documentation = "https://docs.rs/lindera-py" @@ -12,8 +12,9 @@ categories = ["text-processing"] license = "MIT" [lib] -name = "lindera" -crate-type = ["cdylib"] +name = "lindera_py" +path = "src/lib.rs" +crate-type = ["cdylib", "rlib"] [features] default = [] # No directories included diff --git a/Makefile b/Makefile index 6dfc893..11854a9 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,6 @@ lint: poetry run isort --check-only --diff ./examples ./tests poetry run black --check ./examples ./tests poetry run flake8 ./examples ./tests - -typecheck: poetry run mypy ./examples ./tests develop: diff --git a/README.md b/README.md index f800952..d1b7e82 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ This command takes a long time because it builds a library that includes all the ## Example code ```python -from lindera import Segmenter, Tokenizer, load_dictionary +from lindera_py import Segmenter, Tokenizer, load_dictionary def main(): diff --git a/examples/tokenize.py b/examples/tokenize.py index a090c55..4c53dab 100644 --- a/examples/tokenize.py +++ b/examples/tokenize.py @@ -1,4 +1,4 @@ -from lindera import Segmenter, Tokenizer, load_dictionary +from lindera_py import Segmenter, Tokenizer, load_dictionary def main(): diff --git a/examples/tokenize_with_decompose.py b/examples/tokenize_with_decompose.py index 560f9e1..02f9324 100644 --- a/examples/tokenize_with_decompose.py +++ b/examples/tokenize_with_decompose.py @@ -1,4 +1,4 @@ -from lindera import Segmenter, Tokenizer, load_dictionary +from lindera_py import Segmenter, Tokenizer, load_dictionary def main(): diff --git a/examples/tokenize_with_filters.py b/examples/tokenize_with_filters.py index 13c2841..8ae7573 100644 --- a/examples/tokenize_with_filters.py +++ b/examples/tokenize_with_filters.py @@ -1,4 +1,4 @@ -from lindera import Segmenter, Tokenizer, load_dictionary +from lindera_py import Segmenter, Tokenizer, load_dictionary def main(): diff --git a/examples/tokenize_with_userdict.py b/examples/tokenize_with_userdict.py index 61d4f5b..d1a50bc 100644 --- a/examples/tokenize_with_userdict.py +++ b/examples/tokenize_with_userdict.py @@ -1,6 +1,6 @@ from pathlib import Path -from lindera import Segmenter, Tokenizer, load_dictionary, load_user_dictionary +from lindera_py import Segmenter, Tokenizer, load_dictionary, load_user_dictionary project_root = Path(__file__).resolve().parent.parent diff --git a/pyproject.toml b/pyproject.toml index ea98b29..373fd00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "lindera" -version = "0.38.2" +name = "lindera_py" +version = "0.38.3" description = "" authors = ["Minoru Osuka "] license = "MIT" diff --git a/src/lib.rs b/src/lib.rs index 83ba0c7..b245bcc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,74 +1,24 @@ -// pub mod character_filter; pub mod dictionary; pub mod segmenter; pub mod token; -// pub mod token_filter; pub mod tokenizer; pub mod util; use pyo3::prelude::*; -// use crate::character_filter::japanese_iteration_mark::PyJapaneseIterationMarkCharacterFilter; -// use crate::character_filter::mapping::PyMappingCharacterFilter; -// use crate::character_filter::regex::PyRegexCharacterFilter; -// use crate::character_filter::unicode_normalize::PyUnicodeNormalizeCharacterFilter; -// use crate::character_filter::PyCharacterFilter; use crate::dictionary::{load_dictionary, load_user_dictionary, PyDictionary, PyUserDictionary}; use crate::segmenter::PySegmenter; use crate::token::PyToken; -// use crate::token_filter::japanese_base_form::PyJapaneseBaseFormTokenFilter; -// use crate::token_filter::japanese_compound_word::PyJapaneseCompoundWordTokenFilter; -// use crate::token_filter::japanese_kana::PyJapaneseKanaTokenFilter; -// use crate::token_filter::japanese_katakana_stem::PyJapaneseKatakanaStemTokenFilter; -// use crate::token_filter::japanese_keep_tags::PyJapaneseKeepTagsTokenFilter; -// use crate::token_filter::japanese_number::PyJapaneseNumberTokenFilter; -// use crate::token_filter::japanese_reading_form::PyJapaneseReadingFormTokenFilter; -// use crate::token_filter::japanese_stop_tags::PyJapaneseStopTagsTokenFilter; -// use crate::token_filter::keep_words::PyKeepWordsTokenFilter; -// use crate::token_filter::korean_keep_tags::PyKoreanKeepTagsTokenFilter; -// use crate::token_filter::korean_reading_form::PyKoreanReadingFormTokenFilter; -// use crate::token_filter::korean_stop_tags::PyKoreanStopTagsTokenFilter; -// use crate::token_filter::length::PyLengthTokenFilter; -// use crate::token_filter::lowercase::PyLowercaseTokenFilter; -// use crate::token_filter::mapping::PyMappingTokenFilter; -// use crate::token_filter::remove_diacritical_mark::PyRemoveDiacriticalMarkTokenFilter; -// use crate::token_filter::stop_words::PyStopWordsTokenFilter; -// use crate::token_filter::uppercase::PyUppercaseTokenFilter; -// use crate::token_filter::PyTokenFilter; use crate::tokenizer::{PyTokenizer, PyTokenizerBuilder}; #[pymodule] -fn lindera(module: &Bound<'_, PyModule>) -> PyResult<()> { +fn lindera_py(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_class::()?; module.add_class::()?; module.add_class::()?; module.add_class::()?; module.add_class::()?; module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; - // module.add_class::()?; module.add_function(wrap_pyfunction!(load_dictionary, module)?)?; module.add_function(wrap_pyfunction!(load_user_dictionary, module)?)?; diff --git a/tests/test_tokenize_ipadic.py b/tests/test_tokenize_ipadic.py index 769a454..adfaa8a 100644 --- a/tests/test_tokenize_ipadic.py +++ b/tests/test_tokenize_ipadic.py @@ -1,4 +1,4 @@ -from lindera import Segmenter, Tokenizer, load_dictionary +from lindera_py import Segmenter, Tokenizer, load_dictionary def test_tokenize_with_ipadic(): From c9af26ee007ba275f47e6b88bed9e4348ab0441c Mon Sep 17 00:00:00 2001 From: Minoru Osuka Date: Fri, 6 Dec 2024 13:17:39 +0900 Subject: [PATCH 2/2] Remove rlib --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7919451..b9b6e57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT" [lib] name = "lindera_py" path = "src/lib.rs" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib"] [features] default = [] # No directories included