Skip to main content

Receipt2vec

Framework по переводу строки товара из чека в векторное представление. Это способ формирования признаков (feature enginering) на которых пользователи смогут строить свои модели - модели оттока, рекомендации и тп. В частности, обмениваться признаками с партнёрами.

Установка

python3 -m venv venv
source venv/bin/activate
pip install receipt2vec

Использование

CLI

Перевод тестового файла в формате CSV.

$ receipt2vec --help
usage: receipt2vec [-h] -i INPUT -o OUTPUT [--batch BATCH] [--gpu GPU]
                   [--bpe BPE] [--encoder ENCODER]
                   [--write_header WRITE_HEADER] [--use_columns USE_COLUMNS]

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Path to input file with receipts and prices
  -o OUTPUT, --output OUTPUT
                        Path to output file with results
  --batch BATCH         Batch size [Default 128]
  --gpu GPU             Num of gpu. If cpu use -1 [Default -1]
  --bpe BPE             Path to bpe model file. If None - used default model
                        [Default None]
  --encoder ENCODER     Name of encoder model. If None - used default model
                        [Default None]
  --write_header WRITE_HEADER
                        Write header to the output file [0 or 1. Default 0]
  --use_columns USE_COLUMNS
                        A string of columns separated by ',' from the input
                        file that will be written to the output file

Пример входного файла

Файл должен сожержать 2 колонки с заголовками - receipt[srting],price[float]

$ head items_.csv 
receipt,price
"Бутылка 1,0 Литр",8.0
Борщ с фасолью и сметаной,46.0
БЗМЖ СЫР PRETTO МОЦАРЕЛЛА ДЛЯ ,109.9
"БАЛТИКА №3 Пиво свет фильтр паст 4,8",52.99
Аккумулятор холода  800 млLTAK0048,139.9

Использование

$ receipt2vec -i items_.csv -o items.vec

Импорт модели

>>> from receipt2vec.model import Receipt2vecEncoder
>>> model = Receipt2vecEncoder()
>>> vec = model('БАЛТИКА №3 Пиво свет фильтр паст 4,8', 52.99)
>>> print(vec.shape)
torch.Size([256])

Metadata

Release files for receipt2vec 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for receipt2vec 0.1
File Size Uploaded Provenance Actions
receipt2vec-0.1.tar.gz 59.2 MB Without provenance Details for receipt2vec-0.1.tar.gz

Release files / receipt2vec-0.1.tar.gz

Download URL receipt2vec-0.1.tar.gz
Size 59.2 MB
Tags Source
SHA-256 checksum
How to use checksums
f19005e02d553e54257aa61f6e8f02e5d05049e7027addeb14b56b4937219a1a
BLAKE2b-256 checksum
How to use checksums
6659fbb81e472d4b9bbdfd9259e728f1ba5fbc9e7117829df61c40e0156b97d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

Security for receipt2vec 0.1

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.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page