title: Not able to compare speech to text string with the input string from user
body: <p>I am taking voice input from user and trying to compare that with a input string but not able to compare speech to text string with the input string from user..</p>
  <pre class="lang-py prettyprint-override"><code>import speech_recognition as sr
      r = sr.Recognizer()
      mic = sr.Microphone(device_index=0)
  
  print(&quot;Start speaking&quot;)
  with mic as source:
      audio = r.listen(source)
  
  try:
       result = r.recognize_google(audio)
  except sr.RequestError:
       exit(&quot;API is unreachable&quot;)
  except sr.UnknownValueError:
       exit(&quot;Unable to recognize speech! Were you speaking&quot;)
  
  result = r.recognize_google(audio)
  with open('my_speech.txt',mode ='w') as file:
       file.write(result)
  f = open('my_speech.txt', 'r')
  content = f.read()
  print(content)
  content2=str(content)
  
  word = input(&quot;Enter a word you want to search in file: &quot;)
  
  if(content2!=word):
         print(&quot;word not found&quot;)
  else:
         print(&quot;word found&quot;)
  </code></pre>