This is what we call the "voice" of the character in screenwriting. Verbal tics like distinct word choice and speech patterns help this a lot. One character I wrote is a preacher's daughter and African American and thus uses a fair amount of repetition when making a point, driving it home. Another is fond of short, declaratory statements. A third is an brilliant engineer but a stoner who, although articulate, tends to spiral in on a point rather than go straight from A to B. When I did some spec TNG scripts back around 89–90 I was told by a couple of people that they could tell whose lines were whose just because I'd captured their "voice'. If I took a line written for Picard and gave it to Riker I had to rewrite it, since the characters don't speak the same way.