def writeplaintext(wordref, stan_path, outxml, xml): import NERTest as NER plaintext = str.join('', [wordref[x]+' ' for x in wordref]) filename = "/home/grant/devel/TopoCluster/data/tempplain_" + xml op = io.open(filename, 'w', encoding='utf-8') op.write(unicode(plaintext)) op.close() NER.calc3(stan_path, filename, outxml) toporef2, wordref2 = NER.readnerxml2(outxml) return wordref2, toporef2