seg-text
Segment multilingual text to sentences
Currently for Python 3.8 only because of the package vtext used.
Pre-install fastetext whl for Windows
seg-text depends on fastlid which in turn depends on fasttext. Installing fasttext requires a C++ compiler.
For Windows without a C++ compiler, readily available whl packages can be downloaded from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and installed (for example for python 3.8 amd64) as follows
pip install fasttext-0.9.2-cp38-cp38-win_amd64.whl
Install seg-text
pip install seg-text
# or pip install git+https://github.com/ffreemt/seg-text
# or poetry add git+https://github.com/ffreemt/seg-text
Use seg-text
from seg_text import seg_text
prin(seg_text(" text 1\n test 2. Test 3"))
# ["text 1", "test 2.", "Test 3"]
text = """ “元宇宙”,英文為“Metaverse”。該詞出自1992年;的科幻小說《雪崩》。 """
print(seg_text(text))
# ["“元宇宙”,英文為“Metaverse”。", "該詞出自1992年;的科幻小說《雪崩》。"]
# [;:] is a regex expression meaning either ; or :
# if you use ;: (without []), it would mean ;: together as a whole
print(seg_text(text, extra="[;:]"))
# ["“元宇宙”,英文為“Metaverse”。", "該詞出自1992年;", "的科幻小說《雪崩》。"]
Refer to seg_text.py for more details.
Metadata
Release files for seg-text 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| seg_text-0.1.2.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| seg_text-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / seg_text-0.1.2.tar.gz
| Download URL | seg_text-0.1.2.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37332d6fa755659aba3d93faa1248242c56a5a84e1f9332990802226ad9c4ca8
|
|
BLAKE2b-256 checksum How to use checksums |
15f8e2f034ef9fdc67d368bd28c5b3764d8b0f90f284ccb3c56252a87135f2a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.5 Windows/10
|
Release files / seg_text-0.1.2-py3-none-any.whl
| Download URL | seg_text-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e67af219b81259d916a11708799ef52bb7d765f9d8010028dd8d48e053eda17
|
|
BLAKE2b-256 checksum How to use checksums |
b81a79347846f465e44efb916cab87999e7f9179ba4515578835d8f4eeadc2be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.5 Windows/10
|