"Characters" (Net Decoder)


represents a decoder that converts a sequence of probability vectors to a string of ASCII characters.


represents a decoder that converts probability vectors into a string composed of characters in the list table.


represents a decoder in which additional parameters have been specified.


  • NetDecoder[][input] applies the decoder to an input to produce an output.
  • NetDecoder[][{input1,input2,}] 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 NetDecoder["Characters"], the length of each probability vector is the number of ASCII characters, 97. For NetDecoder[{"Characters",table}], the length of each probability vector is the number of characters in table.
  • NetDecoder[][input] returns a string.
  • The mapping from probability vectors to characters specified by table can have the following forms:
  • "c1c2"map each character ci to successive available codes
    "c1c2"nmap all characters ci to code n
    "c1c2"Automaticmap all characters ci to the next available code
    n;;mspecmap characters between n and m to spec
    {spec1,spec2,}assign codes in sequence from the speci
  • The following symbolic character groups can be used in the table:
  • Automaticall printable ASCII characters, plus space, tab and newline
    LetterCharacterthe letters a through z and A through Z
    DigitCharacterthe digits 0 through 9
    WordCharacterthe union of LetterCharacter and DigitCharacter
    PunctuationCharacterall visible ASCII punctuation characters
    WhitespaceCharacterspace, tab and newline
    StartOfStringvirtual character that occurs before the beginning of the string
    EndOfStringvirtual character that occurs after the end of the string
    _any otherwise unassigned character
  • NetDecoder["Characters"] is suitable for typical English prose and consists of all printable ASCII characters, as well as tab, space and newline.
  • NetDecoder["Characters"] is equivalent to NetDecoder[{"Characters",{"\t","\n",FromCharacterCode[Range[32,126]]}}].
  • A decoder can be attached to an output port of a net by specifying "port"->NetDecoder[] when constructing the net.
  • NetDecoder[{"Characters",}][["Alphabet"]] produces a list of the characters recognized by the decoder.
  • NetEncoder[NetDecoder[{"Characters",}]] produces a NetEncoder[{"Characters",}] with the same encoding as the given decoder.


open allclose all

Basic Examples  (1)

Create a character decoder:

Click for copyable input

Create a character decoder:

Click for copyable input

Create a character decoder:

Click for copyable input

Create a character decoder:

Click for copyable input

Scope  (1)

Properties & Relations  (2)

See Also

NetDecoder  NetEncoder  NetChain  NetGraph


Related NetEncoders

Related NetDecoders