Answers.Body: <p>If this is a simple syntax comparison, neural networks is not the best way to achieve this.</p>
  <p>If it's semantic comparison, then you can take a look at models used in the <a href="https://nlp.stanford.edu/projects/snli/" rel="nofollow noreferrer">SNLI</a> dataset for example.</p>
  <p>From your question, it looks like just a syntax comparison.</p>
  <p>Consider the 2 sentences :</p>
  <blockquote>
  <p>She likes playing guitar</p>
  <p>She likes listening guitar</p>
  </blockquote>
  <p>The 2 sentences have almost the same words, but the meaning is different.</p>
  <p>Now consider these 2 sentences :</p>
  <blockquote>
  <p>The bird is taking a bath in the fountain</p>
  <p>Birdie wash himself with water in public place</p>
  </blockquote>
  <p>These 2 sentences have almost no words in common, but the meaning are very similar.</p>
  <hr />
  <p>So if your use case need to return a high-score for the first example, give up neural network (it is possible, but pointless).</p>
  <p>If your use case need to return a high-score in the second example, take a look at <a href="https://nlp.stanford.edu/projects/snli/" rel="nofollow noreferrer">SNLI</a> leaderboards, there is plenty of models that can works.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-22T23:36:01.280Z
Answers.LastActivityDate: 2018-10-22T23:36:01.280Z
Answers.LastEditDate: 2020-06-17T09:57:20.710Z
Answers.UserDisplayName: Astariul
Body: <p>The Levenshtein algorithm and some ratio and proportion may handle this use case.</p>
  
  <blockquote>
    <p>Based on the pre-defined sequence of statements, such as "I have a dog", "I own a car" and many more, I must determine if an another input statement such as "I have a cat" is the same or how much percentage does the input statement is most likely equal to the pre-defined statements.</p>
  </blockquote>
  
  <p>For Example:</p>
  
  <blockquote>
    <p>Predefined statements: "I have a dog", "I own a car", "You think you are smart"</p>
  </blockquote>
  
  <p>Input statements and results:</p>
  
  <blockquote>
    <p>I have a dog - 100% (because it has exact match), I have a cat - ~75% (because it was almost the same except for the animal, think - ~10% (because it was just a small part of the third statement), bottle - 0% (because it has no match at all)</p>
  </blockquote>
  
  <p>The requirement is that TensorFlow be used rather than Java, which is the language I know, so any help with what to look at to get started would be helpful.</p>
  
  <p>My plan was to use the predefined statements as the train_data, and to output only the accuracy during the prediction, but I don't know what model to use. Please, guide me with the architecture and I will try to implement it.</p>
  
Tags: <machine-learning><natural-language-processing><tensorflow>
Title: Which model should I use to determine the similarity between predefined sentences and new sentences?
UserDisplayName: alona
ThreadText: # Which model should I use to determine the similarity between predefined sentences and new sentences?
  
  (Asked by: username_0 on 2018-10-22)
  
  The Levenshtein algorithm and some ratio and proportion may handle this use case.
  
  > Based on the pre-defined sequence of statements, such as "I have a dog", "I own a car" and many more, I must determine if an another input statement such as "I have a cat" is the same or how much percentage does the input statement is most likely equal to the pre-defined statements.
  
  For Example:
  
  > Predefined statements: "I have a dog", "I own a car", "You think you are smart"
  
  Input statements and results:
  
  > I have a dog - 100% (because it has exact match), I have a cat - ~75% (because it was almost the same except for the animal, think - ~10% (because it was just a small part of the third statement), bottle - 0% (because it has no match at all)
  
  The requirement is that TensorFlow be used rather than Java, which is the language I know, so any help with what to look at to get started would be helpful.
  
  My plan was to use the predefined statements as the train\_data, and to output only the accuracy during the prediction, but I don't know what model to use. Please, guide me with the architecture and I will try to implement it.
  
  **Tags:** machine-learning, natural-language-processing, tensorflow
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-22. Score: 2
  
  If this is a simple syntax comparison, neural networks is not the best way to achieve this.
  
  If it's semantic comparison, then you can take a look at models used in the [SNLI](https://nlp.stanford.edu/projects/snli/) dataset for example.
  
  From your question, it looks like just a syntax comparison.
  
  Consider the 2 sentences :
  
  > She likes playing guitar
  >
  > She likes listening guitar
  
  The 2 sentences have almost the same words, but the meaning is different.
  
  Now consider these 2 sentences :
  
  > The bird is taking a bath in the fountain
  >
  > Birdie wash himself with water in public place
  
  These 2 sentences have almost no words in common, but the meaning are very similar.
  
  ---
  
  So if your use case need to return a high-score for the first example, give up neural network (it is possible, but pointless).
  
  If your use case need to return a high-score in the second example, take a look at [SNLI](https://nlp.stanford.edu/projects/snli/) leaderboards, there is plenty of models that can works.
  
  
  ---
  
  