[详细] -->
赞
踩
相关标签
赞
踩
原始题目
https://web.stanford.edu/class/cs224n/assignments/a1_preview/exploring_word_vectors.html
输入:
· corpus: 包括多个句子的语料
输出
def distinct_words(corpus): """ Determine a list of distinct words for the corpus. Params: corpus (list of list of strings): corpus of documents Return: corpus_words (list of strings): sorted list of distinct words across the corpus n_corpus_words (integer): number of distinct words across the corpus """ corpus_words = [] n_corpus_words = -1 # ------------------ # Write your implementation here. distinct_words_set = set() for sentence in corpus: distinct_words_set.update(sentence ) corpus_words = sorted(list(distinct_words_set)) num_corpus_words = len(corpus_words) # ------------------ return corpus_words, num_corpus_words `` # Question 1.2: Implement compute_co_occurrence_matrix [code] (3 points)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。