Skip to content

Commit

Permalink
Merge pull request #57 from seasidesparrow/main
Browse files Browse the repository at this point in the history
Bumps enrichment to v0.9.7; can optionally specify bibcode volume on …
  • Loading branch information
seasidesparrow authored Mar 5, 2024
2 parents 61f793c + b0e997d commit c8b2c97
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions adsmanparse/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ def _get_publication(self):
if publisher == 'Zenodo':
self.output['source'] = publisher

def _get_bibcode(self, bibstem=None):
def _get_bibcode(self, bibstem=None, volume=None):
try:
self.output['bibcode'] = bibgen.make_bibcode(self.data, bibstem=bibstem)
self.output['bibcode'] = bibgen.make_bibcode(self.data, bibstem=bibstem, volume=volume)
except Exception as err:
print('Couldnt make a bibcode: %s' % str(err))

Expand Down Expand Up @@ -389,7 +389,7 @@ def _special_handling(self, bibstem=None):
self.data['authors'] = new_authors


def translate(self, data=None, publisher=None, bibstem=None, parsedfile=False):
def translate(self, data=None, publisher=None, bibstem=None, volume=None, parsedfile=False):
if data:
self.data = data
if not self.data:
Expand All @@ -405,5 +405,5 @@ def translate(self, data=None, publisher=None, bibstem=None, parsedfile=False):
self._get_references()
self._get_properties(parsedfile)
self._get_publication()
self._get_bibcode(bibstem=bibstem)
self._get_bibcode(bibstem=bibstem, volume=volume)
self._get_copyright()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
git+https://github.com/adsabs/ADSIngestParser@v0.9.13
git+https://github.com/adsabs/ADSIngestEnrichment@v0.9.6
git+https://github.com/adsabs/ADSIngestEnrichment@v0.9.7
adsputils==1.5.2
habanero==0.7.4
namedentities==1.9.4
Expand Down
9 changes: 8 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ def get_args():
default=None,
help='Bibstem for special handling and/or bibcode(s)')

parser.add_argument('-v',
'--volume',
dest='volume',
action='store',
default=None,
help='Volume for special handling and/or bibcodes(s)')

parser.add_argument('-d',
'--doi',
dest='fetch_doi',
Expand Down Expand Up @@ -114,7 +121,7 @@ def create_tagged(rec=None, args=None):
try:
xlator = translator.Translator()
seri = classic_serializer.ClassicSerializer()
xlator.translate(data=rec, bibstem=args.bibstem, parsedfile=args.parsedfile)
xlator.translate(data=rec, bibstem=args.bibstem, volume=args.volume, parsedfile=args.parsedfile)
output = seri.output(xlator.output)
return output
except Exception as err:
Expand Down

0 comments on commit c8b2c97

Please sign in to comment.