Create Your Own Index

Upload

The upload accepts a list of dictionaries (JSON records format). Our only requirement is a plain-text field named doc which contains the text you want to analyze. You can optionally provide a doc_id identifier for each document; if you do not provide one, we will generate one for you.

If you specify a doc_id which already exists, you can append metadata to the document (by leaving the doc field blank), or overwrite the doc content for that document (by placing new content in the doc field.)

from sturdystats.index import Index

# Create or access an existing index
index = Index(name="my_index", API_key="your_api_key")

# Upload Documents
docs = [{
    "doc": "Operator: Welcome, everyone. Thank you for standing by for the Alphabet Fourth Quarter 2023 Earnings Conference Call ...", 
    "date": "2024-01-30", 
    "quarter": "2024Q1",
    "author": "GOOG"
    },
    ...
]
index.upload(docs)

## Train Index
index.train(fast=True)

# Query documents
topic_df = index.topicSearch()