Skip to main content

hlm-texts Codacy BadgeCode style: blackLicense: MITPyPI version

Hlm at your fingertips

This repo currently just has

  • 340-脂砚斋重批红楼梦.txt: hlm_zh
  • david-hawks-the-story-of-the-stone.txt: hlm_en
  • yang-hlm.txt: hlm_en1
  • joly-hlm.txt: hlm_en2

It may be expanded to other versions. If you wish to have one particular version included, make a pull request (fork, upload files and click the pull request button) or provide a text file to me.

Special Dependencies

hlm_texts depends on polyglot that in turn depends on libicu

To install libicu

For Linux/OSX

E.g.

  • Ubuntu: sudo apt install libicu-dev
  • Centos: yum install libicu
  • OSX: brew install icu4c

Then use poetry or pip to install PyICU pycld2 Morfessor, e.g.

pip install PyICU pycld2 Morfessor

or

poetry add PyICU pycld2 Morfessor

For Windows

Download and install the pyicu and pycld2 (possibly also Morfessor) whl packages for your OS/Python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyicu and https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycld2 (possibly also Morfessor https://www.lfd.uci.edu/~gohlke/pythonlibs/)

Installation

pip install hlm-texts

# pip install hlm-texts -U  # to upgrade to the newest version

or install the newest version

pip install git+https://github.com/ffreemt/hlm-texts

or git clone the repo and install from the source

git clone
cd hlm-texts
pip install -r requirements.text

Usage

Texts from various editions

from hlm_texts import hlm_en, hlm_zh, hlm_en1, hlm_en2
  • hlm_zh: 340-脂砚斋重批红楼梦.txt
  • hlm_en: david-hawks-the-story-of-the-stone.txt
  • hlm_en1: yang-hlm.txt
  • hlm_en2: joly-hlm.txt

with blank lines removed and paragraphs retaind.

Sentence tokenizing: sent_tokenizer

for tokenizing text or list of texts into sentences

from hlm_texts import sent_tokenizer, hlm_en

hlm_en_sents = sent_tokenizer(hlm_en, lang="en")

Tokenizing long English texts for the first time can take a while (3-5 minutes for hlm_en, hlm_en1, hlm_en2). Subsequent operations are, however, instant since sent_tokenizer is cached in ~/joblib_cache (\Users\xyz\joblib_cacheforWindows 10`).

Final Note

The repo is for study purpose only. If you believe that your interests have been violated in any way, please let me know. I'll promptly follow it up with appropriate actions.

Metadata

Release files for hlm-texts 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hlm-texts 0.1.8
File Size Uploaded
hlm-texts-0.1.8.tar.gz 5.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for hlm-texts 0.1.8
File Interpreter ABI Platform
hlm_texts-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 MB

Release files / hlm-texts-0.1.8.tar.gz

Download URL hlm-texts-0.1.8.tar.gz
Size 5.2 MB
Tags Source
SHA-256 checksum
How to use checksums
2d99558f1ad777a2f02387c7bc46728e54d932b008fa20d6c2cbe7f1b4bcd15b
BLAKE2b-256 checksum
How to use checksums
5fb8e4ebf11667f6bd04d6022f96c6cf3a116540e12cda7e4f998c497d42bdad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.7.9 Windows/10

Release files / hlm_texts-0.1.8-py3-none-any.whl

Download URL hlm_texts-0.1.8-py3-none-any.whl
Size 5.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
50473cd4434ee9be6a5c9be935c7986db175c76c4a4415749ac1b8697931829b
BLAKE2b-256 checksum
How to use checksums
887838b1c2663a87fa9003484734fe52a915b9aeb3621594cae6ad8e61055628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.7.9 Windows/10

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page