Great Grammar Transformer
A program to support grammar transformations
I developed this project over six months for completion of my undergraduate degree in computer science. It is written in Java using Netbeans IDE and utilizes Apache OpenNLP for English language parsing. Web content is parsed from Reverso.net and Thesaurus.com.
The adjacent image displays the main frame, split between an input/output panel (left) and tree display panel (right). The tree display panel displays the parse tree for the selected sentence and supports grammatical transformations. A given sentence can be packaged in a variety of formations and subjected to many alterations.
To the right, the above sentence has been transformed to the passive voice, reflected in the reshaped parse tree.
The provided transformations maintain the core semantic relations of the original sentence, deep structure, while syntactically packaging the encoded information to varying meanings. In this case, the passive voice, the meaning is basically identical.
To perform alterations, the user selects the constituent to transform by clicking its box in the parse tree. Then, a tabbed pane is revealed, displaying options for transformations.
The input/output panel consists of an input (above) and output (below) text area. Text from the input text area is divided into sentences by Apache OpenNLP's sentence detector. Each sentence is then processed by OpenNLP's English language parser, forming its corresponding parse tree.
The output text area displays the content from the input text area after manipulation in the tree display.
To switch sentences, the user presses Ctrl+Enter with the caret positioned within the sentence desired.
Consider the next sentence...
"Kitty loves me."
... and regard its transformations.
In English, verbs are conjugated according to person and tense. I use Reverso.net, a portal of linguistic tools, for English verb conjugations. Inquire with an English verb in any formation and the portal returns a webpage displaying possible conjugations, seen to the right with the verb sneezed.
The data from the returned webpage is parsed using regular expressions and compiled into easily selectable person and tense options.
Instantaneously compose with augmented lexicon or alternatively employ the vernacular. Terminal elements of the parse tree provide possible meaning equivalences. Synonyms are parsed from Thesaurus.com and gathered into a list for selection.