Name | creolenltk JSON |
Version |
1.0.10
JSON |
| download |
home_page | https://github.com/bjclayton/CreoleNLTK.git |
Summary | A Python library for Creole text preprocessing |
upload_time | 2025-07-11 05:28:44 |
maintainer | None |
docs_url | None |
author | John Clayton |
requires_python | >=3.6 |
license | Copyright 2024 John Clayton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. |
keywords |
python
nlp
creole
natural language processing
text preprocessing
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# CreoleNLTK: Creole Natural Language Toolkit
[](LICENSE)
[](https://www.python.org/downloads/)
[](https://travis-ci.org/jcblanc2/CreoleNLTK)
CreoleNLTK is a Python library designed for preprocessing Creole text. The library includes various functions and tools to prepare text data for natural language processing (NLP) tasks. It provides functionality for cleaning, tokenization, lowercasing, stopword removal, contraction to expansion, and spelling checking.
## Features
- **Spelling Check:** Identify and correct spelling errors.
- **Part-of-Speech Tagging:** Assign part-of-speech tags (e.g., noun, verb, adjective) to words in Creole sentences.
- **Number to Words (Cardinal and Ordinal):** Convert numbers to their word forms
- **Contraction to Expansion:** Expand contractions in the text.
- **Stopword Removal:** Remove common words that do not contribute much to the meaning.
- **Tokenization:** Break the text into words or tokens.
- **Text Cleaning:** Remove unwanted characters and clean the text.
## Installation
You can install CreoleNLTK using pip:
```bash
pip install creolenltk
```
## Usage
### Spelling Checker
```python
from creolenltk.spelling_checker import SpellingChecker
# Initialize the spelling checker
spell_checker = SpellingChecker()
# Correct spelling errors in a word
corrected_word = spell_checker.correction('òtgraf')
print(f"Original Word: òtgraf, Corrected Word: {corrected_word}") # òtograf
```
### Number to Words (Cardinal and Ordinal)
```python
from creolenltk.num2word import CreoleNumberConverter
# Initialize the number converter
num_converter = CreoleNumberConverter()
# Convert numbers to cardinal words
print(num_converter.number_to_word(2024)) # de mil venntkat
# Convert numbers to ordinal words
print(num_converter.number_to_ordinal(21)) # venteyinyèm
# Replace numbers in text with cardinal form
text = "Mwen genyen 3 chat ak 21 ti chen."
converted = num_converter.replace_cardinals_in_text(text)
print(converted) # Mwen genyen twa chat ak venteyen ti chen.
```
### Part-of-Speech Tagging
```python
from creolenltk.pos_tagger import PosTagger
# Initialize the POS tagger (uses the trained Creole model)
tagger = PosTagger()
sentence = "Mwen renmen Ayiti anpil."
tags = tagger.tag(sentence)
print(tags) # [('Mwen', 'PRON'), ('renmen', 'VERB'), ('Ayiti', 'PROPN'), ('anpil', 'ADV'), ('.', 'PUNCT')]
sentence2 = "Poukisa panse yo chanje?"
tags2 = tagger.tag(sentence2)
print(tags2) # [('Poukisa', 'ADV'), ('panse', 'VERB'), ('yo', 'PRON'), ('chanje', 'VERB'), ('?', 'PUNCT')]
```
### Contraction to Expansion
```python
from creolenltk.contraction_expansion import ContractionToExpansion
# Initialize the contraction expander
contraction_expander = ContractionToExpansion()
# Expand contractions in a sentence
original_sentence = "L'ap manje. m'ap rete lakay mw."
expanded_sentence = contraction_expander.expand_contractions(original_sentence)
print(f"Original Sentence: {original_sentence}\nExpanded Sentence: {expanded_sentence}") # li ap manje. mwen ap rete lakay mwen.
```
### Stopword Removal
```python
from creolenltk.stopword import Stopword
# Initialize the stopword handler
stopword_handler = Stopword()
# Remove stopwords from a sentence
sentence_with_stopwords = "Sa se yon fraz tès ak kèk stopwords nan Kreyòl Ayisyen."
sentence_without_stopwords = stopword_handler.remove_stopwords(sentence_with_stopwords)
print(f"Sentence with Stopwords: {sentence_with_stopwords}\nWithout Stopwords: {sentence_without_stopwords}") # fraz tès stopwords Kreyòl Ayisyen.
```
### Tokenizer
```python
from creolenltk.tokenizer import Tokenizer
# Initialize the tokenizer
tokenizer = Tokenizer()
# Tokenize a sentence
sentence = "Sa se yon fraz senp"
tokens = tokenizer.word_tokenize(sentence, expand_contractions=True, lowercase=True)
print(f"Sentence: {sentence}\nTokens: {tokens}") # ["sa", "se", "yon", "fraz", "senp"]
```
For more detailed usage and examples, refer to the [documentation](https://pypi.org/project/creolenltk/).
## License
MIT licensed. See the bundled [LICENSE](LICENSE) file for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/bjclayton/CreoleNLTK.git",
"name": "creolenltk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "python, nlp, creole, natural language processing, text preprocessing",
"author": "John Clayton",
"author_email": "John Clayton <jclaytonblanc@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/5a/af/8d239b6fb9668070fda61873ae0fa1ddfa01dd48946738693f7456202186/creolenltk-1.0.10.tar.gz",
"platform": null,
"description": "# CreoleNLTK: Creole Natural Language Toolkit\n\n[](LICENSE)\n[](https://www.python.org/downloads/)\n[](https://travis-ci.org/jcblanc2/CreoleNLTK)\n\nCreoleNLTK is a Python library designed for preprocessing Creole text. The library includes various functions and tools to prepare text data for natural language processing (NLP) tasks. It provides functionality for cleaning, tokenization, lowercasing, stopword removal, contraction to expansion, and spelling checking.\n\n## Features\n\n- **Spelling Check:** Identify and correct spelling errors.\n- **Part-of-Speech Tagging:** Assign part-of-speech tags (e.g., noun, verb, adjective) to words in Creole sentences.\n- **Number to Words (Cardinal and Ordinal):** Convert numbers to their word forms \n- **Contraction to Expansion:** Expand contractions in the text.\n- **Stopword Removal:** Remove common words that do not contribute much to the meaning.\n- **Tokenization:** Break the text into words or tokens.\n- **Text Cleaning:** Remove unwanted characters and clean the text.\n\n## Installation\n\nYou can install CreoleNLTK using pip:\n\n```bash\npip install creolenltk\n```\n\n## Usage\n\n### Spelling Checker\n\n```python\nfrom creolenltk.spelling_checker import SpellingChecker\n\n# Initialize the spelling checker\nspell_checker = SpellingChecker()\n\n# Correct spelling errors in a word\ncorrected_word = spell_checker.correction('\u00f2tgraf')\n\nprint(f\"Original Word: \u00f2tgraf, Corrected Word: {corrected_word}\") # \u00f2tograf\n```\n\n### Number to Words (Cardinal and Ordinal)\n\n```python\nfrom creolenltk.num2word import CreoleNumberConverter\n\n# Initialize the number converter\nnum_converter = CreoleNumberConverter()\n\n# Convert numbers to cardinal words\nprint(num_converter.number_to_word(2024)) # de mil venntkat\n\n# Convert numbers to ordinal words\nprint(num_converter.number_to_ordinal(21)) # venteyiny\u00e8m\n\n# Replace numbers in text with cardinal form\ntext = \"Mwen genyen 3 chat ak 21 ti chen.\"\nconverted = num_converter.replace_cardinals_in_text(text)\nprint(converted) # Mwen genyen twa chat ak venteyen ti chen.\n```\n\n### Part-of-Speech Tagging\n\n```python\nfrom creolenltk.pos_tagger import PosTagger\n\n# Initialize the POS tagger (uses the trained Creole model)\ntagger = PosTagger()\n\nsentence = \"Mwen renmen Ayiti anpil.\"\ntags = tagger.tag(sentence)\nprint(tags) # [('Mwen', 'PRON'), ('renmen', 'VERB'), ('Ayiti', 'PROPN'), ('anpil', 'ADV'), ('.', 'PUNCT')]\n\nsentence2 = \"Poukisa panse yo chanje?\"\ntags2 = tagger.tag(sentence2)\nprint(tags2) # [('Poukisa', 'ADV'), ('panse', 'VERB'), ('yo', 'PRON'), ('chanje', 'VERB'), ('?', 'PUNCT')]\n```\n\n### Contraction to Expansion\n\n```python\nfrom creolenltk.contraction_expansion import ContractionToExpansion\n\n# Initialize the contraction expander\ncontraction_expander = ContractionToExpansion()\n\n# Expand contractions in a sentence\noriginal_sentence = \"L'ap manje. m'ap rete lakay mw.\"\nexpanded_sentence = contraction_expander.expand_contractions(original_sentence)\n\nprint(f\"Original Sentence: {original_sentence}\\nExpanded Sentence: {expanded_sentence}\") # li ap manje. mwen ap rete lakay mwen.\n```\n\n### Stopword Removal\n\n```python\nfrom creolenltk.stopword import Stopword\n\n# Initialize the stopword handler\nstopword_handler = Stopword()\n\n# Remove stopwords from a sentence\nsentence_with_stopwords = \"Sa se yon fraz t\u00e8s ak k\u00e8k stopwords nan Krey\u00f2l Ayisyen.\"\nsentence_without_stopwords = stopword_handler.remove_stopwords(sentence_with_stopwords)\n\nprint(f\"Sentence with Stopwords: {sentence_with_stopwords}\\nWithout Stopwords: {sentence_without_stopwords}\") # fraz t\u00e8s stopwords Krey\u00f2l Ayisyen.\n```\n\n### Tokenizer\n\n```python\nfrom creolenltk.tokenizer import Tokenizer\n\n# Initialize the tokenizer\ntokenizer = Tokenizer()\n\n# Tokenize a sentence\nsentence = \"Sa se yon fraz senp\"\ntokens = tokenizer.word_tokenize(sentence, expand_contractions=True, lowercase=True)\n\nprint(f\"Sentence: {sentence}\\nTokens: {tokens}\") # [\"sa\", \"se\", \"yon\", \"fraz\", \"senp\"]\n```\n\nFor more detailed usage and examples, refer to the [documentation](https://pypi.org/project/creolenltk/).\n\n## License\n\nMIT licensed. See the bundled [LICENSE](LICENSE) file for more details.\n",
"bugtrack_url": null,
"license": "Copyright 2024 John Clayton\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.",
"summary": "A Python library for Creole text preprocessing",
"version": "1.0.10",
"project_urls": {
"Homepage": "https://github.com/bjclayton/CreoleNLTK.git"
},
"split_keywords": [
"python",
" nlp",
" creole",
" natural language processing",
" text preprocessing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "02e6b9b30495372fcd2758f0a30758e903ebe5163178c0da9988bed4ebab492d",
"md5": "65d5dc2bc3afe3c3bd72bc336c5de135",
"sha256": "b3bac9aaaddb5759346f1fa2366f84704f3cb86f8075fc6d4533447af7c4cda9"
},
"downloads": -1,
"filename": "creolenltk-1.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65d5dc2bc3afe3c3bd72bc336c5de135",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17398141,
"upload_time": "2025-07-11T05:28:41",
"upload_time_iso_8601": "2025-07-11T05:28:41.017736Z",
"url": "https://files.pythonhosted.org/packages/02/e6/b9b30495372fcd2758f0a30758e903ebe5163178c0da9988bed4ebab492d/creolenltk-1.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5aaf8d239b6fb9668070fda61873ae0fa1ddfa01dd48946738693f7456202186",
"md5": "062d1224a9c6e139bbd71970840fc816",
"sha256": "7d1a4364388b8210eded0030199c7848a01ee1a3cc718c3034a351b6862c4322"
},
"downloads": -1,
"filename": "creolenltk-1.0.10.tar.gz",
"has_sig": false,
"md5_digest": "062d1224a9c6e139bbd71970840fc816",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 17398784,
"upload_time": "2025-07-11T05:28:44",
"upload_time_iso_8601": "2025-07-11T05:28:44.068174Z",
"url": "https://files.pythonhosted.org/packages/5a/af/8d239b6fb9668070fda61873ae0fa1ddfa01dd48946738693f7456202186/creolenltk-1.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-11 05:28:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bjclayton",
"github_project": "CreoleNLTK",
"github_not_found": true,
"lcname": "creolenltk"
}