def apply(self, token, previous=(None, None), next=(None, None)):
w = token[<NUM_LIT:0>]<EOL>for r in self:<EOL><INDENT>if r[<NUM_LIT:1>] in self._cmd: <EOL><INDENT>f, x, pos, cmd = bool(<NUM_LIT:0>), r[<NUM_LIT:0>], r[-<NUM_LIT:2>], r[<NUM_LIT:1>].lower()<EOL><DEDENT>if r[<NUM_LIT:2>] in self._cmd: <EOL><INDENT>f, x, pos, cmd = bool(<NUM_LIT:1>), r[<NUM_LIT:1>], r[-<NUM_LIT:2>], r[<NUM_LIT:2>].lower().lstrip("<STR_LIT:f>")<EOL><DEDENT>if f and token[<NUM_LIT:1>] != r[<NUM_LIT:0>]:<EOL><INDENT>continue<EOL><DEDENT>if (cmd == "<STR_LIT>"       and x == w)or (cmd == "<STR_LIT>"       and x in w)or (cmd == "<STR_LIT>"    and w.startswith(x))or (cmd == "<STR_LIT>"     and w.endswith(x))or (cmd == "<STR_LIT>"    and x + w in self.known)or (cmd == "<STR_LIT>"     and w + x in self.known)or (cmd == "<STR_LIT>" and w.startswith(x) and w[len(x):] in self.known)or (cmd == "<STR_LIT>"  and w.endswith(x) and w[:-len(x)] in self.known)or (cmd == "<STR_LIT>"   and x == next[<NUM_LIT:0>])or (cmd == "<STR_LIT>"  and x == previous[<NUM_LIT:0>]):<EOL><INDENT>token[<NUM_LIT:1>] = pos<EOL><DEDENT><DEDENT>return token<EOL>
Applies lexical rules to the given token, which is a [word, tag] list.