Probabilistic graphical models for document analysis