Word match

Filtering documents matching "Home curtain" in the description field.


This filter has similarities to both exact_match and contains. It returns a document only if it contains a word value matching the filter; meaning substrings are covered in this category but as long as they can be extracted with common word separators like the white-space (blank). For instance, the filter value "Home Gallery", can lead to extraction of a document with "Buy Home Fashion Gallery Polyester ..." in the description field as both words are explicitly seen in the text. Note that this filter is case-sensitive.

# remove `!` if running the line in a terminal
!pip install -U RelevanceAI[notebook]==2.0.0
from relevanceai import Client

You can sign up/login and find your credentials here: https://cloud.relevance.ai/sdk/api
Once you have signed up, click on the value under `Activation token` and paste it here
client = Client()
DATASET_ID = "ecommerce-sample-dataset"
ds = client.Dataset(DATASET_ID)
filter = [
        "field": "description",
        "filter_type": "word_match",
        "condition": "==",
        "condition_value": "Home curtain"
filtered_data = ds.get_documents(filters=filter, n = 20)

Did this page help you?