Skip to main content

Matching texts across languages.

Project description

String Pod

pypi python Build Status codecov

Matching texts across languages

Features

  • Normalize text with options
  • Check if a text contains a substring
  • Parse numbers from text
  • Compare pinyin of two texts

Usage

Contains

Check if a text contains a substring, with options.

stringpod contains "Hello, world!" "world"
stringpod contains "  Hello, world!  " "lo, wor" --options "strip_whitespace,ignore_case"
stringpod contains "歌曲(純音樂)" "(纯音乐)" --options "ignore_chinese_variant"

Normalize

Normalize text to a standard form.

stringpod normalize "Hello, World!!!"
stringpod normalize "    Hello,   World!!!" --options "all"
stringpod normalize "歌曲(純音樂)" --options "ignore_chinese_variant"

Normalizer Options

  • strip_whitespace: Strip whitespace (leading and trailing) from the text (default: False)
  • remove_whitespace: Remove whitespace (all whitespace characters) from the text (default: False)
    • strip_whitespace will not be needed if remove_whitespace is True
  • ignore_chinese_variant: Ignore Chinese variant (default: False)
  • ignore_case: Ignore case (default: False)
    • English will be converted to lowercase
    • Chinese will be converted to simplified Chinese
  • nfkc: Normalize to NFKC (default: True)

Number Parser

Parse numbers from text.

stringpod number "One hundred and twenty-three"
stringpod number "One hundred and twenty-three" --language "en"

Number Parser Options

  • language: Language of the number (default: en)

Compare Pinyin

Compare pinyin of two texts.

stringpod cmp-pinyin "你好" "你号"
stringpod cmp-pinyin "你好" "你号" --options "with_tone"
stringpod cmp-pinyin "你好" "你号" --options "spoken_tone"

Pinyin Options

  • with_tone: Whether to include the tone (default: False)
  • spoken_tone: Whether to use the spoken tone (default: False)

Development

poetry install -E dev -E docs -E test
poetry run pre-commit install

CLI Application

poetry run python -m stringpod.cli --help

Python API

poetry run python -m stringpod.stringpod --help

Testing

poetry run pytest # Run Pytest
poetry run python -m stringpod.stringpod -v # Run Doctests

Credits

Core packages:

This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stringpod-0.2.2.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stringpod-0.2.2-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file stringpod-0.2.2.tar.gz.

File metadata

  • Download URL: stringpod-0.2.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for stringpod-0.2.2.tar.gz
Algorithm Hash digest
SHA256 32e8068bbc2eeb3d78fc23eca38606067af3617d3ebcae209215518591213f7f
MD5 757a5488457dc3f935c7ce1baefb3eff
BLAKE2b-256 a65e096ed38d7a79e470af4e713dc98897d9f433d8433bed2fde515cb6934b76

See more details on using hashes here.

Provenance

The following attestation bundles were made for stringpod-0.2.2.tar.gz:

Publisher: release.yml on jyyyeung/stringpod

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stringpod-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: stringpod-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for stringpod-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 afc60de9f9ecfb4997986c0c5f7dcfb9eca07f58bb6e01b467a1dd9b1d91d378
MD5 8cd428a71ddcf4746202dd1a07f309a3
BLAKE2b-256 2248aefed8a00bb89fc751d597f0b1e7ec27e591c0a476853bd0ef1ed5467837

See more details on using hashes here.

Provenance

The following attestation bundles were made for stringpod-0.2.2-py3-none-any.whl:

Publisher: release.yml on jyyyeung/stringpod

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page