semantic similarity implementation for swi-prolog