Skip to main content

split-vnm-words package

Project description

Split words

Implementation of tools helps to convert the rect of sentence-level and phrase-level to word-level by using linear interpolation.

Installation

cd <this-repo>
pip install .

Usage

from splitwords import Splitter
import re

splitter = Splitter(languages=['vi', 'en', 'teencode'])
paragraph = "Chất liệudẻo. Màu sắcđen đen. Dép đẹp lắm luônn ạ. Miksăn được k thikquá tr. shipperthân thiện"

sentence_ls = []
pat = re.compile(r"([.()!])")

paragraph = pat.sub(" \\1 ", paragraph)
new_paragraph = []
new_w = None
for w in paragraph.split():
    if len(w) > 3:
        new_w = splitter.split(w.upper())
    else:
        new_w = None
    new_paragraph += [
        ' '.join(new_w).lower() if new_w is not None else w.lower()
    ]
new_paragraph = ' '.join(new_paragraph)
print(new_paragraph)

Expected output:

chất liệu dẻo . màu sắc đen đen . dép đẹp lắm luôn n  . mik săn được k thik quá tr . shipper thân thiện

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

split-vnm-words-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file split-vnm-words-0.0.2.tar.gz.

File metadata

  • Download URL: split-vnm-words-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for split-vnm-words-0.0.2.tar.gz
Algorithm Hash digest
SHA256 463c89c20508d250cda42020932378f782f1d6146eb36329cbcaa495808e4c05
MD5 efdc379b4403edf6e891aafb9fccd46b
BLAKE2b-256 60587b15992082d27c79beda15a127f0fbc6d7bacbbc5cd699e1f554a6babb60

See more details on using hashes here.

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