Skip to content

Commit

Permalink
Merge pull request #97 from lisc-tools/check_arts
Browse files Browse the repository at this point in the history
[ENH] - Add check_articles method to Words
  • Loading branch information
TomDonoghue authored Sep 1, 2024
2 parents fb712c3 + dbdd50b commit 569783e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lisc/objects/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ def check_data(self):
print("\t{:{twd}} \t\t {}".format(label, data.n_articles, twd=twd))


def check_articles(self):
"""Prints out the articles collected for each term."""

for results in self.results:
print('\nLabel: {}\n'.format(results.label))
for cres in results:
author = cres['authors'][0][0] + (' et al' if len(cres['authors']) > 1 else '')
doi = 'https://dx.doi.org/' + cres['doi'] if cres['doi'] else ''
print(author + ',', str(cres['year']) + ':', cres['title'], doi)


def drop_data(self, n_articles):
"""Drop terms based on number of article results.
Expand Down
1 change: 1 addition & 0 deletions lisc/tests/objects/test_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def check_dunders(words):
def check_funcs(words):

words.check_data()
words.check_articles()

def drop_data(words, n_articles):

Expand Down

0 comments on commit 569783e

Please sign in to comment.