Calculate document frequency for relevant words