This repository has been archived by the owner on May 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
134 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Examples | ||
|
||
This folder contains very few examples for *tmtoolkit*. The majority of examples is available as Jupyter Notebooks as part of the [documentation](https://tmtoolkit.readthedocs.io/). You may download these notebooks from the [documentation source](https://github.com/WZBSocialScienceCenter/tmtoolkit/tree/master/doc/source) and run them on your computer. | ||
This folder contains very few examples for *tmtoolkit*. The majority of examples is available as Jupyter Notebooks as | ||
part of the [documentation](https://tmtoolkit.readthedocs.io/). You may download these notebooks from | ||
the [documentation source](https://github.com/WZBSocialScienceCenter/tmtoolkit/tree/master/doc/source) and run them | ||
on your computer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,14 @@ | |
The data for the debates comes from offenesparlament.de, see https://github.com/Datenschule/offenesparlament-data. | ||
This examples requires that you have installed tmtoolkit with the recommended set of packages and have installed a | ||
German language model for spaCy: | ||
pip install -U "tmtoolkit[recommended]" | ||
python -m tmtoolkit setup de | ||
For more information, see the installation instructions: https://tmtoolkit.readthedocs.io/en/latest/install.html | ||
Markus Konrad <[email protected]> | ||
June 2019 / Feb. 2022 | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,14 @@ | |
An example for topic modeling with LDA with focus on the new plotting functions in `tmtoolkit.corpus.visualize` and | ||
in `tmtoolkit.topicmod.visualize`. | ||
This examples requires that you have installed tmtoolkit with the recommended set of packages plus "lda" and have | ||
installed an English language model for spaCy: | ||
pip install -U "tmtoolkit[recommended,lda]" | ||
python -m tmtoolkit setup en | ||
For more information, see the installation instructions: https://tmtoolkit.readthedocs.io/en/latest/install.html | ||
.. codeauthor:: Markus Konrad <[email protected]> | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
.. codeauthor:: Markus Konrad <[email protected]> | ||
""" | ||
|
||
import math | ||
import os.path | ||
import random | ||
|
@@ -20,8 +21,8 @@ | |
import pytest | ||
from hypothesis import given, strategies as st, settings | ||
|
||
if not find_spec('spacy'): | ||
pytest.skip("skipping tmtoolkit.corpus tests (spacy not installed)", allow_module_level=True) | ||
if any(find_spec(pkg) is None for pkg in ('spacy', 'bidict', 'loky')): | ||
pytest.skip("skipping tmtoolkit.corpus tests (required packages not installed)", allow_module_level=True) | ||
|
||
import spacy | ||
from spacy.tokens import Doc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Tests for importing optional tmtoolkit.corpus module. | ||
.. codeauthor:: Markus Konrad <[email protected]> | ||
""" | ||
|
||
from importlib.util import find_spec | ||
|
||
import pytest | ||
|
||
|
||
def test_import_corpus(): | ||
if any(find_spec(pkg) is None for pkg in ('spacy', 'bidict', 'loky')): | ||
with pytest.raises(RuntimeError, match='^the required package'): | ||
from tmtoolkit import corpus | ||
with pytest.raises(RuntimeError, match='^the required package'): | ||
from tmtoolkit.corpus import Corpus | ||
else: | ||
from tmtoolkit import corpus | ||
from tmtoolkit.corpus import Corpus | ||
import spacy | ||
import bidict | ||
import loky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters