Word2vec (https://en.wikipedia.org/wiki/Word2vec) can be used to turn text into vectors that encode the meaning. You can use these vectors to compare similarities between texts.
Example:
import word2vec
load(300) # load huge binary file
let
aVec = text2vec("Cat set on a red wall")
bVec = text2vec("Dog set on a red fence")
# how different are they?
echo dist(aVec, bVec)