mirror of https://github.com/explosion/spaCy.git
Update CharacterEmbed function
This commit is contained in:
parent
6a6b09bd32
commit
00de30bcc2
|
@ -119,15 +119,16 @@ def MultiHashEmbed(
|
||||||
|
|
||||||
|
|
||||||
@registry.architectures.register("spacy.CharacterEmbed.v1")
|
@registry.architectures.register("spacy.CharacterEmbed.v1")
|
||||||
def CharacterEmbed(columns, width, rows, nM, nC, features, dropout):
|
def CharacterEmbed(width: int, rows: int, nM: int, nC: int):
|
||||||
norm = HashEmbed(
|
model = concatenate(
|
||||||
nO=width, nV=rows, column=columns.index("NORM"), dropout=dropout, seed=5
|
_character_embed.CharacterEmbed(nM=nM, nC=nC),
|
||||||
|
chain(
|
||||||
|
FeatureExtractor([NORM]),
|
||||||
|
with_array(HashEmbed(nO=width, nV=rows, column=0, seed=5))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
chr_embed = _character_embed.CharacterEmbed(nM=nM, nC=nC)
|
model.set_dim("nO", nM * nC + width)
|
||||||
with Model.define_operators({">>": chain, "|": concatenate}):
|
return model
|
||||||
embed_layer = chr_embed | features >> with_array(norm)
|
|
||||||
embed_layer.set_dim("nO", nM * nC + width)
|
|
||||||
return embed_layer
|
|
||||||
|
|
||||||
|
|
||||||
@registry.architectures.register("spacy.MaxoutWindowEncoder.v1")
|
@registry.architectures.register("spacy.MaxoutWindowEncoder.v1")
|
||||||
|
|
Loading…
Reference in New Issue