<s> import numpy as np <EOL> import lxmls . readers . pos_corpus as pcc <EOL> from os import path <EOL> import pickle <EOL> corpus = pcc . PostagCorpus ( ) <EOL> input_data = path . join ( <EOL> path . dirname ( __file__ ) , <EOL> "<STR_LIT>" ) <EOL> train_seq = corpus . read_sequence_list_conll ( input_data , max_sent_len = <NUM_LIT:15> , max_nr_sent = <NUM_LIT:1000> ) <EOL> pickle . dump ( ( corpus . word_dict , corpus . tag_dict ) , open ( '<STR_LIT>' , '<STR_LIT:w>' ) ) <EOL> with open ( '<STR_LIT>' , '<STR_LIT:w>' ) as output : <EOL> for seq in train_seq : <EOL> words = [ corpus . word_dict . get_label_name ( seq . x [ i ] ) for i in xrange ( len ( seq ) ) ] <EOL> tags = [ corpus . tag_dict . get_label_name ( seq . y [ i ] ) for i in xrange ( len ( seq ) ) ] <EOL> s = '<STR_LIT:U+0020>' . join ( [ '<STR_LIT:_>' . join ( [ word , tag ] ) for word , tag in zip ( words , tags ) ] ) <EOL> output . write ( s + '<STR_LIT:\n>' ) </s>
