Task 3 algorithm description
编程原理作业代写 First convert a sentence into a dictionary of words, the keys are unique words, and the values are the frequency of the words
The brief idea behind my implementation is: 编程原理作业代写
- First convert a sentence into a dictionary of words, the keys are unique words, and the values are the frequency of the words in one sentence. This process is implemented as the function count_words
- Then we combine the two dictionaries into one dictionary, if a word is found in both dictionary. Then the value of this word in the new dictionary is 2, otherwise it is 1.
- Then we find the unique words as the words whose values in the final dictionary are 1, and the common words are all the words in the dictionary.
- Output the similarity score.
The logic is also illustrated below:
发表回复
要发表评论,您必须先登录。