On the origin of long-range correlations in texts