Implement e function using SimilarityMatrix and Alphabet