A semantic patch has no access to comments. The only thing I can see to do is to use python to interact with some external tools. For example, you could write some code to collect the comments in a file and the lines on which they occur, and then get the comment that most closely precedes the start of the function.
julia
