Download BERTopic/tests/test_plotting/test_dynamic.py from kisejin/TopicModelingRepo: direct link, hf CLI and curl.
- Browser
- Download file 790 Bytes
-
https://huggingface.co/kisejin/TopicModelingRepo/resolve/5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/tests/test_plotting/test_dynamic.py
- Command line
-
hf download hf://kisejin/TopicModelingRepo@5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/tests/test_plotting/test_dynamic.py
-
curl -L -o test_dynamic.py https://huggingface.co/kisejin/TopicModelingRepo/resolve/5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/tests/test_plotting/test_dynamic.py
790 Bytes
| import copy | |
| import pytest | |
| def test_dynamic(model, documents, request): | |
| topic_model = copy.deepcopy(request.getfixturevalue(model)) | |
| timestamps = [i % 10 for i in range(len(documents))] | |
| topics_over_time = topic_model.topics_over_time(documents, timestamps) | |
| fig = topic_model.visualize_topics_over_time(topics_over_time) | |
| assert len(fig.to_dict()["data"]) == len(set(topic_model.topics_)) - topic_model._outliers | |