Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Will Yoshida <[email protected]>
  • Loading branch information
andrewtavis and wkyoshida authored Dec 15, 2024
1 parent e1553f8 commit e5d68f7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/scribe_data/cli/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def download_wrapper(

user_response = (
input(
"We'll using lexeme dump from dumps.wikimedia.org/wikidatawiki/entities."
"Do you want to Use it? (Yes/Cancel): "
"We'll be using the wikidata lexeme dump from dumps.wikimedia.org/wikidatawiki/entities."
"Do you want to proceed? (Yes/Cancel): "
)
.strip()
.lower()
Expand Down
6 changes: 3 additions & 3 deletions src/scribe_data/cli/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ def get_data(
if all:
# Using wikimedia lexeme based dump

if wiki_dump:
if wikidata_dump:
print("wiki_dump", wiki_dump)
download_wrapper(None, wiki_dump)
else:
print("Using wikimedia lexeme dump...")
print("Using wikidata lexeme dump...")
file_path = download_wrapper()
if isinstance(file_path, str) and file_path:
rprint("[bold green]we'll use this lexeme dump[/bold green]", file_path)
rprint("[bold green]We'll use the following lexeme dump[/bold green]", file_path)
rprint(
"[bold red]Parsing lexeme dump feature will be available soon...[/bold red]"
)
Expand Down
4 changes: 2 additions & 2 deletions src/scribe_data/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def main() -> None:
)
get_parser.add_argument(
"-wd",
"--wikidata-dump",
"--wikidata-dump-path",
type=str,
help="Path to a local Wikidata lexemes dump required for running with '--all'.",
)
Expand Down Expand Up @@ -285,7 +285,7 @@ def main() -> None:
download_parser._actions[0].help = "Show this help message and exit."
download_parser.add_argument(
"-wd",
"--wikidata-dump",
"--wikidata-dump-version",
nargs="?",
const="latest",
help="Download Wikidata dump. Optionally specify date in YYYYMMDD format.",
Expand Down
6 changes: 3 additions & 3 deletions src/scribe_data/wiktionary/wikitionary_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def download_wiki_lexeme_dump(target_entity="latest-lexemes"):
Args:
target_entity (str, optional): The target dump to download. Defaults to "latest-lexemes".
- If "latest-lexemes", downloads the latest dump.
- If a valid date (e.g., YYYY/MM/DD), attempts to download the dump for that date.
- If a valid date (e.g., YYYYMMDD), attempts to download the dump for that date.
Returns:
str: The URL of the requested or closest available dump.
Expand Down Expand Up @@ -138,7 +138,7 @@ def try_old_dump(target_entity):
print(
f"HTTP error occurred: {http_err} Status code: {http_err.response.status_code}"
)
print("We could not found for your requested lexeme dump wikitionary.")
print("We could not find your requested wikidata lexeme dump.")

response = requests.get(base_url)
other_old_dumps = re.findall(r'href="([^"]+)/"', response.text)
Expand All @@ -156,7 +156,7 @@ def try_old_dump(target_entity):
target_entity, other_old_dumps, try_old_dump
)
print(
f"\nAvailable Closest old dumps(yyyy/mm/dd): {parse_date(closest_date)}"
f"\nClosest available older dumps(YYYYMMDD): {parse_date(closest_date)}"
)
fileurl = f"{closest_date}/wikidata-{closest_date}-lexemes.json.bz2"
if closest_date:
Expand Down

0 comments on commit e5d68f7

Please sign in to comment.