ImportError“ text_process” Python库

问题描述

我正在看一些CBOW Python实现。 该代码的所有者使用了来自text_process lib的名为“ line_processing”的函数。 当我尝试运行时,出现了该错误:

ImportError: cannot import name 'line_processing' from 'text_process'

所以我看了一下lib的实现。没有名为“ line_processing”的函数。

那个家伙使用此功能从.txt文件读取每一行,并将它们写入变量中,从而创建“大字符串”:

    text = 'file.txt'
    print(text)
    text = ''
    count = 0
    for i in open(text_file,'r',encoding='utf-8'):
        text+=line_processing(i)+'\n'
        count += 1
        if count % 10000 == 0: break

有人知道“ line_processing”功能,或者我可以使用的功能/库吗?

谢谢!

Ps。:

$ python CBOW.py
Building prefix dict from the default dictionary ...
Dumping model to file cache C:\"path_to"\AppData\Local\Temp\jieba.cache
Loading model cost 0.723 seconds.
Prefix dict has been built successfully.
Traceback (most recent call last):
  File "CBOW.py",line 1,in <module>
    from text_process import line_processing
ImportError: cannot import name 'line_processing' from 'text_process' (C:\"path_to"\miniconda3\lib\site\...\text_process)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...