Generalize texts from payment card transactions
Project description
paytext
Python package to generalize texts from payments.
Motivation
When categorizing payments, I want to avoid categorizing the same type of expense multiple times. Often, the only information we have about a payment is the date, amount and a slightly cryptic string. For example, I recently bought some plane tickets using Ticket. On my account statement, that produced a string similar to this one: *4274 25.06 NOK 4101.00 WWW.TICKET.NO Kurs: 1.0000.
Now, when I put this payment in the Travel category, I'd like all future payments to the same vendor to be automatically put in the same category. But the next time I buy a plane ticket from them, the date and amount will be different. Also, the leading card number may be different, too. So, in order to automate the categorization, we need to generalize the text. In other words, *4274 25.06 NOK 4101.00 WWW.TICKET.NO Kurs: 1.0000 needs to become WWW.TICKET.NO. That's what this tiny package does.
Installation
Use Pipenv: pipenv install paytext
Usage
from paytext import PaymentText
payment_text: PaymentText = PaymentText(
'*4274 25.06 NOK 4101.00 WWW.TICKET.NO Kurs: 1.0000',
)
print(payment_text) # Output: '*4274 25.06 NOK 4101.00 WWW.TICKET.NO Kurs: 1.0000'
payment_text.generalize()
print(payment_text) # Output: 'WWW.TICKET.NO'
Known limitations
I've mostly had strings from transactions with Norwegian merchants and banks to work with, so this package probably won't work as well with other languages/locales. If you find strings that it doesn't handle well, please open an issue on GitHub.
Running tests
Run the command nosetests.
Upload new release to the Python Package Index
- Update version number in setup.py.
- Make new distribution:
python setup.py sdist bdist_wheel - Upload to PyPI:
twine upload dist/*
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paytext-0.0.2.tar.gz.
File metadata
- Download URL: paytext-0.0.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72e9b0edc661a9624f00f45f7f8e7ca74a26b0b76246197f3bcd221cf5f2d5e8
|
|
| MD5 |
091ba3f0bde8e05b308c2ddf5471cc15
|
|
| BLAKE2b-256 |
53dc61d75e14abb404d114baa75139686adf1b7d07535b3301c21baa0421fecc
|
File details
Details for the file paytext-0.0.2-py3-none-any.whl.
File metadata
- Download URL: paytext-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86a9f7bc740530ee9f9be0770f124568708fa8b593ed9e023da3a77a6f48be79
|
|
| MD5 |
25db2e8d910042bf4decb2c258d849a3
|
|
| BLAKE2b-256 |
1c8785128562f9438045e45e4cb53d20b6e439be0b8814f901b36b6da61d4a71
|