Return top n words for a specific topic and their c-TF-IDF scores. Arguments: topic: A specific topic for which you want its representation full: If True, returns all different forms of topic representations for a topic, including aspects R
(self, topic: int, full: bool = False)
| 1620 | return self.topic_representations_ |
| 1621 | |
| 1622 | def get_topic(self, topic: int, full: bool = False) -> Union[Mapping[str, Tuple[str, float]], bool]: |
| 1623 | """Return top n words for a specific topic and their c-TF-IDF scores. |
| 1624 | |
| 1625 | Arguments: |
| 1626 | topic: A specific topic for which you want its representation |
| 1627 | full: If True, returns all different forms of topic representations |
| 1628 | for a topic, including aspects |
| 1629 | |
| 1630 | Returns: |
| 1631 | The top n words for a specific word and its respective c-TF-IDF scores |
| 1632 | |
| 1633 | Examples: |
| 1634 | ```python |
| 1635 | topic = topic_model.get_topic(12) |
| 1636 | ``` |
| 1637 | """ |
| 1638 | check_is_fitted(self) |
| 1639 | if topic in self.topic_representations_: |
| 1640 | if full: |
| 1641 | representations = {"Main": self.topic_representations_[topic]} |
| 1642 | aspects = {aspect: representations[topic] for aspect, representations in self.topic_aspects_.items()} |
| 1643 | representations.update(aspects) |
| 1644 | return representations |
| 1645 | else: |
| 1646 | return self.topic_representations_[topic] |
| 1647 | else: |
| 1648 | return False |
| 1649 | |
| 1650 | def get_topic_info(self, topic: int | None = None) -> pd.DataFrame: |
| 1651 | """Get information about each topic including its ID, frequency, and name. |