Get alphabets from various languages and a set of functions for text manipulation
Project description
GlobalKit
Introduction
GlobalKit provides alphabets from various languages in different scripts. It can be used for language-related tasks, educational purposes and more.
Alphabets
GlobalKit contains lots of alphabets in supported languages:
- English
- Spanish
- French
- Dutch
- Portuguese
- Italian
- Finnish
- Swedish
- Norwegian
- Russian
- Ukrainian
- Polish
- Bulgarian
- digits
- and many more
All languages are instances of the Alphabet
dataclass, providing access to various string representations:
full
,full_lowercase
,full_uppercase
vowels
,vowels_lowercase
,vowels_uppercase
consonants
,consonants_lowercase
,consonants_uppercase
special
,special_lowercase
,special_uppercase
To verify the presence of special characters in a language, you can use:
has_special
If False, special
, special_lowercase
, special_uppercase
will return None
.
import GlobalKit as gk
print(gk.english.full) # abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
print(gk.french.full_lowercase) # abcdefghijklmnopqrstuvwxyzàâçéèêëîïôùûüœ
print(gk.spanish.consonants_uppercase) # BCDFGHJKLMNÑPQRSTVWXYZ
print(gk.german.vowels) # aeiouäöüAEIOUÄÖÜ
print(gk.digits) # 0123456789
print(gk.brackets) # ()[]{}<>
print(gk.space) #
print(gk.dutch.special) # None
print(gk.russian.special_uppercase) # ЪЬ
print(gk.ukrainian.has_special) # True
Creating Your Own Alphabet
You can also easily create your custom alphabet using the Alphabet
dataclass.
If the language unique characters beyond traditional vowels or consonants, you can specify them separately at the end.
from typing import Final
from GlobalKit import Alphabet
romanian: Final[Alphabet] = Alphabet('abcdefghijklmnopqrstuvwxyzăâîșț', 'aeiouyăâî', 'bcdfghjklmnpqrstvwxzșț')
print(romanian.full) # abcdefghijklmnopqrstuvwxyzăâîșțABCDEFGHIJKLMNOPQRSTUVWXYZĂÂÎȘȚ
String Manipulations
check(string, *alphabets)
checks if string
is present in any of the specified *alphabets
.
The *alphabets
must be of type Alphabet
. The variables of this type can be also imported from GlobalKit.
is_contains_spaces(string)
checks if string
contains any spaces.
is_contains_numbers(string)
checks if string
contains any numbers.
is_contains_alphabetic(string)
checks if string
contains any alphabetic letters.
is_contains_lowercase(string)
checks if string
contains any lowercase letters.
is_contains_uppercase(string)
checks if string
contains any uppercase letters.
is_contains_special(string)
checks if string
contains any special characters.
from GlobalKit import check, english, russian, italian, ukrainian
print(check('e', english)) # True
print(check('1', english, italian)) # False
print(check('h', russian, ukrainian)) # False
from GlobalKit import is_contains_spaces, is_contains_uppercase, is_contains_special
print(is_contains_spaces('Hello, world!')) # True
print(is_contains_uppercase('hello, world!')) # False
print(is_contains_special('Hello, world!')) # True
Contact
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file globalkit-1.7.tar.gz
.
File metadata
- Download URL: globalkit-1.7.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0aef521d12456a7d69c96155c9f07220cc4a1d109dfefad935b72d99b6b3af5 |
|
MD5 | 2712e4b35a0796947eda89ae3a32d334 |
|
BLAKE2b-256 | 4a8ea8e261419ae475a2cae9813c08cdaac7bc9d176b877f9502b68a42a13060 |
File details
Details for the file globalkit-1.7-py3-none-any.whl
.
File metadata
- Download URL: globalkit-1.7-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2313d31286adf1ffebd8a4befdae562807097db5eb022b89f8b846022800a26 |
|
MD5 | b435c9bee96aa151031ddac6d61189a6 |
|
BLAKE2b-256 | 589c29fcb55dd27633d7a0131fbfbcdd87db8172c6a3e05455ffba86fc8cc924 |