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.3.tar.gz (3.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: split-vnm-words-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 9d3c8de55d260e5c600b46ef6fb37e755b35a6014972eb10cd67f6171a3fda10
MD5 ac1faddea9fc852e501d17e9c8237d3c
BLAKE2b-256 f873e9a36b68541b21e72887388a9119cf96e080920930cd31da70dc828fb2b4

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