Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nlpo3-python]: Add pyo3 signature to functions #82

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
1 change: 0 additions & 1 deletion nlpo3-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion nlpo3-nodejs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion nlpo3-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions nlpo3-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<String>> {
if let Some(loaded_dict) = DICT_COLLECTION.lock().unwrap().get(dict_name) {
let result = loaded_dict.segment_to_string(text.to_str()?, safe, parallel);
Expand All @@ -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() {
Expand Down
Loading