Python 字符串处理:识别楼号与门牌号
elif word.isdigit():
for i, char in enumerate(word):
if i == 0:
tag_list.append('B-roadno')
elif i == len(word) - 1:
tag_list.append('E-roadno')
else:
if word[i+1] == '楼':
tag_list.append('B-floorno')
else:
tag_list.append('I-roadno')
elif word.endswith('号'):
for i, char in word:
if i == 0:
tag_list.append('B-roadno')
elif i == len(word) - 1:
tag_list.append('E-roadno')
else:
tag_list.append('I-roadno')
roadno = word
原文地址: https://www.cveoy.top/t/topic/f2el 著作权归作者所有。请勿转载和采集!