pythainlp / nlpo3 Goto Github PK
View Code? Open in Web Editor NEWThai Natural Language Processing library in Rust, with Python and Node bindings.
License: Apache License 2.0
Thai Natural Language Processing library in Rust, with Python and Node bindings.
License: Apache License 2.0
Now, each binding uses a published crate of main lib, but what would happen if the main lib signature is changed like in #31?
Should the changes in main lib be merged into some "dev" branch, then publish new version of the main crate from approved "dev" branch and then update main crate dependency of each binding, fix binding and then make a pull request to main?
From this line, I think we can remove Option
from safe
and parallel
to be just a boolean. The code should looks simpler and the binding just call unwrap_or or unwrap_or_default to convert option type to a boolean.
Currently, we haven't Cargo.lock
in the project to lock dependency version. Do we need to add it?
If a dictionary file has a blank file, will get this error:
thread '<unnamed>' panicked at 'range end index 4 out of range for slice of length 0',
/nlpo3-1.3.1/src/fixed_bytes_str/four_bytes.rs:296:30
A dictionary file with a blank line will result an error:
thread 'main' panicked at 'range end index 4 out of range for slice of length 0', /Users/arthit/.cargo/registry/src/github.com-1ecc6299db9ec823/nlpo3-1.1.2/src/fixed_bytes_str/four_bytes.rs:233:30
build and publish nlpO3-Node.js binding to npm
Current python is 3.8.13
using conda (as apple silicon can't run python 3.7
(x86_64
only))
Running
$> pip install "nlpo3>=1.2.2"
caused the following error
Collecting nlpo3>=1.2.2
Using cached nlpo3-1.2.2.tar.gz (9.6 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [87 lines of output]
configuration error: `project.license` must be valid exactly by one definition (2 matches found):
- keys:
'file': {type: string}
required: ['file']
- keys:
'text': {type: string}
required: ['text']
DESCRIPTION:
`Project license <https://www.python.org/dev/peps/pep-0621/#license>`_.
GIVEN VALUE:
"Apache-2.0"
OFFENDING RULE: 'oneOf'
DEFINITION:
{
"oneOf": [
{
"properties": {
"file": {
"type": "string",
"$$description": [
"Relative path to the file (UTF-8) which contains the license for the",
"project."
]
}
},
"required": [
"file"
]
},
{
"properties": {
"text": {
"type": "string",
"$$description": [
"The license of the project whose meaning is that of the",
"`License field from the core metadata",
"<https://packaging.python.org/specifications/core-metadata/#license>`_."
]
}
},
"required": [
"text"
]
}
]
}
Traceback (most recent call last):
File "/Users/user/miniconda3/envs/python38/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/Users/user/miniconda3/envs/python38/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/user/miniconda3/envs/python38/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 4, in <module>
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 159, in setup
dist.parse_config_files()
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 868, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 62, in apply_configuration
config = read_configuration(filepath, True, ignore_option_errors, dist)
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 126, in read_configuration
validate(subset, filepath)
File "/private/var/folders/9n/7pyff06d2x78r2sktbrb18680000gn/T/pip-build-env-jslccyui/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 51, in validate
raise ValueError(f"{error}\n{summary}") from None
ValueError: invalid pyproject.toml config: `project.license`.
configuration error: `project.license` must be valid exactly by one definition (2 matches found):
- keys:
'file': {type: string}
required: ['file']
- keys:
'text': {type: string}
required: ['text']
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
This package is used in pythainlp>=3.0
, so it caused some problem down the line
See the use from Charabia
They use the longest matching approach.
And I'm sure their segmenter doesn't check the valid boundaries, like Thai Character Cluster.
There can be a room for improvement.
After PyThaiNLP's TCC has major update, TCC in PyThaiNLP has 2 version PyThaiNLP/pythainlp#741. nlpO3 needs to update the TCC rule to improve newmm tokenizer but the new TCC in PyThaiNLP still isn't the final version because some rule maybe missing and wait to found the bug from reporting.
Current dictionary is quite big and probably not every users are going to use that.
Also, PyThaiNLP may consider to include nlpO3 Python-binding as one of the word tokenzation options. That means two exact copies of a same dictionary will be installed.
Dictionary can be installed if the user explicitly put it in a feature flag, maybe something like:
nlpo3 = {version = "1.3.0", features = ["dict-pythainlp", "dict-libthai"]}
More dictionary options can be offered in this way as well.
If user just install it without the feature flag:
nlpo3 = {version = "1.3.0"}
the user have to supply a dictionary of their own.
From Tokenizer trait declaration:
pub trait Tokenizer {
fn segment(&self, text: &str, safe: Option<bool>, parallel: Option<bool>) -> Vec<String>;
fn segment_to_string(
&self,
text: &str,
safe: Option<bool>,
parallel: Option<bool>,
) -> Vec<String>;
}
It provides 2 methods that look do the same thing. And in Newmm
, it do the same things for both methods (Ref here). I purpose to clarify which one we should use and clean up trait protocol.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.