Avoid comparison to None in Tok2Vec

This commit is contained in:
Matthew Honnibal 2017-09-20 00:19:34 +02:00
parent b36a38f63d
commit 78301b2d29
1 changed files with 2 additions and 0 deletions

View File

@ -227,6 +227,8 @@ def drop_layer(layer, factor=2.):
def Tok2Vec(width, embed_size, pretrained_dims=0): def Tok2Vec(width, embed_size, pretrained_dims=0):
if pretrained_dims is None:
pretrained_dims = 0
cols = [ID, NORM, PREFIX, SUFFIX, SHAPE, ORTH] cols = [ID, NORM, PREFIX, SUFFIX, SHAPE, ORTH]
with Model.define_operators({'>>': chain, '|': concatenate, '**': clone, '+': add}): with Model.define_operators({'>>': chain, '|': concatenate, '**': clone, '+': add}):
norm = HashEmbed(width, embed_size, column=cols.index(NORM), name='embed_norm') norm = HashEmbed(width, embed_size, column=cols.index(NORM), name='embed_norm')