perovskite_tokenizer
A small chemical-aware BPE encoder for perovskite formulas.
Install
pip install .
Use
from perovskite_tokenizer import PerovskiteTokenizer
tokenizer = PerovskiteTokenizer()
encoded = tokenizer.encode_formula("CsPbBr3")
batch = tokenizer.encode_formula(["CsPbBr3", "FAPbI3"])
token_ids = encoded.token_ids
features = encoded.output_tokens
payload = encoded.to_dict()
raw = tokenizer.encode_formula("CsPbBr3", add_special_tokens=False)
encode_formula accepts either one formula or a list of formulas and returns an
EncodedFormula or a list of them. encode is an alias with the same behavior.
The packaged model adds [CLS] and [END] by default. Unsupported spans become
[UNK], empty formulas raise ValueError, and an empty list returns [].
output_tokens keeps non-element tokens as vocabulary IDs. Each element symbol
is followed by its atomic number, atomic mass, electronegativity, atomic radius,
ionization energy, and average ionic radius. Before tokenization, MA, FA, and
DMA expand to CH3NH3, CH(NH2)2, and (CH3)2NH2, respectively. Missing or
non-finite numeric properties are represented by 0.0.
To use another compatible model directory:
tokenizer = PerovskiteTokenizer("path/to/model-directory")
Metadata
Release files for perovskite-tokenizer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| perovskite_tokenizer-0.1.0.tar.gz | 19.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| perovskite_tokenizer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.0 kB
Release files / perovskite_tokenizer-0.1.0.tar.gz
| Download URL | perovskite_tokenizer-0.1.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed2034ff7c5979ae1d809523fe415d906efe03f99ad64dfac303a6ed1d0b9fa1
|
|
BLAKE2b-256 checksum How to use checksums |
b99eb155e74b7c710000d34eb3989f08830abe1be938fe37114b9e8118d206a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / perovskite_tokenizer-0.1.0-py3-none-any.whl
| Download URL | perovskite_tokenizer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c61674725937a3a1c7abae6cbe676ece07ba03bf0b79e03c390e7488d8e49ddd
|
|
BLAKE2b-256 checksum How to use checksums |
91b4c05f6c3dcad5abb9869ce34078b279a42a81fc25b1793a2449325697dedd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|