This release is a pre-release and may not be stable for production use.
[](https://travis-ci.org/enioluwa23/wordplay) [](https://pypi.org/project/wordplay/) [](https://pypi.org/project/wordplay/) [](https://pypi.org/project/wordplay/)
Python package for word searching utilities.
Using a convenient API, you can filter a set of strings with detailed criteria. There are also more scrabble-like features such as getting all anagrams of a word.
## Install
```bash
pip install wordplay
```
## Background
I initially built this as an algorithm solely to help my endeavors in word games such as Scrabble. It was useful for finding word combinations in every type of situation. However, I realized it could be used for many other purposes, such as filtering email addresses, phone numbers and any set of data really. So I decided to decouple the API from my personal use.
## Usage
Words are stored in a `Dictionary` object. Initialize the dictionary with a [`set`](https://docs.python.org/2/library/stdtypes.html#set) of strings (there are no restrictions on what the string can contain) or `Dictionary()` with no arguments to use the word set sourced from [here](https://github.com/dwyl/english-words). In the future, I will amass a couple of word lists and make them options for initializing the dictionary.
If you do want restrictions on the string, see the documentation for the [`Utils`](https://enioluwa23.github.io/wordplay/api/utils/) module. For complex query parameters, you can use a `Criteria` object. The class uses the builder pattern, making it easy to construct search parameters.
Here is a an example file:
```python
from __future__ import print_function
from wordplay.dictionary import Dictionary
from wordplay.criteria import Criteria
def main():
dictionary = Dictionary()
result = dictionary.get_words_with_any_letters('diction', 6)
print(result)
# ['diotic', 'dition', 'indico', 'indict', 'nidiot', 'odinic']
result = dictionary.get_words_with_any_letters('pox')
print(result)
# ['o', 'op', 'ox', 'p', 'po', 'pox', 'x']
result = dictionary.get_anagrams('aekst')
print(result)
# ['keats', 'skate', 'skeat', 'stake', 'steak', 'takes', 'teaks']
print('car' in dictionary) # Dictionary is directly iterable
# True
criteria = Criteria()
criteria.begins_with('c').ends_with('s').contains('or')
criteria.contains_at(('o', 2), ('r', 4)).size_is(10)
result = dictionary.get_words(criteria)
print(result)
# ['corrosives', 'correlates', 'corrugates']
if __name__ == '__main__':
main()
```
For further example usage see the [Documentation](https://enioluwa23.github.io/wordplay/).
To run tests, use `pytest`.
## Documentation
[API Reference](https://enioluwa23.github.io/wordplay/)
## License
[Apache Software License](https://github.com/enioluwa23/wordplay/blob/master/LICENSE)
Metadata
Release files for wordplay 1.0.0a4
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 |
|---|---|---|---|---|
| wordplay-1.0.0a4.tar.gz | 2.5 MB | Without provenance | Details for wordplay-1.0.0a4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wordplay-1.0.0a4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for wordplay-1.0.0a4-py2.py3-none-any.whl |
Total release size: 4.9 MB
Release files / wordplay-1.0.0a4.tar.gz
| Download URL | wordplay-1.0.0a4.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30895143461510e571c16bae44625000baf1715b1db3d04a16347909322032b6
|
|
BLAKE2b-256 checksum How to use checksums |
30a00a692aa8236fd8b3fb71fa77eda7e6d33148996622c5833c3437f5376f07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|
Release files / wordplay-1.0.0a4-py2.py3-none-any.whl
| Download URL | wordplay-1.0.0a4-py2.py3-none-any.whl |
|---|---|
| Size | 2.5 MB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ffdf96d4c30f46e278238b1fa3b08cd92a1631f306985f13f4e1e31d0a7e1998
|
|
BLAKE2b-256 checksum How to use checksums |
43f7404a6cdf6bc13071fbf1f5af0063b23f5690ceedba9ab27c38ba795ea8e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|
Security for wordplay 1.0.0a4
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.