A system and method permit analysis and generation to be performed with the same reversible probabilistic model. The model includes a set of factors, including a canonical factor, which is a function of a logical form and a realization thereof, a similarity factor, which is a function of a canonical text string and a surface string, a language model factor, which is a static function of a surface string, a language context factor, which is a dynamic function of a surface string, and a semantic context factor, which is a dynamic function of a logical form. When performing generation, the canonical factor, similarity factor, language model factor, and language context factor are composed to receive as input a logical form and output a surface string, and when performing analysis, the similarity factor, canonical factor, and semantic context factor are composed to take as input a surface string and output a logical form.