title: String key phrase matching
body: <p>In levenstein <code>how are you</code>, <code>hw r u</code>, <code>how are u</code>, and <code>hw ar you</code> can be compare as same,</p>
  <p>Is there anyway i can achieved this</p>
  <p>if i have a phrase like.</p>
  <p>phrase</p>
  <blockquote>
  <p>hi, my name is john doe. I live in new york. What is your name?</p>
  </blockquote>
  <p>phrase</p>
  <blockquote>
  <p>My name is Bruce. wht's your name</p>
  </blockquote>
  <p>key phrase</p>
  <blockquote>
  <p>What is your name</p>
  </blockquote>
  <p>response</p>
  <blockquote>
  <p>my name is batman.</p>
  </blockquote>
  <p>im getting the input from user.I have a table with a list of possible request with response. for example the user will ask about 'its name', is there a way i can check if a sentence has a key phrase like <code>What is your name</code> and if its found it will return the possible response</p>
  <p>like</p>
  <pre><code>phrase = ' hi, my name is john doe. I live in new york. What is your name?'
   
  //I know this one will work
  if (strpos($phrase,&quot;What is your name&quot;) !== false) {
      return $response;
  }
  
  //but what if the user mistype it 
  if (strpos($phrase,&quot;Wht's your name&quot;) !== false) {
      return $response;
  }
  </code></pre>
  <p>is there i way to achieve this. levenstein works perfect only if the lenght of strings are not that long with the compared string.</p>
  <p>like</p>
  <blockquote>
  <p>hi,wht's your name</p>
  <p>my name is batman.</p>
  </blockquote>
  <p>but if it so long</p>
  <blockquote>
  <p>hi, my name is john doe. I live in new york. What is your name?</p>
  </blockquote>
  <p>its not working well. if there are shorter phrase, it will identify the shorter phrase that have a shorter distance and return a wrong response</p>
  <p>i was thinking another way around is to check some key phrase. so any idea to achieve this one?</p>
  <p>i was working on something like this but maybe there is a better and proper way i think</p>
  <pre><code>$samplePhrase = 'hi, im spongebob, i work at krabby patty. i love patties. Whts your name my friend';
  
  $keyPhrase = 'What is your name';
  </code></pre>
  <ol>
  <li>get first character of <code>keyPhrase</code>. That would be 'W' iterate through</li>
  <li><code>$samplePhrase</code> characters and compare to first character of <code>keyPhrase</code></li>
  <li><code>h,i, ,i,m, ,s,p</code> etc. . .</li>
  <li>if <code>keyPhrase.char = samplePhrase.currentChar</code></li>
  <li>get keyPhrase.length</li>
  <li>get samplePhrase.currentChar index</li>
  <li>get substring of samplePhrase base on the currentChar index to keyPhrase.length</li>
  <li>the first it will get would be  <code>work at krabby pa</code></li>
  <li>compare <code>work at krabby pa</code> to $keyPhrase ('What is your name') using levenstiens distance</li>
  <li>and to check it better use semilar_text.
  11.if not equal and distance is to big  repeat process.</li>
  </ol>