Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Tutorial: Incorrect variable name in tutorial code snippet #13051

@wongjoel

Description

@wongjoel

There is a incorrect snippet of code for the Scala tutorial for the character LSTM

[https://github.com/apache/incubator-mxnet/blob/master/docs/tutorials/scala/char_lstm.md#prepare-the-data]

Code currently reads:

def buildVocab(path: String): Map[String, Int] = {
  val content = readContent(dataPath).split("\n")
  var idx = 1 // 0 is left for zero padding
  var theVocab = Map[String, Int]()
  for(line <- content) {
    for(char <- line) {
      val key = s"$char"
      if(!theVocab.contains(key)) {
        theVocab = theVocab + (key -> idx)
        idx += 1
      }
    }
  }
  theVocab
}

The dataPath variable in this code snippet is not defined, and should instead be the parameter path as it is in the example code https://github.com/apache/incubator-mxnet/blob/71d66218395e2a6e5d8ee082929ab3d3d964b002/scala-package/examples/src/main/scala/org/apache/mxnetexamples/rnn/Utils.scala#L33-L47

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions