Proverbs 14:7

Go from the presence of a foolish man, when thou perceivest not in him the lips of knowledge.

The instruction is to leave the company of a foolish person when no words of knowledge are discerned in him. The test is what is perceived in his speech, and where lips of knowledge are absent departure is required.
The speech that lacks knowledge is vain, frivolous, or filthy talk. The tongue in this way makes known the heart within. Keeping company with such speakers injures Christian character. Such harmful association is therefore to be avoided, with warning against remaining where the talk is vain, frivolous, or filthy.