review 1 KB
Newer Older
Yuan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Summary:
代码写的有问题

Detailed Comments:

1、代码一运行就报如下错误:
 108         for ner in ners:
    109             print(ners)
--> 110             if ner[2] == 'lacation':
    111                 ner[3] = 'CITY'
    112         seg_sentence = fool.cut(sentence)

IndexError: list index out of range
这个错误是因为fun_clean这个函数写的有问题,这里就是对数据进行清洗过滤,实体识别不用放在这个函数中;
2、就算你要写在这个函数中,你的这也需要做一个判断,如果ners为空呢,你这里就是因为ners为空所以报的错误
 words, ners = fool.analysis(sentence)
        for ner in ners:
            print(ners)
            if ner[2] == 'lacation':
                ner[3] = 'CITY'
3、修改下代码吧,提交代码前 ,自己先测试一下

Overall Score: 76
--------------------------------------------------------------------------------------------------------------------------

Thanks for your efforts.

-Your instructor