John was heard to be swearing, but nobody is said to have told him off.
Can I say "John was heard swearing" instead of "to be swearing"? Is there any difference in meaning between them? those two sentences?
I find both clauses of the original sentence unnatural. "John was heard swearing" is more natural than "heard to be swearing". "... but nobody is said to have told him off" is grammatically correct but an odd way of phrasing it. When we use "said to", we're usually talking about something that a lot of people say. I'd use something like the following:
John was heard swearing but nobody told him off.
John was heard swearing but I gather nobody told him off.
John was heard swearing but, as far as I know, nobody told him off.
Did you write the original sentence yourself? If so, please provide more context. If not, please provide the source and author.
Please note that I have changed your thread title and edited the main body of the post. The sentence you're asking us to look at was correctly put in the title. However, you need to repeat that sentence in the post and add all the rest of the information (your question etc).