title: How to add punctuation to Web Speech API?
body: <p>I am using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API" rel="nofollow noreferrer">Web speech api</a> and was wondering if there was any documentation  on how to detect or add punctuation (commas or periods).</p>
  
  <p>My code currently looks something like this:</p>
  
  <pre><code>var recognition = new webkitSpeechRecognition();
  recognition.continuous = true;
  recognition.interimResults = true;
  
  recognition.onstart = function() {
    recognizing = true;
  };
  
  recognition.onend = function() {
    recognizing = false;
    if (ignoreOnend) {
      return;
    }
    if (!finalTranscript) {
      return;
    }
  };
  
  recognition.onresult = function(event) {
    var interimTranscript = '';
    for (var i = event.resultIndex; i &lt; event.results.length; ++i) {
      if (event.results[i].isFinal) {
        finalTranscript += event.results[i][0].transcript;
      } else {
        interimTranscript += event.results[i][0].transcript;
      }
    }
    finalTranscript = capitalize(finalTranscript);
    finalSpan.innerHTML = linebreak(finalTranscript);
    interimSpan.innerHTML = linebreak(interimTranscript);
  };
  </code></pre>