Hazm
Python library for digesting Persian text.
Text cleaning
Sentence and word tokenizer
Word lemmatizer
POS tagger
Dependency parser
NLTK compatible
Python 3.3 and 2.7 support
Usage
>>> from hazm import Normalizer
>>> normalizer = Normalizer()
>>> normalizer.normalize('اصلاح نويسه ها و استفاده از نیمفاصله پردازش را آسان مي كند')
'اصلاح نویسهها و استفاده از نیمفاصله پردازش را آسان میکند'
>>> from hazm import sent_tokenize, word_tokenize
>>> sent_tokenize('ما هم برای وصل کردن آمدیم! ولی برای پردازش، جدا بهتر نیست؟')
['ما هم برای وصل کردن آمدیم!', 'ولی برای پردازش، جدا بهتر نیست؟']
>>> word_tokenize('ولی برای پردازش، جدا بهتر نیست؟')
['ولی', 'برای', 'پردازش', '،', 'جدا', 'بهتر', 'نیست', '؟']
>>> from hazm import Stemmer, Lemmatizer
>>> stemmer = Stemmer()
>>> stemmer.stem('کتابها')
'کتاب'
>>> lemmatizer = Lemmatizer()
>>> lemmatizer.lemmatize('میروم')
'رفت#رو'
>>> from hazm import POSTagger
>>> tagger = POSTagger()
>>> tagger.tag(word_tokenize('ما بسیار کتاب میخوانیم'))
[('ما', 'PR'), ('بسیار', 'ADV'), ('کتاب', 'N'), ('میخوانیم', 'V')]
>>> from hazm import DependencyParser
>>> parser = DependencyParser(tagger=POSTagger())
>>> parser.parse(word_tokenize('زنگها برای که به صدا درمیآید ؟'))
<DependencyGraph with 8 nodes>
Installation
pip install hazm
We also trained tagger and parser models which you may put them in resources folder of your project.
Thanks
from constributors: Mojtaba Khallash and Mohsen Imany.
from Virastyar for persian word list.
Metadata
Release files for hazm 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hazm-0.1.tar.gz | 134.9 kB | Without provenance | Details for hazm-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hazm-0.1.linux-x86_64.exe | Details for hazm-0.1.linux-x86_64.exe |
Total release size: 333.5 kB
Release files / hazm-0.1.tar.gz
| Download URL | hazm-0.1.tar.gz |
|---|---|
| Size | 134.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1101cf8b66884e9f64c8fa88c129f66150a466551578812d5da7b876213c862e
|
|
BLAKE2b-256 checksum How to use checksums |
da4d7065524c9cede2f2a0e57f0a1d6663af036495f084fc60834da31bce33b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / hazm-0.1.linux-x86_64.exe
| Download URL | hazm-0.1.linux-x86_64.exe |
|---|---|
| Size | 198.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53548952bd94091256e3bb1cd9e7adc6b615bfeae2e83d83cb9ec4305828adf5
|
|
BLAKE2b-256 checksum How to use checksums |
942e5aa15812f9ca87c20210c1a94645770dd3e2fdb0b4a91279c75ab22381ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for hazm 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.