Similar Items: Automatic functions, linear time and learning