Language Model Action Set
Decoding RNN Scores with Labels Specified
This example is not available for the CAS programming language.
Decoding RNN Scores with Labels Specified
This example is not available for the Lua programming language.
Decoding RNN Scores with Labels Specified
This section contains Python code. For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.
The following code shows how you can use the lmDecode action to decode RNN scores that have specified labels:
langModelTable = {"name": "language_model"},
columnMap = ["A", "B", "C", "D", "E", "F", "G", "H",
"I", "J", "K", "L", "M", "N", "O", "P",
"Q", "R", "S", "T", "U", "V", "W", "X",
"Y", ".", "&", "'", "Z", " "],
blankLabel = " ",
spaceLabel = "&",
casOut = {"name": "results"},
)
You need to modify values for the table, langModelTable, and casOut parameters to fit the table of RNN scores, the language model table, and the output table, respectively, that you want to use.
You also need to modify value of the columnMap parameter to fit the list of labels that you want to specify. This optional parameter is necessary if the label information is not included in the input table that you specify in the table parameter. For example, you can load a CSV file and specify it in the table parameter rather than using an in-memory table that is created by a call to the dlScore action directly.
The lmDecode action assumes that labels that are specified in the columnMap parameter are exactly the same as labels that the score columns in the input table correspond to and that they follow the same order. For example, if the first label in the columnMap parameter is specified as "A", then the first score in every time frame ("_DL_P0_0_", "_DL_P1_0_", and so on) in the input table indicates the predicted score for label "A".
Decoding RNN Scores with Labels Specified
This example is not available for the R programming language.