当前位置: 首页>>代码示例>>Python>>正文


Python spacy.__version__方法代码示例

本文整理汇总了Python中spacy.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python spacy.__version__方法的具体用法?Python spacy.__version__怎么用?Python spacy.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spacy的用法示例。


在下文中一共展示了spacy.__version__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_morph_exception

# 需要导入模块: import spacy [as 别名]
# 或者: from spacy import __version__ [as 别名]
def test_morph_exception() -> None:
    assert spacy.__version__ <= SPACY_VERSION

    lang = RO
    text = "Ce mai faci?"

    download(lang=lang)

    try:
        nlp = load(lang=lang)
        assert nlp._meta["lang"] == f"udpipe_{lang}"
        doc = nlp(text)
    except ValueError:
        nlp = load(lang=lang, ignore_tag_map=True)
        assert nlp._meta["lang"] == f"udpipe_{lang}"
        doc = nlp(text)

    assert doc 
开发者ID:TakeLab,项目名称:spacy-udpipe,代码行数:20,代码来源:test_spacy_udpipe.py

示例2: __init__

# 需要导入模块: import spacy [as 别名]
# 或者: from spacy import __version__ [as 别名]
def __init__(self, language: str = "en_core_web_sm", rule_based: bool = False) -> None:
        # we need spacy's dependency parser if we're not using rule-based sentence boundary detection.
        self.spacy = get_spacy_model(language, parse=not rule_based, ner=False, pos_tags=False)
        if rule_based:
            # we use `sentencizer`, a built-in spacy module for rule-based sentence boundary detection.
            # depending on the spacy version, it could be called 'sentencizer' or 'sbd'
            sbd_name = "sbd" if spacy.__version__ < "2.1" else "sentencizer"
            if not self.spacy.has_pipe(sbd_name):
                sbd = self.spacy.create_pipe(sbd_name)
                self.spacy.add_pipe(sbd) 
开发者ID:allenai,项目名称:allennlp,代码行数:12,代码来源:sentence_splitter.py

示例3: get_report

# 需要导入模块: import spacy [as 别名]
# 或者: from spacy import __version__ [as 别名]
def get_report(self):
        """
        Generates a report about the pipeline class's configuration
        :return: str
        """

        # Get data about these components
        learner_name, learner = self.get_learner()
        tokenizer = self.get_tokenizer()
        feature_extractor = self.get_feature_extractor()
        spacy_metadata = self.spacy_pipeline.meta

        # Start the report with the name of the class and the docstring
        report = f"{type(self).__name__}\n{self.__doc__}\n\n"

        report += f"Report created at {time.asctime()}\n\n"
        report += f"MedaCy Version: {medacy.__version__}\nSpaCy Version: {spacy.__version__}\n"
        report += f"SpaCy Model: {spacy_metadata['name']}, version {spacy_metadata['version']}\n"
        report += f"Entities: {self.entities}\n"
        report += f"Constructor arguments: {self._kwargs}\n\n"

        # Print data about the feature overlayers
        if self.overlayers:
            report += "Feature Overlayers:\n\n"
            report += "\n\n".join(o.get_report() for o in self.overlayers) + '\n\n'

        # Print data about the feature extractor
        report += f"Feature Extractor: {type(feature_extractor).__name__} at {inspect.getfile(type(feature_extractor))}\n"
        report += f"\tWindow Size: {feature_extractor.window_size}\n"
        report += f"\tSpaCy Features: {feature_extractor.spacy_features}\n"

        # Print the name and location of the remaining components
        report += f"Learner: {learner_name} at {inspect.getfile(type(learner))}\n"

        if self.get_tokenizer():
            report += f"Tokenizer: {type(tokenizer).__name__} at {inspect.getfile(type(tokenizer))}\n"
        else:
            report += f"Tokenizer: spaCy pipeline default\n"

        return report 
开发者ID:NLPatVCU,项目名称:medaCy,代码行数:42,代码来源:base_pipeline.py

示例4: __init__

# 需要导入模块: import spacy [as 别名]
# 或者: from spacy import __version__ [as 别名]
def __init__(self):
        global lemminflect
        import lemminflect
        self.name = 'LemmInflect'
        self.version_string = 'LemmInflect version: %s' % lemminflect.__version__
        # Force loading dictionary and model so lazy loading doesn't show up in run times
        lemmas = lemminflect.getAllLemmas('testing', 'VERB')
        lemmas = lemminflect.getAllLemmasOOV('xxtesting', 'VERB')

    # Use only the dictionary methods 
开发者ID:bjascob,项目名称:LemmInflect,代码行数:12,代码来源:20_TestLemmatizer.py

示例5: get_default_conda_env

# 需要导入模块: import spacy [as 别名]
# 或者: from spacy import __version__ [as 别名]
def get_default_conda_env():
    """
    :return: The default Conda environment for MLflow Models produced by calls to
             :func:`save_model()` and :func:`log_model()`.
    """
    import spacy

    return _mlflow_conda_env(
        additional_conda_deps=None,
        additional_pip_deps=[
            "spacy=={}".format(spacy.__version__),
        ],
        additional_conda_channels=None) 
开发者ID:mlflow,项目名称:mlflow,代码行数:15,代码来源:spacy.py


注:本文中的spacy.__version__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。