Giter Site home page Giter Site logo

pythainlp / nlpo3 Goto Github PK

View Code? Open in Web Editor NEW
30.0 6.0 6.0 1.04 MB

Thai Natural Language Processing library in Rust, with Python and Node bindings.

License: Apache License 2.0

Python 19.68% Rust 70.87% Jupyter Notebook 7.58% TypeScript 0.43% Shell 1.43%
thai-language natural-language-processing text-processing tokenizer python rust nodejs hacktoberfest

nlpo3's Issues

How to manage breaking changes from main lib for binding?

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?

[Python] load_dict() can't deal with blank line

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

Can't install on apple silicon (arm64) platform

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

Update TCC+

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.

Remove dictionary from default install

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.

Clarify method in Tokenizer trait

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.