In text mining, vector space and bag of word models are poor candidates for topic discovery as they loose word order and co-occurrence, which are very crucial in understanding the meaning of a document. Phrase based models has proven to be promising in capturing the underlying document characteristics. This paper proposes a new document model and algorithm to perform efficient pattern matching for exact, prefix, postfix, and infix matching of phrases in near linear time. The pattern matching machine (PMM) uses the concepts of graph theory and the theory of automata to efficiently and intelligently match, index, track, and analyze phrase patterns. The scalability, space, and time performance are compared with the benchmark document models.