scribe-org / Scribe-Data

Wikidata, Wiktionary and Wikipedia language data extraction
GNU General Public License v3.0
26 stars 55 forks source link

Add functionality to re-ask user for an option to the Scribe-Data interactive mode #209

Open andrewtavis opened 4 days ago

andrewtavis commented 4 days ago

Terms

Description

The Scribe-Data interactive mode can be accessed in the following way:

scribe-data get -i

With this the user is prompted to select options that would be appropriate to get the data that they need. One thing that's missing is functionality to re-ask the user for a response if they did not provide one. If the user provides an invalid response, then the program should error, but if the user just hits enter then they should be asked the same question again - i.e.:

$ scribe-data get -i
Welcome to Scribe-Data interactive mode!

Language options:
1. English
2. French
3. German
...

Please enter the languages to get data for, their numbers or (a) for all languages:

# User hits enter, and what should follow is...

Language options:
1. English
2. French
3. German
...

Please enter the languages to get data for, their numbers or (a) for all languages:

Contribution

Happy to support this with a review and answer any questions a contributor might have!

KesharwaniArpita commented 4 days ago

@andrewtavis I have an idea for this. I think if we update the interactive.py with the following changes we will be able to add the functionality to re-ask the user for a response if they haven't provided one:

  1. Modify the get_selection() function to re-ask for input if no valid input is provided.
  2. Add a loop in the select_languages() and select_data_types() functions to handle re-asking the question.
  3. Make the output options prompt also re-ask the user in case of an empty response.
andrewtavis commented 4 days ago

Sounds great, @KesharwaniArpita! Let's finish the other issue and then we can move on to this one :)

omoladd commented 4 days ago

Hi @andrewtavis , I'm interested in this. Can you assign this to me?

KesharwaniArpita commented 4 days ago

Hi @omoladd, I was very curious about how to solve this issue and tried to tweak the existing functions a little bit in the day. Since you also seem interested would you like to take a look into the PR and see if it can be improved your suggestion would mean a lot.

omoladd commented 3 days ago

@KesharwaniArpita, I didn’t realize you already responded. I opened a PR too; https://github.com/scribe-org/Scribe-Data/pull/239

KesharwaniArpita commented 3 days ago

Great. Would love to colab!!!

omoladd commented 3 days ago

Sure! We can communicate better on matrix.