def apply(self, tokens):
o = [("<STR_LIT>", "<STR_LIT>")] * <NUM_LIT:3> <EOL>t = o + tokens + o<EOL>for i, token in enumerate(t):<EOL><INDENT>for r in self:<EOL><INDENT>if token[<NUM_LIT:1>] == "<STR_LIT>":<EOL><INDENT>continue<EOL><DEDENT>if token[<NUM_LIT:1>] != r[<NUM_LIT:0>] and r[<NUM_LIT:0>] != "<STR_LIT:*>":<EOL><INDENT>continue<EOL><DEDENT>cmd, x, y = r[<NUM_LIT:2>], r[<NUM_LIT:3>], r[<NUM_LIT:4>] if len(r) > <NUM_LIT:4> else "<STR_LIT>"<EOL>cmd = cmd.lower()<EOL>if (cmd == "<STR_LIT>"        and x ==  t[i-<NUM_LIT:1>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"        and x ==  t[i+<NUM_LIT:1>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"       and x ==  t[i-<NUM_LIT:2>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"       and x ==  t[i+<NUM_LIT:2>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"    and x in (t[i-<NUM_LIT:1>][<NUM_LIT:1>], t[i-<NUM_LIT:2>][<NUM_LIT:1>]))or (cmd == "<STR_LIT>"    and x in (t[i+<NUM_LIT:1>][<NUM_LIT:1>], t[i+<NUM_LIT:2>][<NUM_LIT:1>]))or (cmd == "<STR_LIT>" and x in (t[i-<NUM_LIT:1>][<NUM_LIT:1>], t[i-<NUM_LIT:2>][<NUM_LIT:1>], t[i-<NUM_LIT:3>][<NUM_LIT:1>]))or (cmd == "<STR_LIT>" and x in (t[i+<NUM_LIT:1>][<NUM_LIT:1>], t[i+<NUM_LIT:2>][<NUM_LIT:1>], t[i+<NUM_LIT:3>][<NUM_LIT:1>]))or (cmd == "<STR_LIT>"    and x ==  t[i-<NUM_LIT:1>][<NUM_LIT:1>] and y == t[i+<NUM_LIT:1>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"          and x ==  t[i+<NUM_LIT:0>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"         and x ==  t[i-<NUM_LIT:1>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"         and x ==  t[i+<NUM_LIT:1>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"     and x in (t[i-<NUM_LIT:1>][<NUM_LIT:0>], t[i-<NUM_LIT:2>][<NUM_LIT:0>]))or (cmd == "<STR_LIT>"     and x in (t[i+<NUM_LIT:1>][<NUM_LIT:0>], t[i+<NUM_LIT:2>][<NUM_LIT:0>]))or (cmd == "<STR_LIT>"      and x ==  t[i-<NUM_LIT:1>][<NUM_LIT:0>] and y == t[i-<NUM_LIT:1>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"      and x ==  t[i+<NUM_LIT:1>][<NUM_LIT:0>] and y == t[i+<NUM_LIT:1>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"      and x ==  t[i-<NUM_LIT:1>][<NUM_LIT:1>] and y == t[i+<NUM_LIT:0>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"      and x ==  t[i+<NUM_LIT:0>][<NUM_LIT:0>] and y == t[i+<NUM_LIT:1>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"      and x ==  t[i+<NUM_LIT:0>][<NUM_LIT:0>] and y == t[i+<NUM_LIT:2>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"   and x ==  t[i-<NUM_LIT:2>][<NUM_LIT:1>] and y == t[i+<NUM_LIT:0>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"   and x ==  t[i+<NUM_LIT:0>][<NUM_LIT:0>] and y == t[i+<NUM_LIT:2>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"        and x ==  t[i-<NUM_LIT:1>][<NUM_LIT:0>] and y == t[i+<NUM_LIT:0>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"        and x ==  t[i+<NUM_LIT:0>][<NUM_LIT:0>] and y == t[i+<NUM_LIT:1>][<NUM_LIT:0>])or (cmd == "<STR_LIT>"     and x ==  t[i-<NUM_LIT:2>][<NUM_LIT:1>] and y == t[i-<NUM_LIT:1>][<NUM_LIT:1>])or (cmd == "<STR_LIT>"     and x ==  t[i+<NUM_LIT:1>][<NUM_LIT:1>] and y == t[i+<NUM_LIT:2>][<NUM_LIT:1>]):<EOL><INDENT>t[i] = [t[i][<NUM_LIT:0>], r[<NUM_LIT:1>]]<EOL><DEDENT><DEDENT><DEDENT>return t[len(o):-len(o)]<EOL>
Applies contextual rules to the given list of tokens,
            where each token is a [word, tag] list.