token_embedder_params = params.pop(u'token_embedders', None) if token_embedder_params is not None: # New way: explicitly specified, so use it. token_embedders = dict( (name, TokenEmbedder.from_params(subparams, vocab=vocab)) for name, subparams in list(token_embedder_params.items())) else: # Warn that the original behavior is deprecated warnings.warn( DeprecationWarning( u"the token embedders for BasicTextFieldEmbedder should now " u"be specified as a dict under the 'token_embedders' key, " u"not as top-level key-value pairs")) token_embedders = {} keys = list(params.keys()) for key in keys: embedder_params = params.pop(key) token_embedders[key] = TokenEmbedder.from_params( vocab=vocab, params=embedder_params) params.assert_empty(cls.__name__) return cls(token_embedders, embedder_to_indexer_map, allow_unmatched_keys) BasicTextFieldEmbedder = TextFieldEmbedder.register(u"basic")( BasicTextFieldEmbedder)
def test_registry_has_builtin_text_field_embedders(self): assert TextFieldEmbedder.by_name("basic").__name__ == 'BasicTextFieldEmbedder'
def test_registry_has_builtin_text_field_embedders(self): assert TextFieldEmbedder.by_name("basic").__name__ == 'BasicTextFieldEmbedder'