def nearest(self, type="<STR_LIT>"):
candidate, d = None, len(self.sentence.chunks)<EOL>if isinstance(self, PNPChunk):<EOL><INDENT>i = self.sentence.chunks.index(self.chunks[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>i = self.sentence.chunks.index(self)<EOL><DEDENT>for j, chunk in enumerate(self.sentence.chunks):<EOL><INDENT>if chunk.type.startswith(type) and abs(i-j) < d:<EOL><INDENT>candidate, d = chunk, abs(i-j)<EOL><DEDENT><DEDENT>return candidate<EOL>
Returns the nearest chunk in the sentence with the given type.
            This can be used (for example) to find adverbs and adjectives related to verbs,
            as in: "the cat is ravenous" => is what? => "ravenous".