title: Machine learning preprocess strings to numbers based on string similarity
body: <p>I need to preprocess data into numbers in order to be able to apply ML algorithms in a dataset, but there is this feature that is almost Tree structured with strings which I have no idea how to transform. Here goes an example:</p>
  
  <pre><code>Feature -&gt; Value I would like to transform to (example):
  
  X Y Z foo -&gt; 0.5
  X Y Z bar -&gt; 0.501
  
  A B C foo -&gt; 4.1
  W B C foo -&gt; 5
  </code></pre>
  
  <p>Essentially the string would transform into a unique real number, where this number would be really close to other numbers if their strings were almost identical, giving greater weights to the first words that come up first on the String.</p>
  
  <p>My question, is there an already existing algorithm to solve this? </p>