docs: function createWordDivs(transferWords) {
    // Clear collectButtonsDiv first.
    while (collectButtonsDiv.firstChild) {
      collectButtonsDiv.removeChild(collectButtonsDiv.firstChild);
    }
    datasetViz = new DatasetViz(transferRecognizer,
                                collectButtonsDiv,
                                MIN_EXAMPLES_PER_CLASS,
                                startTransferLearnButton,
                                downloadAsFileButton,
                                transferDurationMultiplier);
  
    const wordDivs = {};
    for (const word of transferWords) {
      const wordDiv = document.createElement('div');
      wordDiv.classList.add('word-div');
      wordDivs[word] = wordDiv;
      wordDiv.setAttribute('word', word);
      const button = document.createElement('button');
      button.setAttribute('isFixed', 'true');
      button.style['display'] = 'inline-block';
      button.style['vertical-align'] = 'middle';
  
      const displayWord = word === BACKGROUND_NOISE_TAG ? 'noise' : word;
  
      button.textContent = `${displayWord} (0)`;
      wordDiv.appendChild(button);
      wordDiv.className = 'transfer-word';
      collectButtonsDiv.appendChild(wordDiv);
      collectWordButtons[word] = button;
  
      let durationInput;
      if (word === BACKGROUND_NOISE_TAG) {
        // Create noise duration input.
        durationInput = document.createElement('input');
        durationInput.setAttribute('isFixed', 'true');
        durationInput.value = '10';
        durationInput.style['width'] = '100px';
        wordDiv.appendChild(durationInput);
        // Create time-unit span for noise duration.
        const timeUnitSpan = document.createElement('span');
        timeUnitSpan.setAttribute('isFixed', 'true');
        timeUnitSpan.classList.add('settings');
        timeUnitSpan.style['vertical-align'] = 'middle';
        timeUnitSpan.textContent = 'seconds';
        wordDiv.appendChild(timeUnitSpan);
      }
  
      button.addEventListener('click', async () => {
        disableAllCollectWordButtons();
        removeNonFixedChildrenFromWordDiv(wordDiv);
  
        const collectExampleOptions = {};
        let durationSec;
        let intervalJob;
        let progressBar;
  
        if (word === BACKGROUND_NOISE_TAG) {
          // If the word type is background noise, display a progress bar during
          // sound collection and do not show an incrementally updating
          // spectrogram.
          // _background_noise_ examples are special, in that user can specify
          // the length of the recording (in seconds).
          collectExampleOptions.durationSec =
              Number.parseFloat(durationInput.value);
          durationSec = collectExampleOptions.durationSec;
  
          const barAndJob = createProgressBarAndIntervalJob(wordDiv, durationSec);
          progressBar = barAndJob.progressBar;
          intervalJob = barAndJob.intervalJob;
        } else {
          // If this is not a background-noise word type and if the duration
          // multiplier is >1 (> ~1 s recoding), show an incrementally
          // updating spectrogram in real time.
          collectExampleOptions.durationMultiplier = transferDurationMultiplier;
          let tempSpectrogramData;
          const tempCanvas = document.createElement('canvas');
          tempCanvas.style['margin-left'] = '132px';
          tempCanvas.height = 50;
          wordDiv.appendChild(tempCanvas);
  
          collectExampleOptions.snippetDurationSec = 0.1;
          collectExampleOptions.onSnippet = async (spectrogram) => {
            if (tempSpectrogramData == null) {
              tempSpectrogramData = spectrogram.data;
            } else {
              tempSpectrogramData = SpeechCommands.utils.concatenateFloat32Arrays(
                  [tempSpectrogramData, spectrogram.data]);
            }
            plotSpectrogram(
                tempCanvas, tempSpectrogramData, spectrogram.frameSize,
                spectrogram.frameSize, {pixelsPerFrame: 2});
          }
        }
  
        collectExampleOptions.includeRawAudio =
            includeTimeDomainWaveformCheckbox.checked;
        const spectrogram = await transferRecognizer.collectExample(
            word, collectExampleOptions);
  
  
        if (intervalJob != null) {
          clearInterval(intervalJob);
        }
        if (progressBar != null) {
          wordDiv.removeChild(progressBar);
        }
        const examples = transferRecognizer.getExamples(word)
        const example = examples[examples.length - 1];
        await datasetViz.drawExample(
            wordDiv, word, spectrogram, example.example.rawAudio, example.uid);
        enableAllCollectWordButtons();
      });
    }
    return wordDivs;
  }