topic_model¶
The unsupervised learning topic model for keyword extraction.
- Contents:
- TopicModel Class:
_vectorize, fit
- class kwx.topic_model.TopicModel(num_topics=10, method='lda', bert_model=None)[source]¶
The topic model class to fit and predict given an unsupervised learning technique.
- _vectorize(text_corpus, method=None, **kwargs)[source]¶
Get vector representations from selected methods.
- Parameters:
- text_corpuslist, list of lists, or str
The text corpus over which analysis should be done.
- methodstr
The modeling technique to use.
- **kwargskeyword arguments
Keyword arguments correspoding to sentence_transformers.SentenceTransformer.encode or gensim.models.ldamulticore.LdaMulticore.
- Returns:
- vecnp.array
An array of text vectorizations.
- fit(text_corpus, method=None, m_clustering=None, **kwargs)[source]¶
Fit the topic model for selected method given the preprocessed data.
- Parameters:
- text_corpuslist, list of lists, or str
The text corpus over which analysis should be done.
- methodstr
The modeling technique to use.
- m_clusteringsklearn.cluster.object
The method that should be used to cluster.
- **kwargskeyword arguments
Keyword arguments correspoding to sentence_transformers.SentenceTransformer.encode or gensim.models.ldamulticore.LdaMulticore.
- Returns:
- selfLDA or cluster model
A fitted model.