I am absolutely new in AI area.

I would like to know how to mathematically/logically represent the sense of sentences like:

The cat drinks milk.

Sun is yellow.

I was at work yesterday.

So that it could be converted to computer understandable form and analysed algorithmically.

Any clue?

  • 1
    $\begingroup$ I am not an expert in this field..but simple logical sentences like this probably can be well represented by Boolean algebra...Divide the sentence into subject and predicate and find out the verb....the specific verb will be 1 for the sentence the rest verbs 0..By logical programming and frequency analysis you can find what does 'of' or 'for' or 'with' etc prepositions add to the sentence i.e what context they add to the sentence and so on...But this will work good for very straight logical sentences..simple sentences are generally analysed by decision trees $\endgroup$ – DuttaA Feb 22 '18 at 12:11

Let start by classify the phrases you propose:

  1. The cat drinks milk. => action
  2. Sun is yellow. => descriptive/declarative, immutable
  3. I was at work yesterday. => descriptive, time related

1) The easiest ones are always the descriptive and immutable (in the context) phrases as "Sun is yellow.". Some usual representations:

  • prolog:


or simply:


  • object oriented:


2) When the fact is time related as in "I was at work yesterday", we divide the description in a time indicator and a immutable fact:

  • prolog:


note how when has two parts, the time identification and the immutable fact.

Another prolog variant is:


where the content in the list (brackets) means "optional related facts".

  • object oriented:

I.at = {

position = workplace;

when = yesterday


3) Actions as "The cat drinks milk." are a few more difficult:

  • prolog:




  • object oriented:



cat.action = {




Obviously, these are only the main ideas, there are as many representations as different programs, but most of them handles same kind of structures.

( note: the term "computer understandable" is ambiguous. Current computer doesn't understand anything. We say these expression are understandable in the sense that its compiler/interpreter accepts them, and describes the content of the phrase, and the program can transform them to other results).

| improve this answer | |

People normally represent sentences like this as vectors of a specific length, normally about 2500 in length. The algorithm that can do this is sentence2vec. It is basically a derivative of word2vec. It allows you to train a model that can transform sentences into vectors that you can then feed into a neural network or another algorithm. You can check out the paper, which you should be able to find on google scholar. If you need the link, I can get it. Another possibility is word embeddings, which I have not found a good paper on, but cortical.io has a free API that allows you to mess around with their implementation. The word embeddings mimic the real human brain much better based on our current research, but sentence2vec/word2vec is used much more often in practice.

| improve this answer | |
  • $\begingroup$ I think you are talking about a very specific are of applied AI. $\endgroup$ – pasaba por aqui Feb 23 '18 at 9:14
  • $\begingroup$ "The word embeddings mimic the real human brain much better" : it is difficult to prove true or false of this statement, taken into account that what we known about logic of brain is ... nothing. $\endgroup$ – pasaba por aqui Feb 23 '18 at 9:15
  • $\begingroup$ @pasabaporaqui it based on research done by the neuroscientist Jeff Hawking, and based on our current research it is much more similar to the human brain than conventional neural networks. Also, this area of AI is pretty much basic Natural Languages Processing. $\endgroup$ – Aiden Grossman Feb 23 '18 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.