({{, (RefLink[NetDecoder, paclet:ref/NetDecoder])["Characters"] 
represents a decoder that converts a sequence of probability vectors to a string of ASCII characters.}, {, (RefLink[NetDecoder, paclet:ref/NetDecoder])[{"Characters",table}]
represents a decoder that converts probability vectors into a string composed of characters in the list table.}, {, (RefLink[NetDecoder, paclet:ref/NetDecoder])[{"Characters",table,"param"->value,…}]
represents a decoder in which additional parameters have been specified.}})

OpenersNotesSection(Spacer1)Details

(RefLink[NetDecoder, paclet:ref/NetDecoder])[…][input] applies the decoder to an input to produce an output.

(RefLink[NetDecoder, paclet:ref/NetDecoder])[…][{(Subscript[input, 1]),(Subscript[input, 2]),…}] applies the decoder to a list of inputs to produce a list of outputs.

The input to the decoder input is either a vector of probabilities or a sequence of probability vectors. Each probability vector sums to 1. For (RefLink[NetDecoder, paclet:ref/NetDecoder])["Characters"], the length of each probability vector is the number of ASCII characters, 97. For (RefLink[NetDecoder, paclet:ref/NetDecoder])[{"Characters",table}], the length of each probability vector is the number of characters in table.

(RefLink[NetDecoder, paclet:ref/NetDecoder])[…][input] returns a string.

The mapping from probability vectors to characters specified by table can have the following forms:

The following symbolic character groups can be used in the table:

(RefLink[NetDecoder, paclet:ref/NetDecoder])["Characters"] is suitable for typical English prose and consists of all printable ASCII characters, as well as tab, space and newline.

(RefLink[NetDecoder, paclet:ref/NetDecoder])["Characters"] is equivalent to (RefLink[NetDecoder, paclet:ref/NetDecoder])[{"Characters",{"\t","\n",(RefLink[FromCharacterCode, paclet:ref/FromCharacterCode])[(RefLink[Range, paclet:ref/Range])[32,126]]}}].

A decoder can be attached to an output port of a net by specifying "port"->(RefLink[NetDecoder, paclet:ref/NetDecoder])[…] when constructing the net.

(RefLink[NetDecoder, paclet:ref/NetDecoder])[{"Characters",…}][["Alphabet"]] produces a list of the characters recognized by the decoder.

(RefLink[NetEncoder, paclet:ref/NetEncoder])[(RefLink[NetDecoder, paclet:ref/NetDecoder])[{"Characters",…}]] produces a (RefLink[NetEncoder, paclet:ref/NetEncoder])[{"Characters",…}] with the same encoding as the given decoder.

(RefLink[NetDecoder, paclet:ref/NetDecoder])[…][data,prop] can be used to calculate a specific property for the input data.

When a "Characters" decoder is attached to a net, net[data,prop] or net[data,"oport"->prop] can be used to calculate a specific property of the decoded output.

The "Characters" decoder only supports the bypass property. Setting prop to (RefLink[None, paclet:ref/None]) bypasses decoding and returns the input to the decoder.

OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Create a character decoder:

dec=NetDecoder[{"Characters",{"a","b"}}]

Decode a sequence of probabilities:

dec[{{0.1,0.9},{0.55,0.45},{0.2,0.8}}]

OpenersExampleSection1(Spacer1)Scope  (2)

Create a character decoder:

dec=NetDecoder[{"Characters",{"a","b"}}]

Create a (RefLink[NumericArray, paclet:ref/NumericArray]) representing a sequence of probability vectors:

na=NumericArray[{{0.1,0.9},{0.55,0.45},{0.2,0.8}},"Real32"]

Decode the sequence of probabilities:

dec[na]

The decoder maps across a batch of examples:

dec[{na,na}]

Create a character decoder:

dec=NetDecoder["Characters"]

Decode a sentence from a one-hot vector representation:

codes={75,72,79,79,82,3,90,82,85,79,71};
matrix=UnitVector[97,#]&/@codes;
ArrayPlot[matrix]

dec[matrix]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

Extract the list of characters recognized by the default "Characters" decoder:

dec=NetDecoder["Characters"]

dec[["Alphabet"]]//InputForm

Produce a (RefLink[NetEncoder, paclet:ref/NetEncoder]) from a (RefLink[NetDecoder, paclet:ref/NetDecoder]):

dec=NetDecoder[{"Characters","ATCG"}]

NetEncoder[dec]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[NetDecoder, paclet:ref/NetDecoder])  ▪  (RefLink[NetEncoder, paclet:ref/NetEncoder])  ▪  (RefLink[NetChain, paclet:ref/NetChain])  ▪  (RefLink[NetGraph, paclet:ref/NetGraph])}, {Related Net Encoders:  (RefLink[Characters, paclet:ref/netencoder/Characters])  ▪  (RefLink[Tokens, paclet:ref/netencoder/Tokens])  ▪  (RefLink[Class, paclet:ref/netencoder/Class])  ▪  (RefLink[BPESubwordTokens, paclet:ref/netencoder/BPESubwordTokens])}, {Related Net Decoders:  (RefLink[Tokens, paclet:ref/netdecoder/Tokens])  ▪  (RefLink[Class, paclet:ref/netdecoder/Class])  ▪  (RefLink[BPESubwordTokens, paclet:ref/netdecoder/BPESubwordTokens])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Neural Networks in the Wolfram Language, paclet:tutorial/NeuralNetworksOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Neural Networks, paclet:guide/NeuralNetworks])}})}})