Show HN: Semantic-dictionary – A Python dictionary with semantic lookup
4 eu90h 0 6/30/2025, 1:37:56 PM github.com ↗
The idea is simple: a Python dictionary that uses semantic similarity during lookup. Say you're working on user preference extraction for an AI agent. In some cases, the model may output something like:
``` { "preference": "Database", "value": "sqlite3" } ```
but it (or a different model) may later request the user preference using a subtly different key:
``` { "action": "get_user_preference", "preference": "Database System" } ```
If we parse these responses and store them in a standard dictionary, we'll miss the similarity between the two preference keys "Database" and "Database System", whereas with SemanticDictionary, an embedding model would calculate the distance between the embedding vectors corresponding to the the preference keys prior to lookup.
I figured others may have similar needs so I thought I'd package it up for distribution. Hope you find something cool to do with this!
No comments yet