Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumps enrichment to v0.9.7; can optionally specify bibcode volume on … #57

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]
git+https://github.com/adsabs/[email protected].6
git+https://github.com/adsabs/[email protected].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