machinalis / iepy

Information Extraction in Python
BSD 3-Clause "New" or "Revised" License
906 stars 186 forks source link

Couldn't find the expected field names on the provided csv ['document_id', 'document_text'] #91

Closed alexlenail closed 8 years ago

alexlenail commented 8 years ago

If the documentation could be updated with some reference about how to put together the specific csv format, that would be much appreciated. This is the code that builds the CSV:

    writer = csv.DictWriter(open(filename, 'wb'),fieldnames=['document_id', 'document_text'])
    for key, value in mydict.items():
        writer.writerow({'document_id': key.encode('ascii', 'ignore'), 'document_text': value.encode('ascii', 'ignore')})
francolq commented 8 years ago

I think that should be ok.

These are all the docs we have: http://iepy.readthedocs.org/en/latest/instantiation.html#csv-importer

Here you have an example: http://cs.famaf.unc.edu.ar/~francolq/godfather.csv

alexlenail commented 8 years ago

The issue I think is I needed writer.writeheader() before the for loop. Making mention of that in the docs could be nice. Also adding the example to the docs could be cool.