python - wrong output in arff -


i using python script , writing results (calculated using ntlk) arff file. information needs go arff file letters , words (nothing numerical). however, whenever run script arff file containing zeros.. this:

0,0.0,0.0,0 

this piece of code writes arff:

     fileid in corpus.fileids():          cat = str(fileid.split('/')[0])          text = corpus.words(fileid)          text2 = corpus.raw(fileid)          text3 = ngrams(text2, 3)          text4 = ngrams(text2, 4)          lijst = [frequencycount(text, freq)] + [frequencycount(text3, chartrigramfreq)]  + [frequencycount(text4, chartetragramfreq)]          merged = list(itertools.chain.from_iterable(lijst))           merged2 = ','.join(merged)          filet.write("%s\n" % merged2)          counter += 1     print counter, fileid, time()-tijd     filet.close() 


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -