本文整理匯總了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
示例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)
示例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
示例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
示例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)