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.
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 | |
|---|---|---|---|
| hazm-0.1.tar.gz | 134.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hazm-0.1.linux-x86_64.exe | Details |
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 |