The eCommerce bot helps you to identify the most relevant product items according to your search query. The retrieval is based on the list of the ranking measures. In addition, when retrieved candidates are not specific enough, the bot asks you to provide additional information to specify the search (as on the example below).
Here is a simple example of interaction:
>> Hello, I am a new eCommerce bot.
I will help you to find products that you are looking for.
Please type your query in plain text.
x::bluetooth speaker
>> This is what I found for you:
- Bluetooth Speaker (Black & Red)
- Bose SoundLink Bluetooth Speaker III
- Bose SoundLink Mini Bluetooth Speaker
- Bose SoundLink Mini Bluetooth Speaker
- JBL Flip Wireless Bluetooth Speaker (Black)
To specify the search, please choose a Brand: JBL, Soundsworks
x::JBL
>> The following items satisfy your request
- JBL Flip Wireless Bluetooth Speaker (Black)
- JBL Flip Wireless Bluetooth Speaker (Black)
- JBL Charge Portable Indoor/Outdoor Bluetooth Speaker | Black
from deeppavlov import configs
from deeppavlov.core.commands.infer import build_model
ecommerce = build_model(configs.ecommerce_skill.tfidf_retrieve, load_trained=True)
result = ecommerce(['bluetooth speaker'], [[]], [{}])
If some required packages are missing, install all the requirements by running in command line:
python -m deeppavlov install tfidf_retrieve
python -m deeppavlov install bleu_retrieve
BLEU-based [1] eCommerce bot :config:`ecommerce_skill/bleu_retrieve.json`
TfIdf-based eCommerce bot :config:`ecommerce_skill/tfidf_retrieve.json`
To interact with a pretrained model run:
python -m deeppavlov interact <path_to_config> [-d]
where <path_to_config>
is a path to config file.
You can also train your own model by specifying config file and running:
python -m deeppavlov train <path_to_config>
The eCommerce bot configuration consists of the following parts:
- dataset_reader
- dataset_iterator
- chainer
You can use your own dataset_reader, dataset_iterator for specific data.
chainer - pipeline manager
in
- pipeline input data: an userquery
, a dialogstate
and dialog historyhistory
.out
- pipeline output data:response
the structure with retrieved product items.
ecommerce_skill_bleu - ranker
min_similarity
: lower boundary for textual similarity ranker (by default 0.5).min_entropy
: lower boundary for entropy (by default 0.5). If the entropy is less thanmin_entropy
, it's omitted from the specification list.entropy_fields
: the specification attributes of the catalog items (by default "Size", "Brand", "Author", "Color", "Genre").preprocess
: text preprocessing component.
Input:
query
: a plain text user query.history
: dialog history.state
: dialog state.
Returns:
items
: product items in sorted order fromstart
index tillend
index (taken from the dialog state).entropies
: specification attributes with corresponding values in sorted order.confidence
: similarity confidence.state
: dialog state.
Note
About 500 Mb on disc required for eCommerce bot with BLEU-based ranker.
chainer - pipeline manager
in
- pipeline input data: an userquery
, a dialogstate
and dialog historyhistory
.out
- pipeline output data:response
the structure with retrieved product items.
ecommerce_skill_tfidf - ranker
min_similarity
: lower boundary for textual similarity ranker (by default 0.5).min_entropy
: lower boundary for entropy (by default 0.5). If the entropy is less thanmin_entropy
, it's omitted from the specification list.entropy_fields
: the specification attributes of the catalog items (by default "Size", "Brand", "Author", "Color", "Genre").
Input:
query
: a plain text user query.history
: dialog history.state
: dialog state.
Returns:
items
: product items in sorted order fromstart
index tillend
index (taken from the dialog state).entropies
: specification attributes with corresponding values in sorted order.confidence
: similarity confidence.state
: dialog state.
Note
About 130 Mb on disc required for eCommerce bot with TfIdf-based ranker
[1] | Papineni, Kishore, et al. "BLEU: a method for automatic evaluation of machine translation." Proceedings of the 40th annual meeting on association for computational linguistics. Association for Computational Linguistics, 2002. |