def calc_n_types(self) -> int:
"""Calculate the number of types of input text
Returns:
int: the number of types of input text
"""
surfaces = []
for sentence in self.sentences:
juman_result = self.juman.analysis(sentence)
surfaces += [mrph.midasi for mrph in juman_result.mrph_list()]
word_type_counter = Counter(surfaces)
return len(word_type_counter)
评论列表
文章目录