From e002a320bc1ff00c1589ca55245f1c32c54d4930 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Mon, 11 Nov 2024 07:18:09 +0000 Subject: [PATCH] Add pyo3 signature --- Cargo.toml | 1 - nlpo3-cli/Cargo.toml | 1 - nlpo3-nodejs/Cargo.toml | 1 - nlpo3-python/Cargo.toml | 1 - nlpo3-python/src/lib.rs | 2 ++ 5 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ad28d01..9e04e29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ name = "nlpo3" version = "1.4.0" edition = "2018" license = "Apache-2.0" -license-file = "LICENSE" authors = ["Thanathip Suntorntip Gorlph"] description = "Thai natural language processing library, with Python and Node bindings" homepage = "https://github.com/PyThaiNLP/nlpo3/" diff --git a/nlpo3-cli/Cargo.toml b/nlpo3-cli/Cargo.toml index c800aa8..2ae7ea3 100644 --- a/nlpo3-cli/Cargo.toml +++ b/nlpo3-cli/Cargo.toml @@ -3,7 +3,6 @@ name = "nlpo3-cli" version = "0.2.1-dev" edition = "2018" license = "Apache-2.0" -license-file = "LICENSE" authors = ["Vee Satayamas <5ssgdxltv@relay.firefox.com>"] description = "Command line interface for nlpO3, a Thai natural language processing library" documentation = "https://github.com/PyThaiNLP/nlpo3/tree/main/nlpo3-cli/README.md" diff --git a/nlpo3-nodejs/Cargo.toml b/nlpo3-nodejs/Cargo.toml index f4d681b..1e86fae 100644 --- a/nlpo3-nodejs/Cargo.toml +++ b/nlpo3-nodejs/Cargo.toml @@ -3,7 +3,6 @@ name = "nlpo3-nodejs" version = "1.0.0" edition = "2018" license = "Apache-2.0" -license-file = "LICENSE" authors = ["Thanathip Suntorntip Gorlph"] description = "Node binding for nlpO3 Thai language processing library" documentation = "https://github.com/PyThaiNLP/nlpo3/tree/main/nlpo3-nodejs/README.md" diff --git a/nlpo3-python/Cargo.toml b/nlpo3-python/Cargo.toml index a79acd3..6b26879 100644 --- a/nlpo3-python/Cargo.toml +++ b/nlpo3-python/Cargo.toml @@ -3,7 +3,6 @@ name = "nlpo3-python" version = "1.3.1-dev" edition = "2018" license = "Apache-2.0" -license-file = "LICENSE" authors = ["Thanathip Suntorntip Gorlph"] description = "Python binding for nlpO3 Thai language processing library" exclude = ["notebooks"] diff --git a/nlpo3-python/src/lib.rs b/nlpo3-python/src/lib.rs index 0897069..6401743 100644 --- a/nlpo3-python/src/lib.rs +++ b/nlpo3-python/src/lib.rs @@ -31,6 +31,7 @@ lazy_static! { /// returns list of valid utf-8 bytes list /// signature: (text: str, dict_name: str, safe: boolean = false, parallel: boolean = false) -> List[List[u8]] #[pyfunction] +#[pyo3(signature = (text, dict_name, safe=false, parallel=false))] fn segment(text: &PyString, dict_name: &str, safe: bool, parallel: bool) -> PyResult> { if let Some(loaded_dict) = DICT_COLLECTION.lock().unwrap().get(dict_name) { let result = loaded_dict.segment_to_string(text.to_str()?, safe, parallel); @@ -48,6 +49,7 @@ fn segment(text: &PyString, dict_name: &str, safe: bool, parallel: bool) -> PyRe /// returns a tuple of string of loading result and a boolean /// signature: (file_path: str, dict_name: str) -> (str, boolean) #[pyfunction] +#[pyo3(signature = (file_path, dict_name))] fn load_dict(file_path: &str, dict_name: &str) -> PyResult<(String, bool)> { let mut dict_col_lock = DICT_COLLECTION.lock().unwrap(); if dict_col_lock.get(dict_name).is_some() {