How to use the questionary.text function in questionary

To help you get started, we’ve selected a few questionary examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RasaHQ / rasa_core / rasa_core / training / interactive.py View on Github external
def _request_export_info() -> Tuple[Text, Text, Text]:
    """Request file path and export stories & nlu data to that path"""

    # export training data and quit
    questions = questionary.form(
        export_stories=questionary.text(
            message="Export stories to (if file exists, this "
                    "will append the stories)",
            default=PATHS["stories"]),
        export_nlu=questionary.text(
            message="Export NLU data to (if file exists, this will "
                    "merge learned data with previous training examples)",
            default=PATHS["nlu"]),
        export_domain=questionary.text(
            message="Export domain file to (if file exists, this "
                    "will be overwritten)",
            default=PATHS["domain"]),
    )

    answers = questions.ask()
    if not answers:
        sys.exit()

    return (answers["export_stories"],
            answers["export_nlu"],
            answers["export_domain"])
github RasaHQ / rasa / rasa / core / training / interactive.py View on Github external
async def _request_free_text_intent(sender_id: Text, endpoint: EndpointConfig) -> Text:
    question = questionary.text(
        message="Please type the intent name:",
        validate=io_utils.not_empty_validator("Please enter an intent name"),
    )
    return await _ask_questions(question, sender_id, endpoint)
github botfront / rasa-for-botfront / rasa / core / channels / console.py View on Github external
def get_cmd_input(button_question: questionary.Question) -> Text:
    if button_question is not None:
        response = rasa.cli.utils.payload_from_button_question(button_question)
    else:
        response = questionary.text(
            "",
            qmark="Your input ->",
            style=Style([("qmark", "#b373d6"), ("", "#b373d6")]),
        ).ask()

    if response is not None:
        return response.strip()
github RasaHQ / rasa / rasa / core / training / interactive.py View on Github external
def _request_export_info() -> Tuple[Text, Text, Text]:
    """Request file path and export stories & nlu data to that path"""

    # export training data and quit
    questions = questionary.form(
        export_stories=questionary.text(
            message="Export stories to (if file exists, this "
            "will append the stories)",
            default=PATHS["stories"],
            validate=io_utils.file_type_validator(
                [".md"],
                "Please provide a valid export path for the stories, e.g. 'stories.md'.",
            ),
        ),
        export_nlu=questionary.text(
            message="Export NLU data to (if file exists, this will "
            "merge learned data with previous training examples)",
            default=PATHS["nlu"],
            validate=io_utils.file_type_validator(
                [".md", ".json"],
                "Please provide a valid export path for the NLU data, e.g. 'nlu.md'.",
            ),
        ),
        export_domain=questionary.text(
            message="Export domain file to (if file exists, this "
            "will be overwritten)",
            default=PATHS["domain"],
            validate=io_utils.file_type_validator(
                [".yml", ".yaml"],
                "Please provide a valid export path for the domain file, e.g. 'domain.yml'.",
            ),
github abhinavkashyap / sciwing / sciwing / commands / file_gen_utils.py View on Github external
def _get_debug_dataset_proportion():
        debug_dataset_proportion = questionary.text(
            message="Enter Proportion of dataset for debug: ", default="0.1"
        ).ask()
        debug_dataset_proportion = float(debug_dataset_proportion)
        return debug_dataset_proportion
github msdslab / automated-systematic-review / asreview / review / oracle.py View on Github external
def _papers_from_finder(self, state):
        "Find papers using a fuzzy finder in the available records."
        keywords = questionary.text(
            'Find papers using keywords/authors/title:'
        ).ask()

        if keywords is None:
            return

        paper_idx = self.as_data.fuzzy_find(keywords, exclude=self.train_idx)

        # Get the (possibly) relevant papers.
        choices = []
        for idx in paper_idx:
            choices.append(self.as_data.preview_record(idx,
                                                       automatic_width=True))
        choices.extend([questionary.Separator(), "Return"])

        # Stay in the same menu until no more options are left
github abhinavkashyap / sciwing / sciwing / commands / file_gen_utils.py View on Github external
def _get_char_start_token():
        char_start_token = questionary.text(
            message="Enter the start token to be used for characters", default=" "
        ).ask()
        return char_start_token
github RasaHQ / rasa_core / rasa_core / training / interactive.py View on Github external
def _request_free_text_intent(
    sender_id: Text,
    endpoint: EndpointConfig
) -> Text:
    question = questionary.text("Please type the intent name")
    return _ask_or_abort(question, sender_id, endpoint)
github botfront / rasa-for-botfront / rasa / cli / configure.py View on Github external
def configure_channel(channel):
    from rasa_core.utils import print_error, print_success
    import rasa_core.utils

    credentials_file = questionary.text(
        "Please enter a path where to store the credentials file",
        default="credentials.yml").ask()

    if channel == "facebook":
        fb_config = questionary.form(
            verify=questionary.text(
                "Facebook verification string (choosen during "
                "webhook creation)"),
            secret=questionary.text(
                "Facebook application secret"),
            access_token=questionary.text(
                "Facebook access token"),
        ).ask()

        credentials = {
            "verify": fb_config["verify"],
            "secret": fb_config["secret"],
            "page-access-token": fb_config["access_token"]}

        rasa_core.utils.dump_obj_as_yaml_to_file(
            credentials_file,
            {"facebook": credentials}
        )
        print_success("Created facebook configuration and added it to '{}'."
                      "".format(os.path.abspath(credentials_file)))
    else:
        print_error("Pieee...Rumble...ERROR! Configuration of this channel "
github botfront / rasa-for-botfront / rasa / core / training / interactive.py View on Github external
def _request_export_info() -> Tuple[Text, Text, Text]:
    """Request file path and export stories & nlu data to that path"""

    # export training data and quit
    questions = questionary.form(
        export_stories=questionary.text(
            message="Export stories to (if file exists, this "
            "will append the stories)",
            default=PATHS["stories"],
            validate=io_utils.file_type_validator(
                [".md"],
                "Please provide a valid export path for the stories, e.g. 'stories.md'.",
            ),
        ),
        export_nlu=questionary.text(
            message="Export NLU data to (if file exists, this will "
            "merge learned data with previous training examples)",
            default=PATHS["nlu"],
            validate=io_utils.file_type_validator(
                [".md", ".json"],
                "Please provide a valid export path for the NLU data, e.g. 'nlu.md'.",
            ),