def prepare_feature(best_processed_path, option='<STR_LIT:train>'):
<EOL>n_pad = <NUM_LIT><EOL>n_pad_2 = int((n_pad - <NUM_LIT:1>)/<NUM_LIT:2>)<EOL>pad = [{'<STR_LIT>': '<STR_LIT:U+0020>', '<STR_LIT:type>': '<STR_LIT:p>', '<STR_LIT:target>': True}]<EOL>df_pad = pd.DataFrame(pad * n_pad_2)<EOL>df = []<EOL>for article_type in article_types:<EOL><INDENT>df.append(pd.read_csv(os.path.join(best_processed_path, option, '<STR_LIT>'.format(article_type, option))))<EOL><DEDENT>df = pd.concat(df)<EOL>df = pd.concat((df_pad, df, df_pad)) <EOL>df['<STR_LIT>'] = df['<STR_LIT>'].map(lambda x: CHARS_MAP.get(x, <NUM_LIT>))<EOL>df['<STR_LIT:type>'] = df['<STR_LIT:type>'].map(lambda x: CHAR_TYPES_MAP.get(x, <NUM_LIT:4>))<EOL>df_pad = create_n_gram_df(df, n_pad=n_pad)<EOL>char_row = ['<STR_LIT>' + str(i + <NUM_LIT:1>) for i in range(n_pad_2)] +['<STR_LIT>' + str(i + <NUM_LIT:1>) for i in range(n_pad_2)] + ['<STR_LIT>']<EOL>type_row = ['<STR_LIT:type>' + str(i + <NUM_LIT:1>) for i in range(n_pad_2)] +['<STR_LIT>' + str(i + <NUM_LIT:1>) for i in range(n_pad_2)] + ['<STR_LIT:type>']<EOL>x_char = df_pad[char_row].as_matrix()<EOL>x_type = df_pad[type_row].as_matrix()<EOL>y = df_pad['<STR_LIT:target>'].astype(int).as_matrix()<EOL>return x_char, x_type, y<EOL>
Transform processed path into feature matrix and output array

Input
=====
best_processed_path: str, path to processed BEST dataset

option: str, 'train' or 'test'