Text mining framework and methods