%% Work out what people mean /********** The Second Technique - Meaning Philomene placed labels with the sentences "John felt the kick of cold water as he dived into the pool." and "The unborn baby kicked her mother." written on them in a circle labelled "Kicks". She also placed labels with the sentences "John was immersed in the pool." and "Joanne was immersed in the French class." written on them in a circle labelled "Immersion". Philomene bought a packet of tooth paste. She chose the delicious, whitening tooth paste, not the bitter, unattractive toothpaste. This enabled her to concentrate, and meant her life was a success. The algorithm meaning1/3 finds the common meaning for a set of words. meaning1([pool, baby], [[pool, kick], [baby, kick], [pool, immerse], [frenchclass, immerse]], Meaning). Meaning = kick ; meaning1(+Items, +Pairs, -Meaning) (+ means input, - means output) Items - List of words to find the common meaning of. Pairs - List of pairs of words and their meanings. Meaning - The common meaning for the words. **********/ meaning1(Items, Pairs1, Meaning) :- meaning2(Items, Pairs1, _Pairs2, [], Meanings1), Meanings1 = [Meaning | Meanings2], allsame(Meaning, Meanings2). /********** meaning2(+Items, +Pairs1, -Pairs2, +Meanings1, -Meanings2) Items - List of words to find the common meaning of. Pairs1 - Initial list of pairs of words and their meanings. Pairs2 - Final list of pairs of words and their meanings. Meaning1 - Initial list of words which should all be the common meaning. Meaning2 - Final list of words which should all be the common meaning. **********/ meaning2([], Pairs, Pairs, Meanings, Meanings). meaning2(Items1, Pairs1, Pairs2, Meanings1, Meanings2) :- Items1 = [Item1 | Items2], Pair = [Item1, Item2], delete(Pairs1, Pair, Pairs3), append(Meanings1, [Item2], Meanings3), meaning2(Items2, Pairs3, Pairs2, Meanings3, Meanings2). /********** allsame(+Item, +Items) Item - Item to test that all of Items is the same as. Items - Items that are tested to all be Item. **********/ allsame(_Item, []). allsame(Item, Items1) :- Items1 = [Item | Items2], allsame(Item, Items2).