Text this: Theory of Zipf's Law and Beyond