コード例 #1
0
ファイル: pipeline.py プロジェクト: CJC-ds/nps-twitter
def main(*args):
    try:
        twitter_user, tweet_id, flag_dict = gr(args[0])
    except Exception as e:
        print('No args passed to pipeline.py main()')
        print(e)
        twitter_user, tweet_id, flag_dict = gr()
    prep(tweet_id, flag_dict)
    dp = data_paths(tweet_id=tweet_id, twitter_user_id=twitter_user)
    tweet_html = ge(tweet_id)
    print('\nUploading to Google Big Query...')
    if flag_dict['big_query'] != 'off':
        up_gbq(tweet_id)
    print('Done.')
コード例 #2
0
ファイル: Jarvis.py プロジェクト: rog01/Chatbot_discord
async def on_message(message):
    global topic, lan, found, comment_flag
    #traduction message user
    if message.content not in ['/help', '/h']:
        ms, lan = preproc.transin(message.content)
        msg = preproc.prep(ms)
    else:
        msg = message.content

    if message.author != client.user:
        #Gestion de la conversation
        if msg in library.lib and comment_flag == False:
            if msg in ['hello'] or message.content in ['/help', '/h']:
                await message.channel.send(file=discord.File(
                    '/home/roger/anaconda3/projetIA/Chat_bot/ChatBot/robot.png'
                ))
            res = ct.chatter_bot_conv(msg)
            #reponse dans la langue user
            resp = preproc.transout(res, lan)
            await message.channel.send(resp)
        else:
            #Gestion de la recherche en bdd
            try:
                if msg not in library.lib and preproc.transout(
                        msg, 'en'
                ) != 'no' and comment_flag == False and preproc.transout(
                        msg, 'en') != 'yes':
                    topic = topic_clf.predict([msg])[0]
                    print("search", topic_clf.predict([msg])[0])
                    resp = search.find_question_answer(msg, topic)
                    found = True
                    resp = preproc.transout(resp, lan)
                    await message.channel.send(resp[:2000])
            except NameError:
                if preproc.transout(msg,
                                    'en') != 'no' and comment_flag == False:
                    response = preproc.transout(
                        'Pouvez-vous m\'en dire plus ?', lan)
                    await message.channel.send(response)
        # fin de conversation
        if found == True and msg not in library.lib and preproc.transout(
                msg, 'en') != 'no' and preproc.transout(
                    msg, 'en') != 'yes' and comment_flag == False:
            resp = preproc.transout(library.end_of_conv[0],
                                    lan) + library.end_of_conv[1]
            found = False
            await message.channel.send(resp)
        if preproc.transout(msg, 'en') == 'no' and comment_flag == False:
            resp = preproc.transout(library.bot_end_conv[0], lan)
            await message.channel.send(resp)
            comment_flag = True
        if preproc.transout(msg, 'en') != 'no' and comment_flag == True:
            feed_back.add_feeback({
                "message": message.content,
                "date": str(datetime.date.today())
            })
            comment_flag = False
コード例 #3
0
def run():
    df_pre = prep()
    df_sampled = sampler(df_pre)
    # df_reduced_dims = reduction(df_sampled)
    # quick_grapher.graph(df_reduced_dims)

    # Model fitting with SVM
    #df_B = svc(df_sampled)
    df_C = KNN(df_sampled)
コード例 #4
0
def main():
    rw = readwrite()
    trainDataset = rw.readcsv(trainFilePath)
    prepros_object = prep(test_first_level_split, test_second_level_split,
                          trainDataset)
    (first_train, first_test, second_train,
     second_test) = prepros_object.labelPaths(Routine_k)
    #each of the above four are comprised of a triple: (data, path, routine/non-routine)

    #Build the model and store it on disk
    topLevelClassifier(first_train, first_test, DirToDumpModelsTop)
    secondLevelClassifier(second_train, second_test, DirToDumpModelsSecond)
コード例 #5
0
ファイル: pipeliner.py プロジェクト: albert118/Data-Analytics
def run():
	df_pre = prep()
	#df_B = svc(df_pre)
	#df_C = KNN(df_pre)
	df_D =  NN(df_pre)