What is it called when you classify words into categories, but not by part of speech?
The name of the classification you are looking for is called Semantic field classification (https://en.wikipedia.org/wiki/Semantic_field). The sort of algorithm you are looking for falls under the category of Statistical Semantic.