Toponymy Integration
Thematic Search is designed to work out-of-the-box with a topic model generated by Toponymy. Suppose toponymy is a fitted toponymy object - then, using toponymy’s serialization class, we can turn it into a TopicDatabase:
from toponymy.serialization import TopicModel
topic_model = TopicModel.from_toponymy(toponymy, document_df=my_document_metadata)
topicdb = TopicDatabase(
SoftClusterTree(
topic_model.cluster_layers,
topic_model.cluster_tree,
sparsity_threshold = 0.1,
),
embedding_vectors = topic_model.embedding_vectors,
reduced_vectors = topic_model.reduced_vectors,
sample_df = topic_model.document_df,
topic_df = topic_model.topic_df,
)