Efficient Nearest Neighbor based Uncertainty Estimation for Natural Language Processing Tasks