[{'role': 'system', 'content': "You are an expert in machine learning and your task is to classify the code snippets into categories from the provided list of categories. List of categories: ['helper_functions', 'load_data', 'data_exploration', 'data_preprocessing', 'evaluation', 'modelling', 'prediction', 'result_visualization', 'save_results', 'comment_only']"}, {'role': 'user', 'content': 'Identify to which category the provided code belongs and assign the code snippet to at least 1 but up to 5 categories based on the probabilities, ignore if the probability of the category is negligible. Strictly provide your response as a list. Avoid providing any additional information, commentary, or personal opinions.\\nPython Code:#Copying Simple NLP notebook over here:\n\nimport os\nimport csv\nimport json\nimport string\nimport keras\nfrom pandas.io.json import json_normalize\nimport matplotlib.pyplot as plt\nimport seaborn as sns\ncolor = sns.color_palette()\nfrom math import floor\nimport spacy\n\n%matplotlib inline\n\nfrom plotly import tools\nimport plotly.offline as py\npy.init_notebook_mode(connected=True)\nimport plotly.graph_objs as go\n\nfrom sklearn import model_selection, preprocessing, metrics, ensemble, naive_bayes, linear_model\nfrom sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer\nfrom sklearn.decomposition import TruncatedSVD\nfrom sklearn.ensemble import RandomForestClassifier\nimport lightgbm as lgb\n\nimport time\nfrom tqdm import tqdm\nimport math\nfrom sklearn.model_selection import train_test_split\nimport regex as re\n\nimport nltk \nfrom nltk.corpus import stopwords, wordnet\nfrom nltk.tokenize import word_tokenize, sent_tokenize \n\nnlp = spacy.load(\'en_core_web_sm\')\n\ndef word_locate(sentence, location): \n    count_words = 0\n    count_chars = 2 #2 is to count for the two spaces in the beginning\n    for word in sentence.split():\n        count_words += 1\n        if location == count_chars:\n            return word, count_words\n        count_chars += len(word)\n        count_chars += 1 #for space\n        \ndef name_btwn_paran(sentence):\n    capture = ""\n    trigger_on = 0\n    for char in sentence:\n        if char == ")":\n            trigger_on = 0\n        if trigger_on == 1:\n            capture += char\n        if char == "(":\n            trigger_on = 1\n    return capture\n\ndef which_name_first(sentence, name1, name2): #If name1 is first, return True\n    name1_check = 0\n    for word_punct in sentence.split():\n        for word_comma in word_punct.split(";"):\n            for word in word_comma.split(","):\n                if word == name2 and name1_check == 0:\n                    return False\n                if word == name1:\n                    name1_check = 1\n    return True\n\ndef curr_prev_sentence(sentence, loc):\n    current_sentence = ""\n    prev_sentence = ""\n    trunc_curr_sentence = ""\n    remainder_curr = ""\n    detect = 0\n    count = 0\n    for char in sentence:\n        count += 1\n        current_sentence += char\n        remainder_curr += char\n        if ((char == "." or char == ";") and detect == 0 and sentence[count] != ","): #the last arguement to prevent ., as in sent #4\n            prev_sentence = current_sentence \n            current_sentence = ""\n        if char == "." and detect == 1:\n            return current_sentence, prev_sentence, trunc_curr_sentence, remainder_curr\n        if count == loc:\n            detect = 1\n            trunc_curr_sentence = current_sentence\n            remainder_curr = ""\n    return current_sentence, prev_sentence, trunc_curr_sentence, remainder_curr\n\ndef remove_last_word(sentence):\n    new_sent = sentence.split()\n    new_sent = new_sent[:-1]\n    return " ".join(new_sent)\n\ndef check_if_capital(word):\n    if word[0] in ["A","B","C","D","E","F","G","H","I","J","K","L","M","O","P","Q","R","S","T","U","V","W","X","Y","Z"]:\n        return True\n    else:\n        return False\n    \ndef list_of_name_words(tokenized):\n    names_list = []\n    for word_tuple in nltk.pos_tag(tokenized):\n        if word_tuple[1] == "NNP":\n            names_list.append(word_tuple[0])\n    return names_list\n\ndef check_if_name(tokenized,word):\n    text = tokenized\n    for word_tuple in nltk.pos_tag(text):\n        if word_tuple[0] == word:\n            if word_tuple[1] == "NNP":\n                return True\n            else:\n                return False\n            \ndef find_name_words(sentence):\n    name = "none"\n    for word in sentence.split():\n        if check_if_capital(word):\n            return word\n    return name\n\ndef remove_first_word(sentence):\n    new_sent = sentence.split()\n    new_sent = new_sent[1:]\n    return " ".join(new_sent)\n\ndef find_nth_subj(doc, n): #finds subject number n\n    subject = "none"\n    count = 0\n    for token in doc:\n        if (token.dep_ == "nsubj" or token.dep_ == "nsubjpass"):\n            count += 1\n            if count == n:\n                subject = token.text\n    return subject\n\ndef find_nth_dobj(doc, n): #finds direct object number n\n    dobj = "none"\n    count = 0\n    for token in doc:\n        if (token.dep_ == "dobj"):\n            count += 1\n            if count == n:\n                dobj = token.text\n    return dobj\n\ndef find_nth_poss(doc, n): #finds possessing noun number n\n    poss = "none"\n    count = 0\n    for token in doc:\n        if (token.dep_ == "poss"):\n            count += 1\n            if count == n:\n                poss = token.text\n    return poss\n\ndef find_nth_appos(doc, n): #finds appos number n; sometimes Spacy mislabels nsubj as appos\n    appos = "none"\n    count = 0\n    for token in doc:\n        if (token.dep_ == "appos"):\n            count += 1\n            if count == n:\n                appos = token.text\n    return appos\n\ndef check_if_poss_her(doc, pronoun): #tells whether it is her as in his or her as in him\n    #assumes only one her in the whole sentence (inaccurate?)\n    for token in doc:\n        if token.text == pronoun:\n            if token.dep_ == "poss":\n                return True\n            else:\n                return False\n            \nif 1 == 1:    \n    def get_feature_vector(pronoun, text, A, B, proffset, inquiry_part = "A"):\n        row = {}\n        row[\'A\'] = A\n        row[\'B\'] = B\n        curr, prev, trunc_curr, remainder = curr_prev_sentence(text, proffset)\n        curr_doc = nlp(curr)\n        prev_doc = nlp(prev) \n        curr_tok = word_tokenize(curr)\n        prev_tok = word_tokenize(prev)\n        trunc_curr_tok = word_tokenize(trunc_curr)\n        train_vector = []\n        #get first subj in prev @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_p_f_s = "none"\n        for n in [1,2,3,4,5]: #number of n is from common sense\n            dummy_p_f_s = find_nth_subj(prev_doc,n)\n            if check_if_name(prev_tok,dummy_p_f_s) and get_p_f_s == "none":\n                get_p_f_s = dummy_p_f_s\n        \n        ####For sentence no. 5, spacy and nltk both failed to identify Collins as a propn.\n        ### therefore, we will add a new line here making sure we have a name.\n        \n        if get_p_f_s == "none":\n            if check_if_capital(find_nth_subj(prev_doc,1)):\n                get_p_f_s = find_nth_subj(prev_doc,1)\n        \n        ### We are changing the feature conditions in this kernel (1st of fork of simple nlp):\n        if get_p_f_s in row[inquiry_part] or row[inquiry_part] in get_p_f_s:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get last  subj in prev @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_p_l_s = "none"\n        for n in [1,2,3,4,5]:\n            dummy_p_l_s = find_nth_subj(prev_doc,n)\n            if check_if_name(prev_tok,dummy_p_l_s):\n                get_p_l_s = dummy_p_l_s\n               \n        ### pls Random forest classifier label special line:\n        if get_p_l_s in row[inquiry_part] or row[inquiry_part] in get_p_l_s:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get first  obj in prev @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_p_f_o = "none"\n        for n in [1,2,3,4,5]: \n            dummy_p_f_o = find_nth_dobj(prev_doc,n)\n            if check_if_name(prev_tok,dummy_p_f_o) and get_p_f_o == "none":\n                get_p_f_o = dummy_p_f_o\n          \n        ### pfo Random forest classifier label special line:\n        if get_p_f_o in row[inquiry_part] or row[inquiry_part] in get_p_f_o:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n            \n        #get last  dobj in prev @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_p_l_o = "none"\n        for n in [1,2,3,4,5]: \n            dummy_p_l_o = find_nth_dobj(prev_doc,n)\n            if check_if_name(prev_tok,dummy_p_l_o):\n                get_p_l_o = dummy_p_l_o\n          \n        ### plo Random forest classifier label special line:\n        if get_p_l_o in row[inquiry_part] or row[inquiry_part] in get_p_l_o: \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get last  subj in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_l_s = "none"\n        for n in [1,2,3,4]:\n            dummy_tc_l_s = find_nth_subj(curr_doc,n)\n            if check_if_name(curr_tok,dummy_tc_l_s)\\\\\n                    and (dummy_tc_l_s in trunc_curr): #this is slightly inaccurate but oh well\n                get_tc_l_s = dummy_tc_l_s \n        \n        ### tcls Random forest classifier label special line:\n        if get_tc_l_s in row[inquiry_part] or row[inquiry_part] in get_tc_l_s: \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n            \n        #get last  dobj in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_l_o = "none"\n        for n in [1,2,3,4]:\n            dummy_tc_l_o = find_nth_dobj(curr_doc,n)\n            if (dummy_tc_l_o in trunc_curr)\\\\\n                                        and check_if_name(curr_tok,dummy_tc_l_o): \n                get_tc_l_o = dummy_tc_l_o \n         \n        ### tclo Random forest classifier label special line:\n        if get_tc_l_o in row[inquiry_part] or row[inquiry_part] in get_tc_l_o: \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get last  poss in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_l_p = "none"\n        for n in [1,2,3,4]:\n            dummy_tc_l_p = find_nth_poss(curr_doc,n)\n            if (dummy_tc_l_p in trunc_curr)\\\\\n                                        and check_if_name(curr_tok,dummy_tc_l_p): \n                get_tc_l_p = dummy_tc_l_p \n        \n        ### tclp Random forest classifier label special line:\n        if get_tc_l_p in row[inquiry_part] or row[inquiry_part] in get_tc_l_p:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get first subj in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_f_s = "none"\n        for n in [1,2,3,4]:\n            dummy_tc_f_s = find_nth_subj(curr_doc,n)\n            if check_if_name(curr_tok,dummy_tc_f_s) and get_tc_f_s == "none":\n                get_tc_f_s = dummy_tc_f_s \n           \n        ### tcfs Random forest classifier label special line:\n        if get_tc_f_s in row[inquiry_part] or row[inquiry_part] in get_tc_f_s:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n            \n        #get first dobj in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_f_o = "none"\n        for n in [1,2,3,4]:\n            dummy_tc_f_o = find_nth_dobj(curr_doc,n)\n            if check_if_name(curr_tok,dummy_tc_f_o) and get_tc_f_o == "none": \n                get_tc_f_o = dummy_tc_f_o \n          \n        ### tcfo Random forest classifier label special line:\n        if get_tc_f_o in row[inquiry_part] or row[inquiry_part] in get_tc_f_o:  \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n    \n        #get last  non-subj name word  in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_l_nw = "none"\n        candidate = "none"\n        tc_name_words = list_of_name_words(trunc_curr_tok) \n        if len(tc_name_words) > 0:\n            candidate = tc_name_words[-1]\n        if candidate in get_tc_f_s or candidate in get_tc_l_s:\n            if len(tc_name_words) > 1:\n                candidate = tc_name_words[-1]\n        if check_if_name(curr_tok,candidate):\n            get_tc_l_nw = candidate\n        \n        ### tclnw Random forest classifier label special line:\n        if get_tc_l_nw in row[inquiry_part] or row[inquiry_part] in get_tc_l_nw: \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get first aposs in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_f_a = "none"\n        for n in [1,2,3,4]:\n            dummy_tc_f_a = find_nth_appos(curr_doc,n)\n            if check_if_name(curr_tok,dummy_tc_f_a) and get_tc_f_a == "none": \n                get_tc_f_a = dummy_tc_f_a \n         \n        ### tcfa Random forest classifier label special line:\n        if get_tc_f_a in row[inquiry_part] or row[inquiry_part] in get_tc_f_a: \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n    \n        #get word btwn paranthesis in prev @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_p_f_wp = find_name_words(name_btwn_paran(prev))\n          \n        ### pfwp Random forest classifier label special line:\n        if get_p_f_wp in row[inquiry_part] or row[inquiry_part] in get_p_f_wp:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n            \n        #get word btwn paranthesis in trunc curr @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_tc_l_wp = find_name_words(name_btwn_paran(curr))  \n              \n        ### tclwp Random forest classifier label special line:\n        if get_tc_l_wp in row[inquiry_part] or row[inquiry_part] in get_tc_l_wp: \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n            \n        #get last subj in remainder @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_r_f_s = "none"\n        for n in [1,2,3,4,5,6,7,8]: #in the final version, each of the name subjects will be accunted for\n            dummy_r_f_s = find_nth_subj(curr_doc,n)\n            if dummy_r_f_s in remainder and check_if_name(curr_tok,dummy_r_f_s):\n                get_r_f_s = dummy_r_f_s \n           \n        ### rfs Random forest classifier label special line:\n        if get_r_f_s in row[inquiry_part] or row[inquiry_part] in get_r_f_s:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n            \n        #get last dobj in remainder @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_r_f_o = "none"\n        for n in [1,2,3,4,5,6,7,8]: #in the final version, each of the name objects will be accunted for\n            dummy_r_f_o = find_nth_dobj(curr_doc,n)\n            if dummy_r_f_o in remainder and check_if_name(curr_tok,dummy_r_f_o):\n                get_r_f_o = dummy_r_f_o \n              \n        ### rfo Random forest classifier label special line:\n        if get_r_f_o in row[inquiry_part] or row[inquiry_part] in get_r_f_o:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n            \n        #get last appos in remainder @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_r_f_a = "none"\n        for n in [1,2,3,4]:\n            dummy_r_f_a = find_nth_appos(curr_doc,n)\n            if dummy_r_f_a in remainder and check_if_name(curr_tok,dummy_r_f_a): \n                get_r_f_a = dummy_r_f_a \n          \n        ### rfa Random forest classifier label special line:\n        if get_r_f_a in row[inquiry_part] or row[inquiry_part] in get_r_f_a:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get first appos in current @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_c_f_a = "none"\n        for n in [1,2,3,4]:\n            dummy_c_f_a = find_nth_appos(curr_doc,n)\n            if check_if_name(curr_tok,dummy_c_f_a) and get_c_f_a == "none": \n                get_c_f_a = dummy_c_f_a \n               \n        ### cfa Random forest classifier label special line:\n        if get_c_f_a in row[inquiry_part] or row[inquiry_part] in get_c_f_a: \n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n        \n        #get first appos in prev @@@@@@@@@@@@@@@@@@@@@@@@@@@\n        get_p_f_a = "none"\n        for n in [1,2,3,4]:\n            dummy_p_f_a = find_nth_appos(prev_doc,n)\n            if check_if_name(prev_tok,dummy_p_f_a) and get_p_f_a == "none": \n                get_p_f_a = dummy_p_f_a \n              \n        ### pfa Random forest classifier label special line:\n        if get_p_f_a in row[inquiry_part] or row[inquiry_part] in get_p_f_a:\n            train_vector.append(1)\n        else:\n            train_vector.append(0)\n    \n        #check_if_poss_her\n        get_poss_her = check_if_poss_her(curr_doc, pronoun)\n        \n        #rand_forest classifier for pronoun type:\n        if pronoun == "he" or pronoun == "she": \n            train_vector.append(1)\n        elif pronoun == "He" or pronoun == "She": \n            train_vector.append(2)\n        elif pronoun == "his" or (pronoun == "her" and get_poss_her): \n            train_vector.append(3)\n        elif pronoun == "him" or (pronoun == "her" and not get_poss_her): \n            train_vector.append(4)\n        elif pronoun == "His" or (pronoun == "Her" and get_poss_her): \n            train_vector.append(5)\n        else:\n            train_vector.append(6)\n    \n        return train_vector\''}, {'role': 'assistant', 'content': "['modelling']"}]