Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved map handling.

  • Loading branch information...
commit 3d6e74a374d9e09258b7eb4c8852d86ae4fac485 1 parent 8a0cf06
Bill OConnor authored
Showing with 3 additions and 6 deletions.
  1. +3 −6 openAccess/gitPLoS/nltk/corpus/builder.py
9 openAccess/gitPLoS/nltk/corpus/builder.py
View
@@ -10,7 +10,7 @@
# These fields are required for the corpus
QUERY_RTN_FLDS = ['id','journal','publication_date',
'article_type','author','subject',
- 'title','abstract','body',
+ 'title','abstract','body','editor',
]
class Builder(object):
@@ -60,7 +60,7 @@ def add(self, docs):
"""
root = self._root
info = self._corpus_info
- d2cmap = {}; c2dmap = {}; d2infomap = {}
+ d2cmap = {}; c2dmap = defaultdict(list); d2infomap = {}
amap = info['article_link']
xmap = info['xml_link']
# Build all the lists and mappings
@@ -74,10 +74,7 @@ def add(self, docs):
d2cmap[doi] = subjs = doc['subject']
# Category -> [ f1, f2, .... ]
for s in subjs:
- if s in c2dmap:
- c2dmap[s].append(doi)
- else:
- c2dmap[s] = [ doi ]
+ c2dmap[s].append(doi)
# doi -> article link
amap[doi] = articleUrl(doi)
# doi -> artilce xml link
Please sign in to comment.
Something went wrong with that request. Please try again.