elif word.endswith('大道') or word.endswith('县道') or word.endswith('乡道') or word.endswith('国道') or word.endswith('路'): if any(char.isdigit() for char in word): start_index = 0 for i, char in enumerate(word): if char.isdigit(): if i == 0 or not word[i-1].isdigit(): start_index = i if i == len(word)-1 or not word[i+1].isdigit(): for j in range(start_index, i+1): if j == start_index: tag_list.append('B-road') elif j == i: tag_list.append('E-road') else: tag_list.append('I-road') road = word[start_index:i+1] else: for char in word: if char == word[0]: tag_list.append('B-road') elif char == word[-1]: tag_list.append('E-road') else: tag_list.append('I-road') road = wor

修改 elif wordendswith大道 or wordendswith县道or wordendswith乡道or wordendswith国道or wordendswith路 for char in word if char == word0 tag_listappendB-road

原文地址: http://www.cveoy.top/t/topic/hs2Z 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录