Skip to content

Commit 9b74af1

Browse files
committed
fixes KeyError raised by writers.corpora.to_documents, issue #56
1 parent c877b81 commit 9b74af1

File tree

3 files changed

+12
-43
lines changed

3 files changed

+12
-43
lines changed

MANIFEST

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,5 @@
11
# file GENERATED by distutils, do NOT edit
22
setup.py
3-
<<<<<<< HEAD
4-
testsuite/__init__.py
5-
testsuite/analyze_tests.py
6-
testsuite/crossref_test.py
7-
testsuite/data_tests.py
8-
testsuite/dfr_reader_test.py
9-
testsuite/mallet_reader_test.py
10-
testsuite/networks_test.py
11-
testsuite/simple_graph.py
12-
testsuite/wos_reader_test.py
13-
testsuite/writers_test.py
14-
tethne/__init__.py
15-
tethne/__main__.py
16-
tethne/builders.py
17-
tethne/data.py
18-
tethne/workflow.py
19-
tethne/analyze/__init__.py
20-
tethne/analyze/collection.py
21-
tethne/analyze/graph.py
22-
tethne/matrices/__init__.py
23-
tethne/matrices/dfr.py
24-
tethne/networks/__init__.py
25-
tethne/networks/authors.py
26-
tethne/networks/helpers.py
27-
tethne/networks/papers.py
28-
tethne/networks/terms.py
29-
tethne/networks/topics.py
30-
tethne/readers/__init__.py
31-
tethne/readers/dfr.py
32-
tethne/readers/mallet.py
33-
tethne/readers/pubmed.py
34-
tethne/readers/wos.py
35-
tethne/services/__init__.py
36-
=======
373
tethne/__init__.py
384
tethne/__main__.py
395
tethne/analyze/__init__.py
@@ -77,7 +43,6 @@ tethne/readers/scopus.py
7743
tethne/readers/wos.py
7844
tethne/services/__init__.py
7945
tethne/services/dspace.py
80-
>>>>>>> c9995a4e3bdcee8d8bdecc731621bb27394cbcdb
8146
tethne/services/geocode.py
8247
tethne/utilities/__init__.py
8348
tethne/writers/__init__.py

setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
version=VERSION,
3737
packages = PACKAGES,
3838
install_requires=[
39-
"networkx >= 1.8.1",
40-
"matplotlib >= 1.3.1",
41-
"tables >= 3.1.1",
42-
"Unidecode >= 0.04.16",
43-
"geopy >= 0.99",
39+
"networkx>=1.8.1",
40+
"matplotlib>=1.3.1",
41+
"tables>=3.1.1",
42+
"Unidecode>=0.04.16",
43+
"geopy>=0.99",
4444
"nltk",
45-
"scipy==0.14.0",
46-
"numpy==1.8.1",
45+
"scipy>=0.14.0",
46+
"numpy>=1.8.1",
4747
],
4848
)

tethne/writers/corpora.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ def word(s):
5656
# Write metadata.
5757
meta = [ str(p) ]
5858
if metadata is not None:
59-
meta += [ str(metadict[p][f]) for f in metakeys ]
59+
if p in metadict:
60+
for f in metakeys:
61+
if f in metadict[p]: meta.append(str(metadict[p][f]))
62+
else: meta.append('')
63+
6064
metaFile.write('\t'.join(meta) + '\n')
6165

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

0 commit comments

Comments
 (0)