lac icon indicating copy to clipboard operation
lac copied to clipboard

rank模式分词报错

Open SunshlnW opened this issue 4 years ago • 9 comments

IndexError: list index out of range W0111 17:16:55.818279 36152 analysis_predictor.cc:1058] Deprecated. Please use CreatePredictor instead. 想知道什么情况下会出现这样的错误!

SunshlnW avatar Jan 11 '21 09:01 SunshlnW

能给出更具体的信息吗,比如报错时的所有log信息

Nickname1230 avatar Jan 12 '21 03:01 Nickname1230

能给出更具体的信息吗,比如报错时的所有log信息

  File "D:\WorkSpace\BrandExtraction\modle\process.py", line 75, in title_process
    res = lac.run(title)
  File "D:\WorkSpace\BrandExtraction\venv\lib\site-packages\LAC\lac.py", line 81, in run
    return self.model.run(texts)
  File "D:\WorkSpace\BrandExtraction\venv\lib\site-packages\LAC\models.py", line 337, in run
    weight = self.parse_result(tags_for_rank, rank_decode[0], words_length)
  File "D:\WorkSpace\BrandExtraction\venv\lib\site-packages\LAC\models.py", line 371, in parse_result
    weight_out[-1] = max(weight_out[-1], weight[ind])
IndexError: list index out of range

SunshlnW avatar Jan 13 '21 01:01 SunshlnW

能给出更具体的信息吗,比如报错时的所有log信息

我看了开始的很多词标记是O

SunshlnW avatar Jan 13 '21 06:01 SunshlnW

text里面是不是有空格,把空格去掉试试

BossRobin avatar Jan 21 '21 07:01 BossRobin

https://github.com/baidu/lac/blob/master/python/LAC/models.py 371行,调用weight_out[-1]的时候,weight_out可能为空

liuhe6 avatar Mar 13 '21 03:03 liuhe6

https://github.com/baidu/lac/blob/master/python/LAC/models.py

我也碰到这种情况了,在对长文本处理时,第一个片段没有被正确分词并标注词性 (单独对这个片段处理的话是可以正确运行 lac.run() 的)

此时表现为 331行生成的 word_length 与 result 不一致 image

这就导致 367行 开始循环时,tag 为 ‘O’,进而导致371行 调用 weight_out[-1] 的时候,出现 weight_out 为空的情况 image

yjx4509 avatar Apr 21 '21 03:04 yjx4509

https://github.com/baidu/lac/blob/master/python/LAC/models.py

我也碰到这种情况了,在对长文本处理时,第一个片段没有被正确分词并标注词性 (单独对这个片段处理的话是可以正确运行 lac.run() 的)

此时表现为 331行生成的 word_length 与 result 不一致 image

这就导致 367行 开始循环时,tag 为 ‘O’,进而导致371行 调用 weight_out[-1] 的时候,出现 weight_out 为空的情况 image

我也遇到这个问题了,请问最后解决了吗? @yjx4509

yayaQAQ avatar Jul 19 '21 03:07 yayaQAQ

已经一年了,是不打算修了吗。。 下面这句话我只要使用rank模式就会报 list index out of range

西江月·夜行黄沙道中 [宋] 辛弃疾 明月别枝惊鹊

image

Lbsl avatar Feb 10 '22 10:02 Lbsl

您的来信已收悉,我会尽快回复,感谢您的来信。

Nickname1230 avatar Feb 10 '22 10:02 Nickname1230