RapidMiner

text mining using in execute python

SOLVED
Contributor II

text mining using in execute python

I hope to input a text file into Execute Python and do word segmentation. The python scripts is as following.  The result shows parsing failed, can anyone give me some suggestion? Thanks!  

 

import pandas
import jieba
import csv

def rm_main():
    ff = open("C:/Users/user/Desktop/speech.txt").read()
    seglist = jieba.cut(ff, cut_all=False)

f = open("text.csv","w") 
w = csv.writer(f) 
w.writerows(seglist) 
f.close()

See more topics labeled with:

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator
Solution
Accepted by topic author hmhsing
‎07-25-2017 08:52 PM

Re: text mining using in execute python

Are you working in a Windows environment? If so then you Pandas and your Jeiba module need to be installed under an Anaconda distribution. Verify that.

3 REPLIES
Highlighted
RMStaff

Re: text mining using in execute python

Hi,

please have a look into the log window. There should be more information on the error.

Best,

Martin

--------------------------------------------------------------------------
Head of Data Science Services at RapidMiner
Contributor II

Re: text mining using in execute python

The error message is:

The script could not be parsed. Please check your Python script:ModuleNotFoundError:No module named 'jieba'

I have already installed jieba package, and similar coding works in Python.

Thanks!  

Moderator
Solution
Accepted by topic author hmhsing
‎07-25-2017 08:52 PM

Re: text mining using in execute python

Are you working in a Windows environment? If so then you Pandas and your Jeiba module need to be installed under an Anaconda distribution. Verify that.