🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

text mining using in execute python

User: "hmhsing"
Altair Community Member
Updated by Jocelyn

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

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Thomas_Ott"
    New Altair Community Member
    Accepted Answer

    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.