def main(inp_fname, move_info_fname, output_fname):
    inp, move_info = getData(inp_fname, move_info_fname)
    fw = open(output_fname, "w")
    for txt, player in zip(inp, move_info):
        out = postprocess.postProcess(txt, player=player)
        fw.write(out + "\n")
    fw.close()
Exemple #2
0
def predict():
    # Pre-process Data
    print('Started predict')
    sm9_data_with_RITM, sm9_data_without_RITM = preprocess.getSM9TestData(
        os.path.join(path.DIR_NAME, path.SM9_TEST_DATA))
    sn_data = preprocess.getServiceNowTestData(
        os.path.join(path.DIR_NAME, path.SERVICE_NOW_TEST_DATA))
    merged_data_with_cat_item, merged_data_without_cat_item = preprocess.mergeTestData(
        sm9_data_with_RITM, sn_data)
    sm9_data_without_RITM, merged_data_without_cat_item = preprocess.prepareDataByRBCTitle(
        sm9_data_without_RITM, merged_data_without_cat_item)
    #     sm9_data_without_RITM = sm9_data_without_RITM[['RBC Line Item Title']]
    #     merged_data_without_cat_item = merged_data_without_cat_item[['RBC Line Item Title']]
    tickets_by_title = pd.concat(
        [sm9_data_without_RITM, merged_data_without_cat_item])
    sorted_analyst_prob_by_item = predictModelByCatItem(
        merged_data_with_cat_item['cat_item'],
        os.path.join(path.DIR_NAME, path.CAT_ITEM_MODEL),
        os.path.join(path.DIR_NAME, path.COUNT_VEC_CAT_ITEM))
    cat_item_ticket_recommendations = postprocess.postProcess(
        sorted_analyst_prob_by_item, merged_data_with_cat_item)
    sorted_analyst_prob_by_title = predictModelByTitle(
        tickets_by_title['RBC Line Item Title'],
        os.path.join(path.DIR_NAME, path.RBC_TITLE_MODEL),
        os.path.join(path.DIR_NAME, path.COUNT_VEC_BY_TITLE))
    rbc_title_ticket_recommendations = postprocess.postProcess(
        sorted_analyst_prob_by_title, tickets_by_title)
    ticket_recommendations = pd.concat(
        [cat_item_ticket_recommendations, rbc_title_ticket_recommendations])
    recommendations = "tickets_recommendations_" + datetime.datetime.today(
    ).strftime('%Y-%m-%d') + ".xlsx"
    filename = os.path.join(path.DIR_NAME, path.RECOMMENDATIONS_DIR,
                            recommendations)
    #     filename = "tickets_recommendation_" + datetime.datetime.now().isoformat() + ".xlsx"
    # Prefarably save as excel
    # ticket_recommendations.to_csv(path_or_buf=filename  , encoding="Latin-1" , index = False)
    # ticket_recommendations.to_excel(path_or_buf=filename , index = False)
    # Save as excel
    writer = pd.ExcelWriter(filename, engine='xlsxwriter')
    ticket_recommendations.to_excel(writer, 'Sheet1', index=False)
    writer.save()
    print('Ended predict')
Exemple #3
0
def compute(pool, namespace=''):
    # 5th pass: High-level descriptors that depend on others, but we
    #              don't need to stream the audio anymore

    # Average Level
    from level import levelAverage
    levelAverage(pool, namespace)

    # SFX Descriptors
    sfxPitch(pool, namespace)

    # Tuning System Features
    tuningSystemFeatures(pool, namespace)

    # Pool Cleaning (removing temporary descriptors):
    tonalPoolCleaning(pool, namespace)

    # Add missing descriptors which are not computed yet, but will be for the
    # final release or during the 1.x cycle. However, the schema need to be
    # complete before that, so just put default values for these.
    postProcess(pool, namespace)
Exemple #4
0
def compute(pool, namespace=''):
    # 5th pass: High-level descriptors that depend on others, but we
    #              don't need to stream the audio anymore

    # Average Level
    from level import levelAverage
    levelAverage(pool, namespace)

    # SFX Descriptors
    sfxPitch(pool, namespace)

    # Tuning System Features
    tuningSystemFeatures(pool, namespace)

    # Pool Cleaning (removing temporary descriptors):
    tonalPoolCleaning(pool, namespace)

    # Add missing descriptors which are not computed yet, but will be for the
    # final release or during the 1.x cycle. However, the schema need to be
    # complete before that, so just put default values for these.
    postProcess(pool, namespace)