Upload 7 files
#1
by
ariahmed
- opened
- .gitignore +43 -0
- LICENSE +108 -0
- MANIFEST.in +18 -0
- README.md +350 -3
- mkdocs.yml +37 -0
- requirements.txt +1 -0
- setup.py +25 -0
.gitignore
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Created by https://www.toptal.com/developers/gitignore/api/macos
|
3 |
+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos
|
4 |
+
|
5 |
+
### macOS ###
|
6 |
+
# General
|
7 |
+
.DS_Store
|
8 |
+
.AppleDouble
|
9 |
+
.LSOverride
|
10 |
+
|
11 |
+
# Icon must end with two \r
|
12 |
+
Icon
|
13 |
+
|
14 |
+
|
15 |
+
# Thumbnails
|
16 |
+
._*
|
17 |
+
|
18 |
+
# Files that might appear in the root of a volume
|
19 |
+
.DocumentRevisions-V100
|
20 |
+
.fseventsd
|
21 |
+
.Spotlight-V100
|
22 |
+
.TemporaryItems
|
23 |
+
.Trashes
|
24 |
+
.VolumeIcon.icns
|
25 |
+
.com.apple.timemachine.donotpresent
|
26 |
+
|
27 |
+
# Directories potentially created on remote AFP share
|
28 |
+
.AppleDB
|
29 |
+
.AppleDesktop
|
30 |
+
Network Trash Folder
|
31 |
+
Temporary Items
|
32 |
+
.apdisk
|
33 |
+
|
34 |
+
hidden/
|
35 |
+
__pycache__/
|
36 |
+
*.pyc
|
37 |
+
build/
|
38 |
+
klpt.egg-info/
|
39 |
+
site/
|
40 |
+
cinder/
|
41 |
+
.vscode/
|
42 |
+
# End of https://www.toptal.com/developers/gitignore/api/macos
|
43 |
+
|
LICENSE
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Attribution-ShareAlike 4.0 International Public License (https://creativecommons.org/licenses/by-sa/4.0/)
|
2 |
+
Copyright (c) 2020
|
3 |
+
|
4 |
+
Sina Ahmadi (ahmadi.sina@outlook.com)
|
5 |
+
=======================================================================
|
6 |
+
Creative Commons Attribution-ShareAlike 4.0 International Public License
|
7 |
+
|
8 |
+
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
9 |
+
|
10 |
+
Section 1 – Definitions.
|
11 |
+
|
12 |
+
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
13 |
+
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
14 |
+
BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
|
15 |
+
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
16 |
+
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
17 |
+
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
18 |
+
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
|
19 |
+
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
20 |
+
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
21 |
+
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
|
22 |
+
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
23 |
+
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
24 |
+
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
25 |
+
|
26 |
+
Section 2 – Scope.
|
27 |
+
|
28 |
+
License grant.
|
29 |
+
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
30 |
+
reproduce and Share the Licensed Material, in whole or in part; and
|
31 |
+
produce, reproduce, and Share Adapted Material.
|
32 |
+
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
33 |
+
Term. The term of this Public License is specified in Section 6(a).
|
34 |
+
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
35 |
+
Downstream recipients.
|
36 |
+
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
37 |
+
Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
|
38 |
+
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
39 |
+
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
40 |
+
|
41 |
+
Other rights.
|
42 |
+
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
43 |
+
Patent and trademark rights are not licensed under this Public License.
|
44 |
+
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
|
45 |
+
|
46 |
+
Section 3 – License Conditions.
|
47 |
+
|
48 |
+
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
49 |
+
|
50 |
+
Attribution.
|
51 |
+
|
52 |
+
If You Share the Licensed Material (including in modified form), You must:
|
53 |
+
retain the following if it is supplied by the Licensor with the Licensed Material:
|
54 |
+
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
55 |
+
a copyright notice;
|
56 |
+
a notice that refers to this Public License;
|
57 |
+
a notice that refers to the disclaimer of warranties;
|
58 |
+
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
59 |
+
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
60 |
+
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
61 |
+
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
62 |
+
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
63 |
+
ShareAlike.
|
64 |
+
|
65 |
+
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
|
66 |
+
The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
|
67 |
+
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
|
68 |
+
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
|
69 |
+
|
70 |
+
Section 4 – Sui Generis Database Rights.
|
71 |
+
|
72 |
+
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
73 |
+
|
74 |
+
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
|
75 |
+
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
|
76 |
+
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
77 |
+
|
78 |
+
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
79 |
+
|
80 |
+
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
81 |
+
|
82 |
+
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
|
83 |
+
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
|
84 |
+
|
85 |
+
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
86 |
+
|
87 |
+
Section 6 – Term and Termination.
|
88 |
+
|
89 |
+
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
90 |
+
|
91 |
+
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
92 |
+
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
93 |
+
upon express reinstatement by the Licensor.
|
94 |
+
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
95 |
+
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
96 |
+
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
97 |
+
|
98 |
+
Section 7 – Other Terms and Conditions.
|
99 |
+
|
100 |
+
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
101 |
+
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
102 |
+
|
103 |
+
Section 8 – Interpretation.
|
104 |
+
|
105 |
+
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
106 |
+
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
107 |
+
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
108 |
+
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
MANIFEST.in
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
include klpt/data/ckb-Arab.aff
|
2 |
+
include klpt/data/ckb-Arab.dic
|
3 |
+
include klpt/data/ckb-morphemes.json
|
4 |
+
include klpt/data/default-options.json
|
5 |
+
include klpt/data/kmr-morphemes.json
|
6 |
+
include klpt/data/lexicon_ckb_arab.json
|
7 |
+
include klpt/data/lexicon_ckb_latn.json
|
8 |
+
include klpt/data/lexicon_kmr_latn.json
|
9 |
+
include klpt/data/preprocess_map.json
|
10 |
+
include klpt/data/stopwords.json
|
11 |
+
include klpt/data/test_cases_stem.json
|
12 |
+
include klpt/data/test_cases_tokenize.json
|
13 |
+
include klpt/data/test_cases.json
|
14 |
+
include klpt/data/tokenize.json
|
15 |
+
include klpt/data/wergor.json
|
16 |
+
include klpt/data/kmr-Latn.att
|
17 |
+
include klpt/data/kmr-Latn.aff
|
18 |
+
include klpt/data/kmr-Latn.dic
|
README.md
CHANGED
@@ -1,3 +1,350 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Kurdish Language Processing Toolkit
|
2 |
+
|
3 |
+
<p align="center" width="100%">
|
4 |
+
<img width="33%" src="https://raw.githubusercontent.com/sinaahmadi/klpt/master/docs/img/KLPT_logo.png">
|
5 |
+
</p>
|
6 |
+
|
7 |
+
<p align="center">
|
8 |
+
<a href="">
|
9 |
+
<img alt="Build" src="https://badges.frapsoft.com/os/v1/open-source.png?v=103">
|
10 |
+
</a>
|
11 |
+
<a href="https://github.com/sinaahmadi/KLPT/blob/master/license">
|
12 |
+
<img alt="GitHub" src="https://img.shields.io/badge/license-CC%20BY--SA%204.0-blue">
|
13 |
+
</a>
|
14 |
+
<a href="">
|
15 |
+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/klpt">
|
16 |
+
</a>
|
17 |
+
<a href="https://sinaahmadi.github.io/klpt/">
|
18 |
+
<img alt="Documentation" src="https://img.shields.io/website?down_color=green&down_message=online&up_color=orange&url=https%3A%2F%2Fsinaahmadi.github.io%2FKLPT%2F">
|
19 |
+
</a>
|
20 |
+
<a href="https://gitter.im/KurdishNLP/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge">
|
21 |
+
<img alt="Documentation" src="https://badges.gitter.im/KurdishNLP/community.svg">
|
22 |
+
</a>
|
23 |
+
<a href="https://badge.fury.io/py/klpt">
|
24 |
+
<img src="https://badge.fury.io/py/klpt.svg" alt="PyPI version" height="18">
|
25 |
+
</a>
|
26 |
+
</p>
|
27 |
+
|
28 |
+
|
29 |
+
### Welcome / *Hûn bi xêr hatin* / بە خێر بێن! 🙂
|
30 |
+
|
31 |
+
Kurdish Language Processing Toolkit--KLPT is a [natural language processing](https://en.wikipedia.org/wiki/Natural_language_processing) (NLP) toolkit in Python for the [Kurdish language](https://en.wikipedia.org/wiki/Kurdish_languages). The current version comes with four core modules, namely `preprocess`, `stem`, `transliterate` and `tokenize` and addresses basic language processing tasks such as text preprocessing, stemming, tokenization, spell-checking and morphological analysis for the [Sorani](https://en.wikipedia.org/wiki/Sorani) and the [Kurmanji](https://en.wikipedia.org/wiki/Kurmanji) dialects of Kurdish.
|
32 |
+
|
33 |
+
---
|
34 |
+
#### Latest update on April 29th, 2022 🎉
|
35 |
+
|
36 |
+
In the latest version, I focused on Kurmanji for which a morphological analyzer, a stemmer and a lemmatizer are now added to the toolkit. These tasks were partially addressed previously using the [Apertium project](https://github.com/apertium/apertium-kmr). Now, that is fully replaced by the Kurmanji implementation of [Kurdish Hunspell](https://github.com/sinaahmadi/KurdishHunspell).
|
37 |
+
|
38 |
+
---
|
39 |
+
|
40 |
+
## Install KLPT
|
41 |
+
|
42 |
+
<!--For detailed installation instructions, see the [documentation]().-->
|
43 |
+
|
44 |
+
- **Operating system**: macOS / OS X · Linux · Windows (Cygwin, MinGW, Visual
|
45 |
+
Studio)
|
46 |
+
- **Python version**: Python 3.5+
|
47 |
+
- **Package managers**: [pip](https://pypi.org/project/klpt/)
|
48 |
+
|
49 |
+
[pip]: https://pypi.org/project/spacy/
|
50 |
+
[conda]: https://anaconda.org/conda-forge/spacy
|
51 |
+
|
52 |
+
### pip
|
53 |
+
|
54 |
+
Using pip, KLPT releases are available as source packages and binary wheels. Please make sure that a compatible Python version is installed:
|
55 |
+
|
56 |
+
```bash
|
57 |
+
pip install klpt
|
58 |
+
```
|
59 |
+
|
60 |
+
All the data files including lexicons and morphological rules are also installed with the package.
|
61 |
+
|
62 |
+
Although KLPT is not dependent on any NLP toolkit, there is one important requirement, particularly for the `stem` module. That is [`cyhunspell`](https://pypi.org/project/cyhunspell/) which should be installed with a version >= 2.0.1.
|
63 |
+
|
64 |
+
### About this version
|
65 |
+
|
66 |
+
Please note that KLPT is under development and some of the functionalities will appear in the future versions. You can find out regarding the progress of each task at the [Projects](https://github.com/sinaahmadi/KLPT/projects) section. In the current version, the following tasks are included:
|
67 |
+
|
68 |
+
<table>
|
69 |
+
<thead>
|
70 |
+
<tr>
|
71 |
+
<th>Modules<br></th>
|
72 |
+
<th>Tasks</th>
|
73 |
+
<th>Sorani (ckb)</th>
|
74 |
+
<th>Kurmanji (kmr)</th>
|
75 |
+
</tr>
|
76 |
+
</thead>
|
77 |
+
<tbody>
|
78 |
+
<tr>
|
79 |
+
<td rowspan="4"><code>preprocess</code></td>
|
80 |
+
<td>normalization</td>
|
81 |
+
<td>✓ (v0.1.0)</td>
|
82 |
+
<td>✓ (v0.1.0)</td>
|
83 |
+
</tr>
|
84 |
+
<tr>
|
85 |
+
<td>standardization</td>
|
86 |
+
<td>✓ (v0.1.0)</td>
|
87 |
+
<td>✓ (v0.1.0)</td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<td>unification of numerals</td>
|
91 |
+
<td>✓ (v0.1.0)</td>
|
92 |
+
<td>✓ (v0.1.0)</td>
|
93 |
+
</tr>
|
94 |
+
<tr>
|
95 |
+
<td>stopwords</td>
|
96 |
+
<td>✓ (v0.1.4)</td>
|
97 |
+
<td>✓ (v0.1.4)</td>
|
98 |
+
</tr>
|
99 |
+
<tr>
|
100 |
+
<td rowspan="4"><code>tokenize</code></td>
|
101 |
+
<td>word tokenization<br></td>
|
102 |
+
<td>✓ (v0.1.0)</td>
|
103 |
+
<td>✓ (v0.1.0)</td>
|
104 |
+
</tr>
|
105 |
+
<tr>
|
106 |
+
<td>MWE tokenization<br></td>
|
107 |
+
<td>✓ (v0.1.0)</td>
|
108 |
+
<td>✓ (v0.1.0)</td>
|
109 |
+
</tr>
|
110 |
+
<tr>
|
111 |
+
<td>sentence tokenization</td>
|
112 |
+
<td>✓ (v0.1.0)</td>
|
113 |
+
<td>✓ (v0.1.0)</td>
|
114 |
+
</tr>
|
115 |
+
<tr>
|
116 |
+
<td>part-of-speech tagging</td>
|
117 |
+
<td>✗</td>
|
118 |
+
<td>✗</td>
|
119 |
+
</tr>
|
120 |
+
<tr>
|
121 |
+
<td rowspan="4"><code>transliterate</code></td>
|
122 |
+
<td>Arabic to Latin</td>
|
123 |
+
<td>✓ (v0.1.0)</td>
|
124 |
+
<td>✓ (v0.1.0)</td>
|
125 |
+
</tr>
|
126 |
+
<tr>
|
127 |
+
<td>Latin to Arabic</td>
|
128 |
+
<td>✓ (v0.1.0)</td>
|
129 |
+
<td>✓ (v0.1.0)</td>
|
130 |
+
</tr>
|
131 |
+
<tr>
|
132 |
+
<td>Detection of u/w and î/y</td>
|
133 |
+
<td>✓ (v0.1.0)</td>
|
134 |
+
<td>✓ (v0.1.0)</td>
|
135 |
+
</tr>
|
136 |
+
<tr>
|
137 |
+
<td>Detection of Bizroke ( <i>i</i> )</td>
|
138 |
+
<td>✗</td>
|
139 |
+
<td>✗</td>
|
140 |
+
</tr>
|
141 |
+
<tr>
|
142 |
+
<td rowspan="5"><code>stem</code></td>
|
143 |
+
<td>morphological analysis</td>
|
144 |
+
<td>✓ (v0.1.0)</td>
|
145 |
+
<td>✓ (v0.1.1)</td>
|
146 |
+
</tr>
|
147 |
+
<tr>
|
148 |
+
<td>stemming</td>
|
149 |
+
<td>✓ (v.0.1.5)</td>
|
150 |
+
<td>✓ (v.0.1.6) 🆕</td>
|
151 |
+
</tr>
|
152 |
+
<tr>
|
153 |
+
<td>lemmatization</td>
|
154 |
+
<td>✓ (v.0.1.5)</td>
|
155 |
+
<td>✓ (v.0.1.6) 🆕</td>
|
156 |
+
</tr>
|
157 |
+
<tr>
|
158 |
+
<td>spell error detection and correction</td>
|
159 |
+
<td>✓ (v0.1.0)</td>
|
160 |
+
<td>✓ (v.0.1.6) 🆕</td>
|
161 |
+
</tr>
|
162 |
+
</tbody>
|
163 |
+
</table>
|
164 |
+
|
165 |
+
|
166 |
+
## Basic usage
|
167 |
+
|
168 |
+
Once the package is installed, you can import the toolkit as follows:
|
169 |
+
|
170 |
+
```python
|
171 |
+
import klpt
|
172 |
+
```
|
173 |
+
|
174 |
+
In the following, a few examples are provided to work with various modules. Almost all the classes have three arguments in common:
|
175 |
+
|
176 |
+
- `dialect`: the name of the dialect as `Sorani` or `Kurmanji` (ISO 639-3 code will be also added)
|
177 |
+
- `script`: the script of your input text as "Arabic" or "Latin"
|
178 |
+
- `numeral`: the type of the numerals as
|
179 |
+
- Arabic [١٢٣٤٥٦٧٨٩٠]
|
180 |
+
- Farsi [۱۲۳۴۵۶۷۸۹۰]
|
181 |
+
- Latin [1234567890]
|
182 |
+
|
183 |
+
### Preprocess
|
184 |
+
|
185 |
+
This module deals with normalizing scripts and orthographies by using writing conventions based on dialects and scripts. The goal is not to correct the orthography but to normalize the text in terms of the encoding and common writing rules. The input encoding should be in UTF-8 only. To this end, three functions are provided as follows:
|
186 |
+
|
187 |
+
- `normalize`: deals with different encodings and unifies characters based on dialects and scripts
|
188 |
+
- `standardize`: given a normalized text, it returns standardized text based on the Kurdish orthographies following recommendations for [Kurmanji](https://books.google.ie/books?id=Z7lDnwEACAAJ) and [Sorani](http://yageyziman.com/Renusi_Kurdi.htm)
|
189 |
+
- `unify_numerals`: conversion of the various types of numerals used in Kurdish texts
|
190 |
+
- `preprocess`: one single function for normalization, standardization and unification of numerals
|
191 |
+
|
192 |
+
It is recommended that the output of this module be used as the input of subsequent tasks in an NLP pipeline.
|
193 |
+
|
194 |
+
```python
|
195 |
+
>>> from klpt.preprocess import Preprocess
|
196 |
+
|
197 |
+
>>> preprocessor_ckb = Preprocess("Sorani", "Arabic", numeral="Latin")
|
198 |
+
>>> preprocessor_ckb.normalize("لە ســـاڵەکانی ١٩٥٠دا")
|
199 |
+
'لە ساڵەکانی 1950دا'
|
200 |
+
>>> preprocessor_ckb.standardize("راستە لەو ووڵاتەدا")
|
201 |
+
'ڕاستە لەو وڵاتەدا'
|
202 |
+
>>> preprocessor_ckb.unify_numerals("٢٠٢٠")
|
203 |
+
'2020'
|
204 |
+
>>> preprocessor_ckb.preprocess("راستە لە ووڵاتەی ٢٣هەمدا")
|
205 |
+
'ڕاستە لە وڵاتەی 23هەمدا'
|
206 |
+
|
207 |
+
>>> preprocessor_kmr = Preprocess("Kurmanji", "Latin")
|
208 |
+
>>> preprocessor_kmr.standardize("di sala 2018-an")
|
209 |
+
'di sala 2018an'
|
210 |
+
>>> preprocessor_kmr.standardize("hêviya")
|
211 |
+
'hêvîya'
|
212 |
+
```
|
213 |
+
|
214 |
+
In addition, it is possible to remove Kurdish [stopwords](https://en.wikipedia.org/wiki/Stop_word) using the `stopwords` variable. You can define a function like the following to do so:
|
215 |
+
|
216 |
+
```python
|
217 |
+
from klpt.preprocess import Preprocess
|
218 |
+
|
219 |
+
def remove_stopwords(text, dialect, script):
|
220 |
+
p = Preprocess(dialect, script)
|
221 |
+
return [token for token in text.split() if token not in p.stopwords]
|
222 |
+
```
|
223 |
+
|
224 |
+
### Tokenization
|
225 |
+
|
226 |
+
This module focuses on the tokenization of both Kurmanji and Sorani dialects of Kurdish with the following functions:
|
227 |
+
|
228 |
+
- `word_tokenize`: tokenization of texts into tokens (both [multi-word expressions](https://aclweb.org/aclwiki/Multiword_Expressions) and single-word tokens).
|
229 |
+
- `mwe_tokenize`: tokenization of texts by only taking compound forms into account
|
230 |
+
- `sent_tokenize`: tokenization of texts into sentences
|
231 |
+
|
232 |
+
This module is based on the [Kurdish tokenization project](https://github.com/sinaahmadi/KurdishTokenization). It is recommended that the output of this module be used as the input of the `Stem` module.
|
233 |
+
|
234 |
+
```python
|
235 |
+
>>> from klpt.tokenize import Tokenize
|
236 |
+
|
237 |
+
>>> tokenizer = Tokenize("Kurmanji", "Latin")
|
238 |
+
>>> tokenizer.word_tokenize("ji bo fortê xwe avêtin")
|
239 |
+
['▁ji▁', 'bo', '▁▁fortê‒xwe‒avêtin▁▁']
|
240 |
+
>>> tokenizer.mwe_tokenize("bi serokê hukûmeta herêma Kurdistanê Prof. Salih re saz kir.")
|
241 |
+
'bi serokê hukûmeta herêma Kurdistanê Prof . Salih re saz kir .'
|
242 |
+
|
243 |
+
>>> tokenizer_ckb = Tokenize("Sorani", "Arabic")
|
244 |
+
>>> tokenizer_ckb.word_tokenize("بە هەموو هەمووانەوە ڕێک کەوتن")
|
245 |
+
['▁بە▁', '▁هەموو▁', 'هەمووانەوە', '▁▁ڕێک‒کەوتن▁▁']
|
246 |
+
```
|
247 |
+
|
248 |
+
### Transliteration
|
249 |
+
|
250 |
+
This module aims at transliterating one script of Kurdish into another one. Currently, only the Latin-based and the Arabic-based scripts of Sorani and Kurmanji are supported. The main function in this module is `transliterate()` which also takes care of detecting the correct form of double-usage graphemes, namely و ↔ w/u and ی ↔ î/y. In some specific occasions, it can also predict the placement of the missing *i* (also known as *Bizroke/بزرۆکە*).
|
251 |
+
|
252 |
+
The module is based on the [Kurdish transliteration project](https://github.com/sinaahmadi/wergor).
|
253 |
+
|
254 |
+
```python
|
255 |
+
>>> from klpt.transliterate import Transliterate
|
256 |
+
>>> transliterate = Transliterate("Kurmanji", "Latin", target_script="Arabic")
|
257 |
+
>>> transliterate.transliterate("rojhilata navîn")
|
258 |
+
'رۆژهلاتا ناڤین'
|
259 |
+
|
260 |
+
>>> transliterate_ckb = Transliterate("Sorani", "Arabic", target_script="Latin")
|
261 |
+
>>> transliterate_ckb.transliterate("لە وڵاتەکانی دیکەدا")
|
262 |
+
'le wiłatekanî dîkeda'
|
263 |
+
```
|
264 |
+
|
265 |
+
### Stem
|
266 |
+
|
267 |
+
The Stem module deals with various tasks, mainly through the following functions:
|
268 |
+
- `check_spelling`: spell error detection
|
269 |
+
- `correct_spelling`: spell error correction
|
270 |
+
- `analyze`: morphological analysis
|
271 |
+
- `stem`: stemming, e.g. "بڕ" → "بڕاوە" or "dixwî" → "xw"
|
272 |
+
- `lemmatize`: lemmatization, e.g. "بردن" → "بردمنەوە" or "jimartibûye" → "hejmartin"
|
273 |
+
|
274 |
+
The module is based on the [Kurdish Hunspell project](https://github.com/sinaahmadi/KurdishHunspell) for Sorani and the [Apertium project](https://github.com/apertium/apertium-kmr) for Kurmanji. Please note that this module is currently getting further completed and we are aware of its current shortcomings.
|
275 |
+
|
276 |
+
```python
|
277 |
+
>>> from klpt.stem import Stem
|
278 |
+
>>> stemmer = Stem("Sorani", "Arabic")
|
279 |
+
>>> stemmer.check_spelling("سوتاندبووت")
|
280 |
+
False
|
281 |
+
>>> stemmer.correct_spelling("سوتاندبووت")
|
282 |
+
(False, ['ستاندبووت', 'سووتاندبووت', 'سووڕاندبووت', 'ڕووتاندبووت', 'فەوتاندبووت', 'بووژاندبووت'])
|
283 |
+
>>> stemmer.analyze("دیتبامن")
|
284 |
+
[{'pos': ['verb'], 'description': 'past_stem_transitive_active', 'stem': 'دی', 'lemma': ['دیتن'], 'base': 'دیت', 'prefixes': '', 'suffixes': 'بامن'}]
|
285 |
+
>>> stemmer.stem("دەچینەوە")
|
286 |
+
['چ']
|
287 |
+
>>> stemmer.stem("گورەکە", mark_unknown=True) # گوڵەکە in Hewlêrî dialect
|
288 |
+
['_گور_']
|
289 |
+
>>> stemmer.lemmatize("گوڵەکانم")
|
290 |
+
['گوڵ', 'گوڵە']
|
291 |
+
|
292 |
+
>>> stemmer = Stem("Kurmanji", "Latin")
|
293 |
+
>>> stemmer.analyze("dibêjim")
|
294 |
+
[{'base': 'bêj', 'prefixes': 'di', 'suffixes': 'im', 'pos': ['verb'], 'description': 'present_stem_transitive_active', 'stem': 'bêj', 'lemma': ['gotin']}]
|
295 |
+
>>> stemmer.stem("dixwî")
|
296 |
+
['xw']
|
297 |
+
>>> stemmer.lemmatize("jimartibûye")
|
298 |
+
['hejmartin']
|
299 |
+
```
|
300 |
+
|
301 |
+
📖 **Please note that a more complete documentation of the toolkit is available at [https://sinaahmadi.github.io/klpt/](https://sinaahmadi.github.io/klpt/)**.
|
302 |
+
|
303 |
+
## Become a sponsor
|
304 |
+
|
305 |
+
Please consider donating to the project. Data annotation and resource creation requires tremendous amount of time and linguistic expertise. Even a trivial donation will make a difference. You can do so by [becoming a sponsor](https://github.com/sponsors/sinaahmadi) to accompany me in this journey and help the Kurdish language have a better place within other natural languages on the Web. Depending on your support,
|
306 |
+
|
307 |
+
- You can be an official sponsor
|
308 |
+
- You will get a GitHub sponsor badge on your profile
|
309 |
+
- If you have any questions, I will focus on it
|
310 |
+
- If you want, I will add your name or company logo on the front page of your preferred project
|
311 |
+
- Your contribution will be acknowledged in one of my future papers in a field of your choice
|
312 |
+
|
313 |
+
*And, thanks for those who have already sponsored this project. More significant achievements will be made thanks to you!*
|
314 |
+
|
315 |
+
## Contribute
|
316 |
+
|
317 |
+
Are you interested in this project? Each task is addressed individually. Please check the following repositories to find which one you are more interested in:
|
318 |
+
|
319 |
+
- [Kurdish tokenization](https://github.com/sinaahmadi/KurdishTokenization)
|
320 |
+
- [Kurdish Hunspell](https://github.com/sinaahmadi/KurdishHunspell)
|
321 |
+
- [Kurdish transliteration](https://github.com/sinaahmadi/wergor)
|
322 |
+
|
323 |
+
In addition, our main objective is to extend the current toolkit to include more tasks, particularly part-of-speech tagging, named-entity recognition and syntactic analysis. Further instructions are provided at [https://sinaahmadi.github.io/klpt/about/contributing/](https://sinaahmadi.github.io/klpt/about/contributing/). You can also join us on [Gitter](https://gitter.im/KurdishNLP/community).
|
324 |
+
|
325 |
+
Don't forget, **open-source is fun!** 😊
|
326 |
+
|
327 |
+
## Requirements
|
328 |
+
- Python >=3.6
|
329 |
+
- [`cyhunspell`](https://pypi.org/project/cyhunspell/) >= 2.0.1
|
330 |
+
|
331 |
+
## Cite this project
|
332 |
+
Please consider citing [this paper](https://sinaahmadi.github.io/docs/articles/ahmadi2020klpt.pdf), if you use any part of the data or the tool ([`bib` file](https://sinaahmadi.github.io/bibliography/ahmadi2020klpt.txt)):
|
333 |
+
|
334 |
+
@inproceedings{ahmadi2020klpt,
|
335 |
+
title = "{KLPT--Kurdish Language Processing Toolkit}",
|
336 |
+
author = "Ahmadi, Sina",
|
337 |
+
booktitle = "Proceedings of the second Workshop for {NLP} Open Source Software ({NLP}-{OSS})",
|
338 |
+
month = nov,
|
339 |
+
year = "2020",
|
340 |
+
publisher = "Association for Computational Linguistics"
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
+
## License
|
345 |
+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Kurdish Language Processing Toolkit</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/sinaahmadi/klpt" property="cc:attributionName" rel="cc:attributionURL">Sina Ahmadi</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a> which means:
|
346 |
+
|
347 |
+
- **You are free to share**, copy and redistribute the material in any medium or format and also adapt, remix, transform, and build upon the material
|
348 |
+
for any purpose, **even commercially**.
|
349 |
+
- **You must give appropriate credit**, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
350 |
+
- If you remix, transform, or build upon the material, **you must distribute your contributions under the same license as the original**.
|
mkdocs.yml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use_directory_urls: true
|
2 |
+
site_name: KLPT
|
3 |
+
site_url: https://sinaahmadi.github.io/klpt/
|
4 |
+
site_description: "Kurdish Language Processing Toolkit"
|
5 |
+
site_author: Sina Ahmadi
|
6 |
+
copyright: <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Kurdish Language Processing Toolkit</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/sinaahmadi/klpt" property="cc:attributionName" rel="cc:attributionURL">Sina Ahmadi</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>
|
7 |
+
|
8 |
+
repo_url: "https://github.com/sinaahmadi/klpt"
|
9 |
+
|
10 |
+
theme:
|
11 |
+
name: null
|
12 |
+
custom_dir: cinder
|
13 |
+
colorscheme: dracula
|
14 |
+
highlightjs: true
|
15 |
+
hljs_languages:
|
16 |
+
- python
|
17 |
+
- json
|
18 |
+
|
19 |
+
nav:
|
20 |
+
- Home: index.md
|
21 |
+
- User Guide:
|
22 |
+
- Getting started: user-guide/getting-started.md
|
23 |
+
- Preprocess: user-guide/preprocess.md
|
24 |
+
- Tokenize: user-guide/tokenize.md
|
25 |
+
- Transliterate: user-guide/transliterate.md
|
26 |
+
- Stem: user-guide/stem.md
|
27 |
+
- About:
|
28 |
+
- Release Notes: about/release-notes.md
|
29 |
+
- Contributing: about/contributing.md
|
30 |
+
- Sponsors: about/sponsors.md
|
31 |
+
- License: about/license.md
|
32 |
+
|
33 |
+
plugins:
|
34 |
+
- search
|
35 |
+
- mkdocstrings
|
36 |
+
- git-revision-date
|
37 |
+
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
chunspell==2.0.4
|
setup.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from setuptools import setup, find_packages
|
2 |
+
from os import path
|
3 |
+
|
4 |
+
this_directory = path.abspath(path.dirname(__file__))
|
5 |
+
with open(path.join(this_directory, 'README.md'), encoding = "utf-8") as f:
|
6 |
+
long_description = f.read()
|
7 |
+
|
8 |
+
with open('requirements.txt', encoding = "utf-8") as f:
|
9 |
+
required = [req.strip() for req in f.read().splitlines() if req.strip()]
|
10 |
+
|
11 |
+
setup(
|
12 |
+
name="klpt",
|
13 |
+
version="0.1.6",
|
14 |
+
description="Kurdish Language Processing Toolkit",
|
15 |
+
long_description=long_description,
|
16 |
+
long_description_content_type="text/markdown",
|
17 |
+
author="Sina Ahmadi",
|
18 |
+
author_email="ahmadi.sina@outlook.com",
|
19 |
+
url="https://github.com/sinaahmadi/klpt",
|
20 |
+
packages=find_packages(exclude=["tests", "cinder"]),
|
21 |
+
license="CC BY-SA 4.0",
|
22 |
+
install_requires=required,
|
23 |
+
include_package_data=True,
|
24 |
+
python_requires=">=3.6"
|
25 |
+
)
|