A language processing tool for Sinhalese (සිංහල).
Update 2020.11.01: Fixed pypi package. Use 'pip install sinling' to install sinling directly from repository.
Update 2020.08.16: Add pypi package @ https://pypi.org/project/sinling/.
Update 2020.08.16: Integrated Part of speech tagger and stemmer tool.
Update 2019.07.21: This tool no longer requires java to run sinhala tokenizer. All java code is ported to Python implementation for convenience.
Versions
The current release is 0.3.6, and the usage examples below describe its API.
Sinling 0.4 will be a redesign with a new API, and it will not be backward compatible with 0.3.
The 0.3 API (SinhalaTokenizer, SinhalaStemmer, POSTagger, word_joiner, word_splitter and preprocess) will be removed in 0.4 without a deprecation period.
If your code uses the 0.3 API, pin the version before 0.4 is released:
pip install "sinling<0.4"
or, in requirements.txt:
sinling<0.4
Installation
Run the following command in your virtualenv to install this package.
pip install sinling
How to use
Sinhala Tokenizer
from sinling import SinhalaTokenizer
tokenizer = SinhalaTokenizer()
sentence = '...' # your sentence
tokenizer.tokenize(sentence)
Sinhala Stemmer (Experimental)
from sinling import SinhalaStemmer
stemmer = SinhalaStemmer()
word = '...' # your sentence
stemmer.stem(word) # returns (base, suffix)
The stemmer looks words up in a stem dictionary first and falls back to stripping the longest known suffix.
Pass SinhalaStemmer(use_dictionary=False) to use suffix stripping only.
Please cite sinhala-stemmer if you are using this implementation.
Part-of-Speech Tagger
from sinling import SinhalaTokenizer, POSTagger
tokenizer = SinhalaTokenizer()
document = '...' # may contain multiple sentences
tokenized_sentences = [tokenizer.tokenize(f'{ss}.') for ss in tokenizer.split_sentences(document)]
tagger = POSTagger()
pos_tags = tagger.predict(tokenized_sentences)
Word Joiner (Morphological Joiner)
from sinling import preprocess, word_joiner
w1 = preprocess('මුනි')
w2 = preprocess('උතුමා')
results = word_joiner.join(w1, w2)
# Returns a list of possible results after applying join rules ['මුනිතුමා', ...]
Word Splitter (Morphological Splitter) / corpus based - experimental
from sinling import word_splitter
word = '...'
results = word_splitter.split(word)
# Returns a dict containing debug information, base word and affix
Visit here to see some sample splits.
Contributions
- Contact
wayasas.13@cse.mrt.ac.lkif you would like to contribute to this project.
License
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
Metadata
Release files for sinling 0.3.7
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 |
|---|---|---|---|---|
| sinling-0.3.7.tar.gz | 19.6 MB | Without provenance | Details for sinling-0.3.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sinling-0.3.7-py3-none-any.whl | Python 3 | none | any | Details for sinling-0.3.7-py3-none-any.whl |
Total release size: 39.7 MB
Release files / sinling-0.3.7.tar.gz
| Download URL | sinling-0.3.7.tar.gz |
|---|---|
| Size | 19.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ec8e1b8595d2d6d6292ead3805dd4eb0627442d74d4465682e39b23bbc33717
|
|
BLAKE2b-256 checksum How to use checksums |
968f597a9ff8a3c00817c3385ac7086b1e6ca43d9a076506e3c53cdb01b3937a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sinling-0.3.7-py3-none-any.whl
| Download URL | sinling-0.3.7-py3-none-any.whl |
|---|---|
| Size | 20.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
207ffa5d2399d8bc97e260bf06c8adef7fef6f890b777f814137623bf653c760
|
|
BLAKE2b-256 checksum How to use checksums |
681a88d5ca82fb84a2f8c87480f8c90a2bc53be96385bf5e751c4d9d2e10eb0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sinling 0.3.7
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.