Skip to main content

Python Search Query Finder

General rule-based function that extracts a search query from spoken text given search terms to look out for.

Some possible search terms include 'to', 'on', 'for', 'about'

e.g. 'do a google search on Python.'
    search term = on
    query found = Python

This function also ignores false search_term_indicators such as 'like to', 'love to', 'want to'

e.g. 'I want to do a google search on Python'
     false search term = to
     false search term indicator = want
     actual search term = on
     query found = Python

Thus, in the above example, the function will correctly ignore 'do a google search on Python' as a possible search query and will capture 'Python' as the right query.

Other exmaples of use cases:

'Send an email to Alex'
  search term = to
  query found = Alex
 Arguments: <string> spoken_text, <list> feature_patterns=[],
            <list> search_terms=['to', 'on', 'for', 'search'], <list> false_search_term_indicators=['like', 'love', 'want', 'ready']
Return type: <string> spoken_text (now stripped down to only the search query.)

Installation

pip install search_query_finder

Example usage

from search_query_finder import find_query
# You can call the function, passing only the sentence.
query1 = find_query.find_query("do a google search on Python programming.")
# expected result = 'Python programming.'

# You can also call the function, passing the sentence along with the search_terms you would like the function to search for. By default, the search terms are set to be = ['to', 'on', 'for', 'search']
query2 = find_query.find_query("send an email to Alex", search_terms=["to"])
# expected result = 'Alex'

# You can also call the function, passing the sentence along with the false_search_term_indicators you want. By default, these are set to be = ['like', 'love', 'want', 'ready']
query3 = find_query.find_query("I would like to do a google search for the python programming language", false_search_term_indicators=["like"])
# expected result = 'the python programming language'

Release files for search-query-finder 0.0.12

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

Source distribution (sdist)

Source distribution for search-query-finder 0.0.12
File Size Uploaded
search_query_finder-0.0.12.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for search-query-finder 0.0.12
File Interpreter ABI Platform
search_query_finder-0.0.12-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / search_query_finder-0.0.12.tar.gz

Download URL search_query_finder-0.0.12.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ebc342d16cd434f4f0437806df99a146144d3a858d5258d511e00df2327406ed
BLAKE2b-256 checksum
How to use checksums
b6e0096e5b4937aa691f0de6dfd6a300f0207feeb9e17482b7b7674f0ee1c6fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

Release files / search_query_finder-0.0.12-py3-none-any.whl

Download URL search_query_finder-0.0.12-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bff465d5fa040bb273c5b45e17e677bb6c5d15e8be0baac223db34c0fb61134
BLAKE2b-256 checksum
How to use checksums
1375409f120024333764e560ccd50933d019daff626609204698390da74243de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 release files

0.0.1

2 release files

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