The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

text mining using in execute python

hmhsinghmhsing Member Posts: 31 Maven
edited November 2018 in Help

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()

Best Answer

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn
    Solution Accepted

    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.

Answers

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data Scientist

    Hi,

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

    Best,

    Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • hmhsinghmhsing Member Posts: 31 Maven

    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!  

Sign In or Register to comment.