Reputation: 23
I'm taking a look at some CBOW Python implementations. The owner of the code used a function called "line_processing" from text_process lib. When I tried to run, I got that error:
ImportError: cannot import name 'line_processing' from 'text_process'
So I took a look at the lib implementation. There is no function called "line_processing".
That guy used this function to read each line from a .txt file, and write them in a variable, creating a "big string":
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
Is there anyone who knows something about "line_processing" function, or about a function/lib I can use instead?
Thank you!
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)
Upvotes: 1
Views: 310