Find answers from the community

Updated 6 months ago

how can I see the list of keywords extracted by a SimpleKeywordTableIndex?

@kapa.ai how can I see the list of keywords extracted by a SimpleKeywordTableIndex?
k
2 comments
Please stand by @node0 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
The SimpleKeywordTableIndex in LlamaIndex uses a simple regex extractor to extract keywords from the text. However, there isn't a direct method provided to see the list of keywords extracted. The extraction process is part of the internal workings of the SimpleKeywordTableIndex.

Here is a basic example of how you might use the SimpleKeywordTableIndex:

Plain Text
from llama_index.core import SimpleKeywordTableIndex

# Assuming 'nodes' is your list of documents and 'storage_context' is your storage context
keyword_index = SimpleKeywordTableIndex(
    nodes,
    storage_context=storage_context,
    show_progress=True,
)


In this example, the SimpleKeywordTableIndex is initialized with a list of documents (nodes) and a storage_context. The show_progress=True argument means that the progress of the keyword extraction will be shown.

However, to see the actual keywords extracted, you would need to look into the source code or modify it to expose the keywords. Please refer to the LlamaIndex documentation () for more details.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord