Emanuela Boros commited on
Commit
4697040
1 Parent(s): 516cd0a

added lang

Browse files
Files changed (1) hide show
  1. generic_nel.py +2 -2
generic_nel.py CHANGED
@@ -26,7 +26,7 @@ def get_wikipedia_page_props(input_str: str):
26
  page_name = page_name.strip()
27
  language = language.strip()
28
  except ValueError:
29
- return "Invalid input format. Use 'page_name >> language'."
30
 
31
  wikipedia_url = f"https://{language}.wikipedia.org/w/api.php"
32
  wikipedia_params = {
@@ -50,7 +50,7 @@ def get_wikipedia_page_props(input_str: str):
50
  page_props = data["query"]["pages"][page_id]["pageprops"]
51
 
52
  if "wikibase_item" in page_props:
53
- return page_props["wikibase_item"]
54
  else:
55
  return qid, language
56
  else:
 
26
  page_name = page_name.strip()
27
  language = language.strip()
28
  except ValueError:
29
+ return "Invalid input format. Use 'page_name >> language'.", "None"
30
 
31
  wikipedia_url = f"https://{language}.wikipedia.org/w/api.php"
32
  wikipedia_params = {
 
50
  page_props = data["query"]["pages"][page_id]["pageprops"]
51
 
52
  if "wikibase_item" in page_props:
53
+ return page_props["wikibase_item"], language
54
  else:
55
  return qid, language
56
  else: