Answers.Body: <p>If you have lots of training data, ANN's (deep learning) could quite possibly get you there.  But I have a hunch you might also get some mileage out of using something like a <a href="https://en.wikipedia.org/wiki/Rule_induction" rel="nofollow noreferrer">rule induction</a> approach.  Maybe something like <a href="https://en.wikipedia.org/wiki/CN2_algorithm" rel="nofollow noreferrer">CN2</a>. I'd suggest at least reading up on those and see if you can see a way to apply that to your system.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-22T14:54:28.820Z
Answers.Text: The thing is that I don't have enough training data for ANN's, but I'm starting to think that I will need it. Since it will require a big amount of effort, I was waiting to be sure that getting this big set of data is the solution.
Answers.UserDisplayName: bleand
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2017-07-21T19:57:51.353Z
Answers.LastActivityDate: 2020-03-14T19:02:49.773Z
Answers.LastEditDate: 2020-03-14T19:02:49.773Z
Answers.UserDisplayName: mindcrime
Answers.Body: <p>If you have collection of data or information, then you would like to ask questions about this data and machine should answer you.</p>
  
  <p>I think you need first, data mining to export the meaning and relations in this data, then you can build your expert system that will answer you.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-20T15:00:33.660Z
Answers.Text: I do have some training data. Do you know any particular algorithm that could work?
Answers.UserDisplayName: bleand
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-20T13:28:07.983Z
Answers.LastActivityDate: 2017-07-20T13:28:07.983Z
Answers.UserDisplayName: Mohammad Alabed
Answers.Body: <p>Neural networks are the one thing I would <em>not</em> recommend. Your problem fits into the domain of <a href="https://en.wikipedia.org/wiki/First-order_logic" rel="nofollow noreferrer">predicate calculus</a>, with some basic pattern recognition of the input sentences (assuming you only accept a certain type of sentences). You can do that without the need for masses of data.</p>
  
  <p>First, transform your statement into a canonical representation, probably using first-order logic and simple pattern matching/string matching. For example,</p>
  
  <pre><code>I own a dog 
  
  X own/owns a/an Y  
  
  owns(I, dog)
  </code></pre>
  
  <p>Here you have a pattern "<em>X</em> own(s) a(n) <em>Y</em>", which you recognise in your user input. You then have a predicate <em>owns(X, Y)</em>, which you add to your database of statements. This database you can then query. For example, <em>Do I own a cat?</em> could fit a question pattern <em>Do/Does X own(s) a(n) Y?</em>, and you can search for <em>own(I, cat)</em> in your DB; you will not find it, so the answer is "No". If the question is "Do I own a dog?" you will find <em>owns(I, dog)</em> in your database and you can reply "Yes".</p>
  
  <p>This is all rather 'old' technology, but I think you will find that you will get decent results much quicker than with machine learning or statistical methods, especially if you have not much data to begin with.</p>
  
  <p>A further branch to look into would be <a href="https://en.wikipedia.org/wiki/Expert_system" rel="nofollow noreferrer">expert systems</a>. If you're thinking in terms of programming languages, then <a href="https://en.wikipedia.org/wiki/Prolog" rel="nofollow noreferrer">Prolog</a> would be well suited for this, but any language should do, really.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-06T13:50:43.133Z
Answers.LastActivityDate: 2020-03-14T19:04:56.913Z
Answers.LastEditDate: 2020-03-14T19:04:56.913Z
Answers.UserDisplayName: Oliver Mason
Body: <p>How can I determine if an input sentence is consistent with a certain subject?</p>
  
  <p>For example, suppose I am given the following dataset.</p>
  
  <pre><code>| Subject       | User input           | Output |
  |---------------|----------------------|--------|
  | Dog ownership | I own a dog          | Yes    |
  | Dog ownership | My dog is called Joe | Yes    |
  | Dog ownership | I don't have a dog   | No     |
  </code></pre>
  
  <p>In the examples above, the subject "dog ownership" is consistent with the input sentences "I own a dog" and "My dog is called Joe" (because, if your dog is called Joe, then you also own a dog).  </p>
  
Tags: <natural-language-processing>
Title: How can I determine if an input sentence is consistent with a certain subject?
UserDisplayName: bleand
ThreadText: # How can I determine if an input sentence is consistent with a certain subject?
  
  (Asked by: username_0 on 2017-07-20)
  
  How can I determine if an input sentence is consistent with a certain subject?
  For example, suppose I am given the following dataset.
  | Subject       | User input           | Output |
  |---------------|----------------------|--------|
  | Dog ownership | I own a dog          | Yes    |
  | Dog ownership | My dog is called Joe | Yes    |
  | Dog ownership | I don't have a dog   | No     |
  
  In the examples above, the subject "dog ownership" is consistent with the input sentences "I own a dog" and "My dog is called Joe" (because, if your dog is called Joe, then you also own a dog).
  
  **Tags:** natural-language-processing
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2017-07-21. Score: 2
  
  If you have lots of training data, ANN's (deep learning) could quite possibly get you there. But I have a hunch you might also get some mileage out of using something like a [rule induction](https://en.wikipedia.org/wiki/Rule_induction) approach. Maybe something like [CN2](https://en.wikipedia.org/wiki/CN2_algorithm). I'd suggest at least reading up on those and see if you can see a way to apply that to your system.
  
  > **Comments:**
  > **username_0**: The thing is that I don't have enough training data for ANN's, but I'm starting to think that I will need it. Since it will require a big amount of effort, I was waiting to be sure that getting this big set of data is the solution.  
  
  ---
  
  ### Answer by username_2 on 2017-07-20. Score: 1
  
  If you have collection of data or information, then you would like to ask questions about this data and machine should answer you.
  
  I think you need first, data mining to export the meaning and relations in this data, then you can build your expert system that will answer you.
  
  > **Comments:**
  > **username_0**: I do have some training data. Do you know any particular algorithm that could work?  
  
  ---
  
  ### Answer by username_3 on 2018-11-06. Score: 0
  
  Neural networks are the one thing I would not recommend. Your problem fits into the domain of predicate calculus, with some basic pattern recognition of the input sentences (assuming you only accept a certain type of sentences). You can do that without the need for masses of data.
  First, transform your statement into a canonical representation, probably using first-order logic and simple pattern matching/string matching. For example,
  I own a dog 
  
  X own/owns a/an Y  
  
  owns(I, dog)
  
  Here you have a pattern "X own(s) a(n) Y", which you recognise in your user input. You then have a predicate owns(X, Y), which you add to your database of statements. This database you can then query. For example, Do I own a cat? could fit a question pattern Do/Does X own(s) a(n) Y?, and you can search for own(I, cat) in your DB; you will not find it, so the answer is "No". If the question is "Do I own a dog?" you will find owns(I, dog) in your database and you can reply "Yes".
  This is all rather 'old' technology, but I think you will find that you will get decent results much quicker than with machine learning or statistical methods, especially if you have not much data to begin with.
  A further branch to look into would be expert systems. If you're thinking in terms of programming languages, then Prolog would be well suited for this, but any language should do, really.
  
  
  ---
  
  