def f2lookup(f, lookup):
lookup = {i: r for i, r in [l.strip().split('<STR_LIT:\t>')[<NUM_LIT:0>:<NUM_LIT:2>] for l in lookup]}<EOL>for line in f:<EOL><INDENT>line = line.strip().split()<EOL>for i, w in enumerate(line):<EOL><INDENT>if w in lookup:<EOL><INDENT>line[i] = lookup[w]<EOL><DEDENT><DEDENT>yield '<STR_LIT:U+0020>'.join(line)<EOL><DEDENT>
find and replace elements in lookup within file