Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rank模式分词报错 #169

Open
SunshlnW opened this issue Jan 11, 2021 · 9 comments
Open

rank模式分词报错 #169

SunshlnW opened this issue Jan 11, 2021 · 9 comments

Comments

@SunshlnW
Copy link

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

@Nickname1230
Copy link
Contributor

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

@SunshlnW
Copy link
Author

能给出更具体的信息吗,比如报错时的所有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
Copy link
Author

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

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

@BossRobin
Copy link

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

@liuhe6
Copy link

liuhe6 commented Mar 13, 2021

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

@yjx4509
Copy link

yjx4509 commented Apr 21, 2021

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

@yayaQAQ
Copy link

yayaQAQ commented Jul 19, 2021

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

@Lbsl
Copy link

Lbsl commented Feb 10, 2022

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

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

image

@Nickname1230
Copy link
Contributor

Nickname1230 commented Feb 10, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants