I am absolutely new in the AI area.

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

  1. The cat drinks milk.
  2. Sun is yellow.
  3. I was at work yesterday.

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

Any clue?


2 Answers 2


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).


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.

  • $\begingroup$ I think you are talking about a very specific are of applied AI. $\endgroup$ Feb 23, 2018 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$ Feb 23, 2018 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$ Feb 23, 2018 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .