Principles of text processing