No project description provided
Project description
Polars-Phonetics: A Polars Plugin for Phonetic Algorithms
Initial Release: Double-Metaphone Algorithm
Welcome to Polars-Phonetics, a Polars plugin for phonetic algorithms built in Rust for Python users. This initial release includes the Double-Metaphone algorithm only.
Installation
To use Polars-Phonetics, install the polars-phonetics package using pip:
pip install polars-phonetics
Example Usage
Here's an example of how to use the double_metaphone function in Python Polars:
import polars as pl
from polars_phonetics import dmetaphone
# Create a sample dataframe
df = pl.DataFrame(
{
"words": ["hello", "this", "is", "the", "phonetics", "plugin", "in", "polars", None],
}
)
print(df)
# This would output:
# shape: (9, 1)
# ┌───────────┐
# │ words │
# │ --- │
# │ str │
# ╞═══════════╡
# │ hello │
# │ this │
# │ is │
# │ the │
# │ phonetics │
# │ plugin │
# │ in │
# │ polars │
# │ null │
# └───────────┘
# Apply the double_metaphone function to the 'words' column
result = df.with_columns(dmetaphone=dmetaphone("words"))
print(result)
# shape: (9, 2)
# ┌───────────┬──────────────┐
# │ words ┆ dmetaphone │
# │ --- ┆ --- │
# │ str ┆ str │
# ╞═══════════╪══════════════╡
# │ hello ┆ [HL, HL] │
# │ this ┆ [0S, TS] │
# │ is ┆ [AS, AS] │
# │ the ┆ [0, T] │
# │ phonetics ┆ [FNTK, FNTK] │
# │ plugin ┆ [PLJN, PLKN] │
# │ in ┆ [AN, AN] │
# │ polars ┆ [PLRS, PLRS] │
# │ null ┆ null │
# └───────────┴──────────────┘
Acknowledgments
I would like to extend my gratitude to:
- Marco Gorelli for his comprehensive guide on writing Polars plugins.
- The team behind the Rust crate rphonetic.
Future Releases
Future releases of Polars-Phonetics will include additional phonetic algorithms. Stay tuned for updates!
Contributing
If you'd like to contribute to Polars-Phonetics, please open an issue or pull request on this repository. I welcome any feedback, bug reports, or new algorithm implementations.
License
Polars-Phonetics is licensed under the MIT License. See the LICENSE file for details.
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 Distributions
Built Distribution
File details
Details for the file polars_phonetics-0.1.0-cp38-abi3-win_amd64.whl
.
File metadata
- Download URL: polars_phonetics-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1451ef626522b4da691e281fcece938cdb85e5cf47ef29d85c80a77ba280ed79 |
|
MD5 | d1f0c21448728da4576f5c621866b071 |
|
BLAKE2b-256 | 3bfee64f300cc19f4a031261a94563b6daf38ca718eecde5f69ada05cd046617 |