How to encode semantic knowledge: a method for learning representations