通过潜在语义分析建立索引的问题

发布于 2024-12-25 05:56:36 字数 1777 浏览 0 评论 0原文

每当我尝试在安装了 python 2.6.6 的 Windows 7 Enterprise(64 位)中运行此 python 脚本时,我总是收到此错误

问题签名: 问题事件名称:APPPCRASH
应用程序名称:python.exe
应用程序版本:0.0.0.0
应用程序时间戳:4c73f7b6
故障模块名称:_csr.pyd
故障模块版本:0.0.0.0
故障模块时间戳:4d6a645b
异常代码:c0000005
异常偏移量:000c05d4

我尝试重新安装 python 和我的程序运行的所有模块(即 gensim、nlptk、scipy 和 numpy)

我不知道这对你们来说是否足够,但请让我知道!!

lsi = models.LsiModel(corpus, num_topics = num_Topics)
index_lsi = similarities.MatrixSimilarity(lsi[corpus])

for k, v in dict_Queries.items():
        File.write("Check Key: " +k+ "\n")
        print "Running.... \n" 
        vec_bow = dict.doc2bow(v.split(), allow_update=True)

#In the last iteration, the code below the line doesn't run and i think the vec_lsi  
#is the source of the problem but I don't know why?
        vec_lsi = lsi[vec_bow]

        #indexing the LSI
        sims = index_lsi[vec_lsi]
        sims = sorted(enumerate(sims), key = lambda item: -item[1])

        if not cut_Off == 0:
            sims = sims[0:cut_Off]
        else:
            pass

        for t in sims:

            dup_info = dict_tcs.get(t[0])

            if t[1] > 0.75:
                #print "Key: " + k + " Link: " + dup_info + "\n"
                File.write("Adding: "+str(t)+ " To LSI actual \n")
                if dict_Actual_LSI.has_key(k):
                    links = dict_Actual_LSI.get(k)
                    links.append(dup_info)
                else:
                    links = []
                    links.append(dup_info)
                    dict_Actual_LSI[k] = links
        print "Added\n"

在最后一次迭代中,该行下面的代码没有运行,我认为 vec_lsi 是问题的根源,但我不知道为什么?

谢谢

Whenever I try to run this python script, in Windows 7 Enterprise (64 bit) with python 2.6.6 installed, I keep getting this error

Problem signature:
Problem Event Name: APPCRASH
Application Name: python.exe
Application Version: 0.0.0.0
Application Timestamp: 4c73f7b6
Fault Module Name: _csr.pyd
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 4d6a645b
Exception Code: c0000005
Exception Offset: 000c05d4

I've tried re-installing python and all the modules that my program runs on (ie gensim, nlptk, scipy and numpy)

I don't know if this is enough data for you guys, but please let me know!!

lsi = models.LsiModel(corpus, num_topics = num_Topics)
index_lsi = similarities.MatrixSimilarity(lsi[corpus])

for k, v in dict_Queries.items():
        File.write("Check Key: " +k+ "\n")
        print "Running.... \n" 
        vec_bow = dict.doc2bow(v.split(), allow_update=True)

#In the last iteration, the code below the line doesn't run and i think the vec_lsi  
#is the source of the problem but I don't know why?
        vec_lsi = lsi[vec_bow]

        #indexing the LSI
        sims = index_lsi[vec_lsi]
        sims = sorted(enumerate(sims), key = lambda item: -item[1])

        if not cut_Off == 0:
            sims = sims[0:cut_Off]
        else:
            pass

        for t in sims:

            dup_info = dict_tcs.get(t[0])

            if t[1] > 0.75:
                #print "Key: " + k + " Link: " + dup_info + "\n"
                File.write("Adding: "+str(t)+ " To LSI actual \n")
                if dict_Actual_LSI.has_key(k):
                    links = dict_Actual_LSI.get(k)
                    links.append(dup_info)
                else:
                    links = []
                    links.append(dup_info)
                    dict_Actual_LSI[k] = links
        print "Added\n"

In the last iteration, the code below the line doesn't run and i think the vec_lsi is the source of the problem but I don't know why?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情何以堪。 2025-01-01 05:56:36

异常代码 c0000005 表示“访问冲突”。这通常意味着某些代码试图读取或写入它无权访问的内存地址。这可能是由于指针损坏、内存未初始化或本机代码索引超出数组范围造成的。

错误所在的模块是_csr.pyd。这是 SciPy 的一部分,听起来像是用于操作稀疏数组的。这表明错误正在发生,因为 SciPy 已以某种方式指向无效内存。如果没有看到你的程序,很难猜测这是如何发生的。

下一步,您可以尝试通过向程序中添加一些打印语句来确定崩溃之前发生的情况 - 通过打印其进度,您可以缩小崩溃发生的范围。如果幸运的话,您可能会清楚为什么 SciPy 试图访问无效内存。

Exception code c0000005 means "access violation". This generally means that some piece of code tried to read from or write to a memory address that it didn't have permission to access. This might be due to a corrupted pointer, uninitialized memory or native code indexing out of the bounds of an array.

The module that the fault is in is _csr.pyd. This is a part of SciPy that sounds like it's for manipulating sparse arrays. This would suggest that the error is happening because somehow SciPy has been pointed towards invalid memory. Without seeing your program it's hard to guess how this might have happened.

As a next step, you could try to pin down what's happening immediately before the crash by adding some print statements to your program - by printing out its progress you can narrow down where the crash is occurring. If you're lucky it might then become clear why SciPy is trying to access invalid memory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文