# QUESE
"Quese" allows you implement in an easy way a Search Algoritm, based on Embeddings and Semantic Similarity, in your Python apps.
The module provides a function called search_by_embeddings(), with several params to customize the searching process.
## INSTALLATION
You can install "quese" with pip:
```bash
pip install quese
```
## EXAMPLE WITH BY
```
from quese import search_by_embeddings
data_ = [
{
"title": "UX Designer",
"tags": "Designer"
},
{
"title": "Senior Accounter",
"tags": "Accounter"
},
{
"title": "Product Manager",
"tags": "Managment"
}
]
results = search_by_embeddings(data=data_, query="Manager", by="title")
#Results will return a LIST with the dictionaries whose title is Semantically Similar to the query: "Manager", so in this case, the last dictionary: "Product Manager".
print(results)
```
## PARAMS
#### __data__:
It's the first param, it's **REQUIRED**, and it must be a **list of dictionaries**.
#### __query__:
It's the second param, it's **REQUIRED** as well, and it represent the query you want to pass.<br>
Type: **string**
#### __by__:
It's the third param, it's **only REQUIRED if you don't pass the "template" param**, and it represent the value of your dictionaries that you are searching for.<br>
For example, if you want to search in a list of products, your "by" param could be the prop "name" of each product.<br>
Type: **string**
#### __template__:
It's **only REQUIRED if you don't pass the "by" param**, and it's similar to "by", but allow you to search by a customized string for each dictionary in your data list.<br>
For example, if you want to search in a list of products, your "template" param could be a string like this: "{name}, seller: {seller}".
Notice that you have to define your props **between "{}"**, as you can see in the example with the variables **"name"** and **"seller"**.<br>
Type: **string**
#### __accuracy__:
It's **optional**, and it represents the similarity that the dictionary must have with the query to be considered a result.<br>
**The default value is 0.4**, wich works good with almost all the models. However, if you want to change it, we don't recommend to set vary high values or very low values, the range **0.3-0.6** should be enought.<br>
Type: **float number between 0-1**
#### __model__:
It's **optional**, and it represents the **embedding model** you want to use.<br>
The default model is **'sentence-transformers/all-MiniLM-L6-v2'**. You can use an other model like 'sentence-transformers/all-mpnet-base-v2', but take care because **if the model don't work with sentence-transformers this package will not work with it**.<br>
Type: **string**
## EXAMPLE WITH TEMPLATE
```
from quese import search_by_embeddings
data_ = [
{
"title": "UX Designer",
"tags": "Designer"
},
{
"title": "Senior Accounter",
"tags": "Accounter"
},
{
"title": "Product Manager",
"tags": "Managment"
}
]
results = search_by_embeddings(data=data_, query="Manager", template="{title}, {tags}")
#Results will return a LIST with the dictionaries whose title and tags are Semantically Similar to the query: "Manager", so in this case, the last dictionary: "Product Manager".
print(results)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "quese",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "searching,search,embeddings,intelligent search,similarity search,embedding search,sentence transformer search,searcher,semantic similarity,sentence similarity",
"author": "Arnau Canela",
"author_email": "arnau.canela22@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3b/64/52c337925df94f1dfb71f80007c3a03a8b170e26dfa2515f6cdd6f3c7dc9/quese-0.1.2.tar.gz",
"platform": null,
"description": "# QUESE\r\n\r\n\"Quese\" allows you implement in an easy way a Search Algoritm, based on Embeddings and Semantic Similarity, in your Python apps.\r\nThe module provides a function called search_by_embeddings(), with several params to customize the searching process.\r\n\r\n## INSTALLATION\r\n\r\nYou can install \"quese\" with pip:\r\n\r\n```bash\r\npip install quese\r\n```\r\n## EXAMPLE WITH BY\r\n```\r\nfrom quese import search_by_embeddings\r\n\r\ndata_ = [\r\n {\r\n \"title\": \"UX Designer\",\r\n \"tags\": \"Designer\"\r\n },\r\n {\r\n \"title\": \"Senior Accounter\",\r\n \"tags\": \"Accounter\" \r\n },\r\n {\r\n \"title\": \"Product Manager\",\r\n \"tags\": \"Managment\" \r\n }\r\n]\r\n\r\nresults = search_by_embeddings(data=data_, query=\"Manager\", by=\"title\")\r\n#Results will return a LIST with the dictionaries whose title is Semantically Similar to the query: \"Manager\", so in this case, the last dictionary: \"Product Manager\".\r\nprint(results)\r\n```\r\n## PARAMS\r\n\r\n#### __data__:\r\nIt's the first param, it's **REQUIRED**, and it must be a **list of dictionaries**.\r\n\r\n#### __query__:\r\nIt's the second param, it's **REQUIRED** as well, and it represent the query you want to pass.<br>\r\nType: **string**\r\n\r\n#### __by__:\r\nIt's the third param, it's **only REQUIRED if you don't pass the \"template\" param**, and it represent the value of your dictionaries that you are searching for.<br>\r\nFor example, if you want to search in a list of products, your \"by\" param could be the prop \"name\" of each product.<br>\r\nType: **string**\r\n\r\n#### __template__:\r\nIt's **only REQUIRED if you don't pass the \"by\" param**, and it's similar to \"by\", but allow you to search by a customized string for each dictionary in your data list.<br>\r\nFor example, if you want to search in a list of products, your \"template\" param could be a string like this: \"{name}, seller: {seller}\".\r\nNotice that you have to define your props **between \"{}\"**, as you can see in the example with the variables **\"name\"** and **\"seller\"**.<br>\r\nType: **string**\r\n\r\n#### __accuracy__:\r\nIt's **optional**, and it represents the similarity that the dictionary must have with the query to be considered a result.<br>\r\n**The default value is 0.4**, wich works good with almost all the models. However, if you want to change it, we don't recommend to set vary high values or very low values, the range **0.3-0.6** should be enought.<br> \r\nType: **float number between 0-1**\r\n\r\n#### __model__:\r\nIt's **optional**, and it represents the **embedding model** you want to use.<br>\r\nThe default model is **'sentence-transformers/all-MiniLM-L6-v2'**. You can use an other model like 'sentence-transformers/all-mpnet-base-v2', but take care because **if the model don't work with sentence-transformers this package will not work with it**.<br>\r\nType: **string**\r\n\r\n## EXAMPLE WITH TEMPLATE\r\n```\r\nfrom quese import search_by_embeddings\r\n\r\ndata_ = [\r\n {\r\n \"title\": \"UX Designer\",\r\n \"tags\": \"Designer\"\r\n },\r\n {\r\n \"title\": \"Senior Accounter\",\r\n \"tags\": \"Accounter\" \r\n },\r\n {\r\n \"title\": \"Product Manager\",\r\n \"tags\": \"Managment\" \r\n }\r\n]\r\n\r\nresults = search_by_embeddings(data=data_, query=\"Manager\", template=\"{title}, {tags}\")\r\n#Results will return a LIST with the dictionaries whose title and tags are Semantically Similar to the query: \"Manager\", so in this case, the last dictionary: \"Product Manager\".\r\nprint(results)\r\n```\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Package that make easier the searching process in pyhton, through Embeddings and Semantic Similarity",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [
"searching",
"search",
"embeddings",
"intelligent search",
"similarity search",
"embedding search",
"sentence transformer search",
"searcher",
"semantic similarity",
"sentence similarity"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3b6452c337925df94f1dfb71f80007c3a03a8b170e26dfa2515f6cdd6f3c7dc9",
"md5": "5b47f7d92227282167f73d2d836c6f18",
"sha256": "e6e5fa32872dbd5209a65b35590262b35a9f042fd6b25af52e7be73c699de8ad"
},
"downloads": -1,
"filename": "quese-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "5b47f7d92227282167f73d2d836c6f18",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3936,
"upload_time": "2023-08-31T19:49:38",
"upload_time_iso_8601": "2023-08-31T19:49:38.567039Z",
"url": "https://files.pythonhosted.org/packages/3b/64/52c337925df94f1dfb71f80007c3a03a8b170e26dfa2515f6cdd6f3c7dc9/quese-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-31 19:49:38",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "quese"
}