コード例 #1
0
from ._spacy_lang import SpacyLanguage
from ._fasttext_lang import FasttextLanguage
from ._countvector_lang import CountVectorLanguage
from ._tfidf_lang import TFIDFVectorLanguage
from ._bpemblang import BytePairLanguage
from ._gensim_lang import GensimLanguage

from whatlies.error import NotInstalled

try:
    from ._tfhub_lang import TFHubLanguage
    from ._convert_lang import ConveRTLanguage
    from ._sentence_encode_lang import UniversalSentenceLanguage
except ModuleNotFoundError:
    TFHubLanguage = NotInstalled("TFHubLanguage", "tfhub")
    ConveRTLanguage = NotInstalled("ConveRTLanguage", "tfhub")
    UniversalSentenceLanguage = NotInstalled("UniversalSentenceLanguage",
                                             "tfhub")

try:
    from ._hftransformers_lang import HFTransformersLanguage, LaBSELanguage
except ModuleNotFoundError:
    HFTransformersLanguage = NotInstalled("HFTransformersLanguage",
                                          "transformers")
    LaBSELanguage = NotInstalled("LaBSELanguage", "transformers")

# try:
#     from ._sense2vec_lang import Sense2VecLanguage
# except ModuleNotFoundError:
#     Sense2VecLanguage = NotInstalled("Sense2VecLanguage", "sense2vec")
コード例 #2
0
from .spacy_lang import SpacyLanguage
from .fasttext_lang import FasttextLanguage
from .countvector_lang import CountVectorLanguage
from .bpemblang import BytePairLanguage
from .bpemblang import BytePairLanguage as BytePairLang
from .gensim_lang import GensimLanguage

from whatlies.error import NotInstalled

try:
    from .convert_lang import ConveRTLanguage
    from .tfhub_lang import TFHubLanguage
except ModuleNotFoundError as e:
    TFHubLanguage = NotInstalled("TFHubLanguage", "tfhub")
    ConveRTLanguage = NotInstalled("ConveRTLanguage", "tfhub")

try:
    from .hftransformers_lang import HFTransformersLanguage
except ModuleNotFoundError as e:
    HFTransformersLanguage = NotInstalled("HFTransformersLanguage",
                                          "transformers")

try:
    from .sense2vec_lang import Sense2VecLanguage
except ModuleNotFoundError as e:
    Sense2VecLanguage = NotInstalled("Sense2VecLanguage", "sense2vec")

__all__ = [
    "SpacyLanguage",
    "Sense2VecLanguage",
    "FasttextLanguage",
コード例 #3
0
from whatlies.transformers._pca import Pca

from whatlies.transformers._noise import Noise
from whatlies.transformers._addrandom import AddRandom
from whatlies.transformers._tsne import Tsne
from whatlies.transformers._normalizer import Normalizer
from whatlies.transformers._transformer import SklearnTransformer, Transformer
from whatlies.error import NotInstalled

try:
    from whatlies.transformers._umap import Umap
except ImportError:
    Umap = NotInstalled("Umap", "umap")

__all__ = [
    "SklearnTransformer",
    "Transformer",
    "Pca",
    "Umap",
    "Tsne",
    "Noise",
    "AddRandom",
    "Normalizer",
]
コード例 #4
0
def test_import_error():
    dinosaurhead = NotInstalled("DinosaurHead", "dinosaur")
    with pytest.raises(ModuleNotFoundError) as e:
        dinosaurhead()
    assert "pip install whatlies[dinosaur]" in str(e.value)
コード例 #5
0
from whatlies.transformers.transformer import Transformer
from whatlies.transformers.pca import Pca
from whatlies.transformers.umap import Umap
from whatlies.transformers.noise import Noise
from whatlies.transformers.addrandom import AddRandom
from whatlies.transformers.tsne import Tsne
from whatlies.transformers.normalizer import Normalizer
from whatlies.error import NotInstalled

try:
    from whatlies.transformers.opentsne import OpenTsne
except ModuleNotFoundError:
    OpenTsne = NotInstalled("OpenTsne", "opentsne")

try:
    from whatlies.transformers.ivis import Ivis
except ModuleNotFoundError:
    Ivis = NotInstalled("Ivis", "ivis")

__all__ = [
    "Transformer",
    "Pca",
    "Umap",
    "Noise",
    "AddRandom",
    "Tsne",
    "OpenTsne",
    "Ivis",
    "Normalizer",
]
コード例 #6
0
from ._spacy_lang import SpacyLanguage
from ._fasttext_lang import FasttextLanguage
from ._countvector_lang import CountVectorLanguage
from ._tfidf_lang import TFIDFVectorLanguage
from ._bpemblang import BytePairLanguage
from ._gensim_lang import GensimLanguage
from ._convert_lang import ConveRTLanguage

from whatlies.error import NotInstalled

try:
    from ._tfhub_lang import TFHubLanguage
except ModuleNotFoundError as e:
    TFHubLanguage = NotInstalled("TFHubLanguage", "tfhub")

try:
    from ._sentence_encode_lang import UniversalSentenceLanguage
except ModuleNotFoundError as e:
    UniversalSentenceLanguage = NotInstalled("UniversalSentenceLanguage", "tfhub")

try:
    from ._hftransformers_lang import HFTransformersLanguage
except ModuleNotFoundError as e:
    HFTransformersLanguage = NotInstalled("HFTransformersLanguage", "transformers")

try:
    from ._sense2vec_lang import Sense2VecLanguage
except ModuleNotFoundError as e:
    Sense2VecLanguage = NotInstalled("Sense2VecLanguage", "sense2vec")

try: