citation-map 4.1__tar.gz → 4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: citation-map
3
- Version: 4.1
3
+ Version: 4.2
4
4
  Summary: A simple tool to generate your Google Scholar citation world map.
5
5
  Home-page: https://github.com/ChenLiu-1996/CitationMap
6
6
  Author: Chen Liu
@@ -35,9 +35,7 @@ Research areas: Machine Learning, Spatial-Temporal Modeling, Medical Vision, AI4
35
35
  **[Asking for advice]**
36
36
  1. This is my first time dealing with webscraping/crawling. Users have reported stability issues, and I suspect the major problems are (1) being caught by CAPTCHA or robot check, and (2) being flagged for blacklist by Google Scholar. If you are experienced in these areas and have good advice, I would highly appreciate a GitHub issue or a pull request.
37
37
 
38
- [Aug 2, 2024] Version 4.0 released >>> Logic update. A new input argument `affiliation_conservative`.
39
-
40
- - If set to True, we will use **a very conservative approach for identifying affiliations** which lead to **very high precision and lower recall**. Many thanks to [Zhijian Liu](https://github.com/zhijian-liu) for the [helpful discussion](https://github.com/ChenLiu-1996/CitationMap/issues/8).
38
+ [Aug 2, 2024] Version 4.0 released >>> Logic update. A new input argument `affiliation_conservative`. If set to True, we will use **a very conservative approach to identify affiliations** which leads to **much higher precision and lower recall**. Many thanks to [Zhijian Liu](https://github.com/zhijian-liu) for the [helpful discussion](https://github.com/ChenLiu-1996/CitationMap/issues/8).
41
39
 
42
40
  [Jul 28, 2024] Version 3.10 released >>> Logic update. Tested on a professor's profile **with 10,000 citations**!
43
41
 
@@ -19,9 +19,7 @@ Research areas: Machine Learning, Spatial-Temporal Modeling, Medical Vision, AI4
19
19
  **[Asking for advice]**
20
20
  1. This is my first time dealing with webscraping/crawling. Users have reported stability issues, and I suspect the major problems are (1) being caught by CAPTCHA or robot check, and (2) being flagged for blacklist by Google Scholar. If you are experienced in these areas and have good advice, I would highly appreciate a GitHub issue or a pull request.
21
21
 
22
- [Aug 2, 2024] Version 4.0 released >>> Logic update. A new input argument `affiliation_conservative`.
23
-
24
- - If set to True, we will use **a very conservative approach for identifying affiliations** which lead to **very high precision and lower recall**. Many thanks to [Zhijian Liu](https://github.com/zhijian-liu) for the [helpful discussion](https://github.com/ChenLiu-1996/CitationMap/issues/8).
22
+ [Aug 2, 2024] Version 4.0 released >>> Logic update. A new input argument `affiliation_conservative`. If set to True, we will use **a very conservative approach to identify affiliations** which leads to **much higher precision and lower recall**. Many thanks to [Zhijian Liu](https://github.com/zhijian-liu) for the [helpful discussion](https://github.com/ChenLiu-1996/CitationMap/issues/8).
25
23
 
26
24
  [Jul 28, 2024] Version 3.10 released >>> Logic update. Tested on a professor's profile **with 10,000 citations**!
27
25
 
@@ -19,18 +19,16 @@ from typing import Any, Iterable, List, Tuple
19
19
  from .scholarly_support import get_citing_author_ids_and_citing_papers, get_organization_name
20
20
 
21
21
 
22
- def fetch_google_scholar_profile(scholar_id: str):
22
+ def find_all_citing_authors(scholar_id: str, num_processes: int = 16) -> List[Tuple[str]]:
23
23
  '''
24
- Step 1: Fetch Google Scholar Profile using Scholar ID.
24
+ Step 1. Find all citing authors.
25
25
  '''
26
+ # Find Google Scholar Profile using Scholar ID.
26
27
  author = scholarly.search_author_id(scholar_id)
27
28
  author = scholarly.fill(author, sections=['publications'])
28
- return author
29
+ publications = author['publications']
30
+ print('Author profile found, with %d publications.\n' % len(publications))
29
31
 
30
- def find_all_citing_authors(publications: Iterable, num_processes: int = 16) -> List[Tuple[str]]:
31
- '''
32
- Step 2. Find all citing authors.
33
- '''
34
32
  # Fetch metadata for all publications.
35
33
  if num_processes > 1 and isinstance(num_processes, int):
36
34
  with Pool(processes=num_processes) as pool:
@@ -72,7 +70,7 @@ def find_all_citing_affiliations(all_citing_author_paper_tuple_list: List[Tuple[
72
70
  num_processes: int = 16,
73
71
  affiliation_conservative: bool = False):
74
72
  '''
75
- Step 3. Find all citing affiliations.
73
+ Step 2. Find all citing affiliations.
76
74
  '''
77
75
  if affiliation_conservative:
78
76
  __affiliations_from_authors = __affiliations_from_authors_conservative
@@ -98,7 +96,7 @@ def find_all_citing_affiliations(all_citing_author_paper_tuple_list: List[Tuple[
98
96
 
99
97
  def clean_affiliation_names(author_paper_affiliation_tuple_list: List[Tuple[str]]) -> List[Tuple[str]]:
100
98
  '''
101
- Step 4 (Optional). Clean up the names of affiliations from the authors' affiliation tab on their Google Scholar profiles.
99
+ Step 3 (Optional). Clean up the names of affiliations from the authors' affiliation tab on their Google Scholar profiles.
102
100
  NOTE: This logic is very naive. Please send an issue or pull request if you have any idea how to improve it.
103
101
  Currently we will not consider any paid service or tools that pose extra burden on the users, such as GPT API.
104
102
  '''
@@ -125,7 +123,7 @@ def clean_affiliation_names(author_paper_affiliation_tuple_list: List[Tuple[str]
125
123
 
126
124
  def affiliation_text_to_geocode(author_paper_affiliation_tuple_list: List[Tuple[str]], max_attempts: int = 3) -> List[Tuple[str]]:
127
125
  '''
128
- Step 5: Convert affiliations in plain text to Geocode.
126
+ Step 4: Convert affiliations in plain text to Geocode.
129
127
  '''
130
128
  coordinates_and_info = []
131
129
  # NOTE: According to the Nomatim Usage Policy (https://operations.osmfoundation.org/policies/nominatim/),
@@ -181,7 +179,7 @@ def affiliation_text_to_geocode(author_paper_affiliation_tuple_list: List[Tuple[
181
179
 
182
180
  def create_map(coordinates_and_info: List[Tuple[str]], pin_colorful: bool = True):
183
181
  '''
184
- Step 6.1: Create the Citation World Map.
182
+ Step 5.1: Create the Citation World Map.
185
183
 
186
184
  For authors under the same affiliations, they will be displayed in the same pin.
187
185
  '''
@@ -221,7 +219,7 @@ def create_map(coordinates_and_info: List[Tuple[str]], pin_colorful: bool = True
221
219
 
222
220
  def export_csv(coordinates_and_info: List[Tuple[str]], csv_output_path: str) -> None:
223
221
  '''
224
- Step 6.2: Export csv file recording citation information.
222
+ Step 5.2: Export csv file recording citation information.
225
223
  '''
226
224
 
227
225
  citation_df = pd.DataFrame(coordinates_and_info,
@@ -388,12 +386,8 @@ def generate_citation_map(scholar_id: str,
388
386
  if cache_path is None or not os.path.exists(cache_path):
389
387
  print('No cache found for this author. Running from scratch.\n')
390
388
 
391
- # NOTE: Step 1. Fetch Google Scholar profile.
392
- author_profile = fetch_google_scholar_profile(scholar_id)
393
-
394
- # NOTE: Step 2. Find all citing authors.
395
- print('Author profile found, with %d publications.\n' % len(author_profile['publications']))
396
- all_citing_author_paper_tuple_list = find_all_citing_authors(author_profile['publications'],
389
+ # NOTE: Step 1. Find all citing authors.
390
+ all_citing_author_paper_tuple_list = find_all_citing_authors(scholar_id=scholar_id,
397
391
  num_processes=num_processes)
398
392
  print('A total of %d citing authors recorded.\n' % len(all_citing_author_paper_tuple_list))
399
393
  if cache_path is not None and len(all_citing_author_paper_tuple_list) > 0:
@@ -403,12 +397,12 @@ def generate_citation_map(scholar_id: str,
403
397
  else:
404
398
  print('Cache found. Loading author paper affiliation information from cache.\n')
405
399
 
406
- # NOTE: Step 1 & 2. Load all citing authors.
400
+ # NOTE: Step 1. Load all citing authors.
407
401
  all_citing_author_paper_tuple_list = load_cache(cache_path)
408
402
  print('Loaded from cache: %s.\n' % cache_path)
409
403
  print('A total of %d citing authors loaded.\n' % len(all_citing_author_paper_tuple_list))
410
404
 
411
- # NOTE: Step 3. Find all citing affiliations.
405
+ # NOTE: Step 2. Find all citing affiliations.
412
406
  print('Identifying affiliations using the %s approach.' % ('conservative' if affiliation_conservative else 'aggressive'))
413
407
  author_paper_affiliation_tuple_list = find_all_citing_affiliations(all_citing_author_paper_tuple_list,
414
408
  num_processes=num_processes,
@@ -417,7 +411,7 @@ def generate_citation_map(scholar_id: str,
417
411
  # Take unique tuples.
418
412
  author_paper_affiliation_tuple_list = list(set(author_paper_affiliation_tuple_list))
419
413
 
420
- # NOTE: Step 4. Clean the affiliation strings (optional, only used if taking the aggressive approach).
414
+ # NOTE: Step 3. Clean the affiliation strings (optional, only used if taking the aggressive approach).
421
415
  if print_citing_affiliations:
422
416
  if affiliation_conservative:
423
417
  print('Taking the conservative approach. Will not need to clean the affiliation names.')
@@ -436,17 +430,17 @@ def generate_citation_map(scholar_id: str,
436
430
  # Take unique tuples.
437
431
  author_paper_affiliation_tuple_list = list(set(author_paper_affiliation_tuple_list))
438
432
 
439
- # NOTE: Step 5. Convert affiliations in plain text to Geocode.
433
+ # NOTE: Step 4. Convert affiliations in plain text to Geocode.
440
434
  coordinates_and_info = affiliation_text_to_geocode(author_paper_affiliation_tuple_list)
441
435
  # Take unique tuples.
442
436
  coordinates_and_info = list(set(coordinates_and_info))
443
437
 
444
- # NOTE: Step 6.1. Create the citation world map.
438
+ # NOTE: Step 5.1. Create the citation world map.
445
439
  citation_map = create_map(coordinates_and_info, pin_colorful=pin_colorful)
446
440
  citation_map.save(output_path)
447
441
  print('\nMap created and saved at %s.\n' % output_path)
448
442
 
449
- # NOTE: Step 6.2. Export csv file recording citation information.
443
+ # NOTE: Step 5.2. Export csv file recording citation information.
450
444
  export_csv(coordinates_and_info, csv_output_path)
451
445
  print('\nCitation information exported to %s.' % csv_output_path)
452
446
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: citation-map
3
- Version: 4.1
3
+ Version: 4.2
4
4
  Summary: A simple tool to generate your Google Scholar citation world map.
5
5
  Home-page: https://github.com/ChenLiu-1996/CitationMap
6
6
  Author: Chen Liu
@@ -35,9 +35,7 @@ Research areas: Machine Learning, Spatial-Temporal Modeling, Medical Vision, AI4
35
35
  **[Asking for advice]**
36
36
  1. This is my first time dealing with webscraping/crawling. Users have reported stability issues, and I suspect the major problems are (1) being caught by CAPTCHA or robot check, and (2) being flagged for blacklist by Google Scholar. If you are experienced in these areas and have good advice, I would highly appreciate a GitHub issue or a pull request.
37
37
 
38
- [Aug 2, 2024] Version 4.0 released >>> Logic update. A new input argument `affiliation_conservative`.
39
-
40
- - If set to True, we will use **a very conservative approach for identifying affiliations** which lead to **very high precision and lower recall**. Many thanks to [Zhijian Liu](https://github.com/zhijian-liu) for the [helpful discussion](https://github.com/ChenLiu-1996/CitationMap/issues/8).
38
+ [Aug 2, 2024] Version 4.0 released >>> Logic update. A new input argument `affiliation_conservative`. If set to True, we will use **a very conservative approach to identify affiliations** which leads to **much higher precision and lower recall**. Many thanks to [Zhijian Liu](https://github.com/zhijian-liu) for the [helpful discussion](https://github.com/ChenLiu-1996/CitationMap/issues/8).
41
39
 
42
40
  [Jul 28, 2024] Version 3.10 released >>> Logic update. Tested on a professor's profile **with 10,000 citations**!
43
41
 
@@ -5,7 +5,7 @@ with open('README.md') as f:
5
5
 
6
6
  setup(
7
7
  name='citation-map',
8
- version='4.1',
8
+ version='4.2',
9
9
  license='CC BY-NC-SA',
10
10
  author='Chen Liu',
11
11
  author_email='chen.liu.cl2482@yale.edu',
File without changes
File without changes