def answerer(kwik_e_mart_app_path, es_client):
    QuestionAnswerer.load_kb(app_namespace='kwik_e_mart', index_name='store_name',
                             data_file=STORE_DATA_FILE_PATH)
    es_client.indices.flush(index='_all')

    qa = QuestionAnswerer(kwik_e_mart_app_path)
    return qa
def food_ordering_answerer(food_ordering_app_path, es_client):
    QuestionAnswerer.load_kb(app_namespace='food_ordering', index_name='menu_items',
                             data_file=DISH_DATA_FILE_PATH)
    es_client.indices.flush(index='_all')

    qa = QuestionAnswerer(food_ordering_app_path)
    return qa
def food_ordering_answerer(food_ordering_app_path, es_client):
    QuestionAnswerer.load_kb(
        app_namespace="food_ordering",
        index_name="menu_items",
        data_file=DISH_DATA_FILE_PATH,
    )

    qa = QuestionAnswerer(food_ordering_app_path)
    return qa
def answerer(kwik_e_mart_app_path, es_client):
    QuestionAnswerer.load_kb(
        app_namespace="kwik_e_mart",
        index_name="store_name",
        data_file=STORE_DATA_FILE_PATH,
    )

    qa = QuestionAnswerer(kwik_e_mart_app_path)
    return qa
def relative_answerer(kwik_e_mart_app_path, es_client):
    QuestionAnswerer.load_kb(app_namespace='kwik_e_mart', index_name='store_name',
                             data_file=STORE_DATA_FILE_PATH)
    es_client.indices.flush(index='_all')
    old_cwd = os.getcwd()
    os.chdir(kwik_e_mart_app_path)
    qa = QuestionAnswerer('.')
    os.chdir(old_cwd)
    return qa
def relative_answerer(kwik_e_mart_app_path, es_client):
    QuestionAnswerer.load_kb(
        app_namespace="kwik_e_mart",
        index_name="store_name",
        data_file=STORE_DATA_FILE_PATH,
    )
    old_cwd = os.getcwd()
    os.chdir(kwik_e_mart_app_path)
    qa = QuestionAnswerer(".")
    os.chdir(old_cwd)
    return qa
Beispiel #7
0
def food_ordering_answerer_nativeqa(food_ordering_app_path):
    QA_CONFIG = {
        "model_type": "native",
        "model_settings": {
            "query_type": "keyword"
        }
    }
    QuestionAnswerer.load_kb(app_namespace="food_ordering",
                             index_name="menu_items",
                             data_file=DISH_DATA_FILE_PATH,
                             config=QA_CONFIG)

    qa = QuestionAnswerer(food_ordering_app_path)
    return qa
Beispiel #8
0
def answerer_nativeqa(kwik_e_mart_app_path):
    QA_CONFIG = {
        "model_type": "native",
        "model_settings": {
            "query_type": "keyword"
        }
    }
    QuestionAnswerer.load_kb(app_namespace="kwik_e_mart",
                             index_name="store_name",
                             data_file=STORE_DATA_FILE_PATH,
                             config=QA_CONFIG)

    qa = QuestionAnswerer(kwik_e_mart_app_path)
    return qa
def food_ordering_with_glove(food_ordering_app_path, es_client):
    glove_qa_config = {
        "model_type": "embedder",
        "model_settings": {
            "embedder_type": "glove",
            "embedding_fields": {"menu_items_glove": ["name"]},
        },
    }
    QuestionAnswerer.load_kb(
        app_namespace="food_ordering",
        index_name="menu_items_glove",
        data_file=DISH_DATA_FILE_PATH,
        config=glove_qa_config,
    )

    qa = QuestionAnswerer(food_ordering_app_path, config=glove_qa_config)
    return qa
def food_ordering_with_glove_without_elasticsearch(food_ordering_app_path):
    glove_qa_config = {
        "model_type": "native",
        "model_settings": {
            "query_type": "embedder",
            "embedder_type": "glove",
            "embedding_fields": {"menu_items_bert": ["name"]},
        }
    }
    QuestionAnswerer.load_kb(
        app_namespace="food_ordering",
        index_name="menu_items_glove",
        data_file=DISH_DATA_FILE_PATH,
        config=glove_qa_config,
    )

    qa = QuestionAnswerer(food_ordering_app_path, config=glove_qa_config)
    return qa
def relative_answerer_without_elasticsearch(kwik_e_mart_app_path):
    QA_CONFIG = {
        "model_type": "native",
        "model_settings": {
            "query_type": "keyword"
        }
    }
    QuestionAnswerer.load_kb(
        app_namespace="kwik_e_mart",
        index_name="store_name",
        data_file=STORE_DATA_FILE_PATH,
        config=QA_CONFIG
    )
    old_cwd = os.getcwd()
    os.chdir(kwik_e_mart_app_path)
    qa = QuestionAnswerer(".")
    os.chdir(old_cwd)
    return qa
Beispiel #12
0
def answerer_nativeqa_unloaded(kwik_e_mart_app_path):
    QA_CONFIG = {
        "model_type": "native",
        "model_settings": {
            "query_type": "keyword"
        }
    }

    # first load the KB
    QuestionAnswerer.load_kb(app_namespace="kwik_e_mart",
                             index_name="store_name",
                             data_file=STORE_DATA_FILE_PATH,
                             config=QA_CONFIG)

    # next unload all indices and instantiate another object
    NativeQuestionAnswerer._unload_all_indices()
    qa = QuestionAnswerer(kwik_e_mart_app_path, config=QA_CONFIG)
    return qa
Beispiel #13
0
def food_ordering_with_bert_nativeqa_unloaded(food_ordering_app_path):
    bert_qa_config = {
        "model_type": "native",
        "model_settings": {
            "query_type": "embedder",
            "embedder_type": "bert",
            "embedding_fields": {
                "menu_items_bert": ["name"]
            },
        }
    }

    # first load the KB
    QuestionAnswerer.load_kb(
        app_namespace="food_ordering",
        index_name="menu_items_bert",
        data_file=DISH_DATA_FILE_PATH,
        config=bert_qa_config,
    )

    # next unload all indices and instantiate another object
    NativeQuestionAnswerer._unload_all_indices()
    qa = QuestionAnswerer(food_ordering_app_path, config=bert_qa_config)
    return qa