Text analysis algorithms (in progress)