semantic distance impl