#NEWLINE# def evaluate_cosine_similarity( evaluated_sentences , reference_sentences ) : #NEWLINE# #INDENT# evaluated_words = tuple ( chain ( * ( s . words for s in evaluated_sentences ) ) ) #NEWLINE# reference_words = tuple ( chain ( * ( s . words for s in reference_sentences ) ) ) #NEWLINE# evaluated_model = TfDocumentModel ( evaluated_words ) #NEWLINE# reference_model = TfDocumentModel ( reference_words ) #NEWLINE# return cosine_similarity ( evaluated_model , reference_sentences )