Skip to content

Commit

Permalink
fixes KeyError raised by writers.corpora.to_documents, issue #56
Browse files Browse the repository at this point in the history
  • Loading branch information
erickpeirson committed Feb 3, 2015
1 parent c877b81 commit 9b74af1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 43 deletions.
35 changes: 0 additions & 35 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
# file GENERATED by distutils, do NOT edit
setup.py
<<<<<<< HEAD
testsuite/__init__.py
testsuite/analyze_tests.py
testsuite/crossref_test.py
testsuite/data_tests.py
testsuite/dfr_reader_test.py
testsuite/mallet_reader_test.py
testsuite/networks_test.py
testsuite/simple_graph.py
testsuite/wos_reader_test.py
testsuite/writers_test.py
tethne/__init__.py
tethne/__main__.py
tethne/builders.py
tethne/data.py
tethne/workflow.py
tethne/analyze/__init__.py
tethne/analyze/collection.py
tethne/analyze/graph.py
tethne/matrices/__init__.py
tethne/matrices/dfr.py
tethne/networks/__init__.py
tethne/networks/authors.py
tethne/networks/helpers.py
tethne/networks/papers.py
tethne/networks/terms.py
tethne/networks/topics.py
tethne/readers/__init__.py
tethne/readers/dfr.py
tethne/readers/mallet.py
tethne/readers/pubmed.py
tethne/readers/wos.py
tethne/services/__init__.py
=======
tethne/__init__.py
tethne/__main__.py
tethne/analyze/__init__.py
Expand Down Expand Up @@ -77,7 +43,6 @@ tethne/readers/scopus.py
tethne/readers/wos.py
tethne/services/__init__.py
tethne/services/dspace.py
>>>>>>> c9995a4e3bdcee8d8bdecc731621bb27394cbcdb
tethne/services/geocode.py
tethne/utilities/__init__.py
tethne/writers/__init__.py
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
version=VERSION,
packages = PACKAGES,
install_requires=[
"networkx >= 1.8.1",
"matplotlib >= 1.3.1",
"tables >= 3.1.1",
"Unidecode >= 0.04.16",
"geopy >= 0.99",
"networkx>=1.8.1",
"matplotlib>=1.3.1",
"tables>=3.1.1",
"Unidecode>=0.04.16",
"geopy>=0.99",
"nltk",
"scipy==0.14.0",
"numpy==1.8.1",
"scipy>=0.14.0",
"numpy>=1.8.1",
],
)
6 changes: 5 additions & 1 deletion tethne/writers/corpora.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def word(s):
# Write metadata.
meta = [ str(p) ]
if metadata is not None:
meta += [ str(metadict[p][f]) for f in metakeys ]
if p in metadict:
for f in metakeys:
if f in metadict[p]: meta.append(str(metadict[p][f]))
else: meta.append('')

metaFile.write('\t'.join(meta) + '\n')

except AttributeError: # .iteritems() raises an AttributeError if ngrams
Expand Down

0 comments on commit 9b74af1

Please sign in to comment.