An Algorithm for Detecting Sentence Validity
摘要
In this paper, we introduce an algorithm for determining the grammatical validity of a sentence in polynomial time. The algorithm works by encoding the English words based on word type which we call components. A sentence can be described both algebraically and geometrically. Our algorithm generates the geometric portion called underlinks from the generalized reductions of the algebraic portion. Underlinks uniquely determine the reduction of the components leading to the empty string. This is the mathematical basis for determining if a sentence is valid. We also provide a proof for the algorithm’s time complexity of \(\mathcal {O}(n^2)\) along with a Python implementation. This paper is part of a bigger project where we explore the combination of a sentence’s grammar and meaning. This is done by combining two compact closed categories; pregroups represent the grammar of a sentence, and finite dimensional vector spaces describe the meaning of a sentence. Together one compact closed category is created, representing both aspects of the sentence.