This is fun. Why have you restricted the search to just Identifiers, Variables and Functions? Does this mean that text found in a comment block would not be a match?
I'm already devising how you could incorporate a bag of words algorithm plus an embedding to segment/find similar items.