Learning Sequence Neighbourhood Metrics