title: IBM Speech To Text - Get alternative with highest confidence and keyword found as first result
body: <p>I'm using <a href="https://cloud.ibm.com/apidocs/speech-to-text" rel="nofollow noreferrer">IBM Speech to Text</a>. The results are OK, but I'm wondering why they are not sorted by highest confidence first. Is there a parameter returning this sorted, so that I could just pick the first alternative? Best would be to only return a result if also the passed keyword is also found.</p>
  <p>There is a <code>max_alternatives</code> parameter defaulting to 1, but also when specifying this explicitly, more than one alternative is returned.</p>
  <p>I'm currently sorting the response manually and I need no code sample for accomplishing this.</p>
  <p>JSON example:</p>
  <pre class="lang-json prettyprint-override"><code>   &quot;result&quot;: {
          &quot;result_index&quot;: 0,
          &quot;results&quot;: [
              {
                  &quot;final&quot;: true,
                  &quot;alternatives&quot;: [
                      {
                          &quot;transcript&quot;: &quot;l\u00f6schen es tut echte betroffen &quot;,
                          &quot;confidence&quot;: 0.71
                      }
                  ],
                  &quot;keywords_result&quot;: {}
              },
              {
                  &quot;final&quot;: true,
                  &quot;alternatives&quot;: [
                      {
                          &quot;transcript&quot;: &quot;sie sp\u00fcren dass eine \u00e4ra zu ende &quot;,
                          &quot;confidence&quot;: 0.91
                      }
                  ],
                  &quot;keywords_result&quot;: {}
              },
              {
                  &quot;final&quot;: true,
                  &quot;alternatives&quot;: [
                      {
                          &quot;transcript&quot;: &quot;auto fahre eins zwei drei vier &quot;,
                          &quot;confidence&quot;: 0.95
                      }
                  ],
                  &quot;keywords_result&quot;: {
                      &quot;auto&quot;: [
                          {
                              &quot;start_time&quot;: 6.31,
                              &quot;end_time&quot;: 7.19,
                              &quot;confidence&quot;: 0.99,
                              &quot;normalized_text&quot;: &quot;auto&quot;
                          }
                      ]
                  }
              }
          ]
      },
  ...
  </code></pre>