Tidy up code comments [ci skip]

This commit is contained in:
Ines Montani 2021-01-27 12:40:03 +11:00
parent e7db07a0b9
commit fabd3a3394

View File

@ -641,16 +641,16 @@ class Language:
# specify the full config settings, which is not really viable. # specify the full config settings, which is not really viable.
if pipe_meta.default_config: if pipe_meta.default_config:
config = Config(pipe_meta.default_config).merge(config) config = Config(pipe_meta.default_config).merge(config)
# We need to create a top-level key because Thinc doesn't allow resolving
# top-level references to registered functions. Also gives nicer errors.
# The name allows components to know their pipe name and use it in the
# losses etc. (even if multiple instances of the same factory are used)
internal_name = self.get_factory_name(factory_name) internal_name = self.get_factory_name(factory_name)
# If the language-specific factory doesn't exist, try again with the # If the language-specific factory doesn't exist, try again with the
# not-specific name # not-specific name
if internal_name not in registry.factories: if internal_name not in registry.factories:
internal_name = factory_name internal_name = factory_name
# The name allows components to know their pipe name and use it in the
# losses etc. (even if multiple instances of the same factory are used)
config = {"nlp": self, "name": name, **config, "@factories": internal_name} config = {"nlp": self, "name": name, **config, "@factories": internal_name}
# We need to create a top-level key because Thinc doesn't allow resolving
# top-level references to registered functions. Also gives nicer errors.
cfg = {factory_name: config} cfg = {factory_name: config}
# We're calling the internal _fill here to avoid constructing the # We're calling the internal _fill here to avoid constructing the
# registered functions twice # registered functions twice
@ -1822,7 +1822,7 @@ class DisabledPipes(list):
def _copy_examples(examples: Iterable[Example]) -> List[Example]: def _copy_examples(examples: Iterable[Example]) -> List[Example]:
"""Make a copy of a batch of examples, copying the predicted Doc as well. """Make a copy of a batch of examples, copying the predicted Doc as well.
This is used in contexts where we need to take ownership of the examples This is used in contexts where we need to take ownership of the examples
so that they can be mutated, for instance during Language.evaluate and so that they can be mutated, for instance during Language.evaluate and
Language.update. Language.update.
""" """
return [Example(eg.x.copy(), eg.y) for eg in examples] return [Example(eg.x.copy(), eg.y) for eg in examples]