Great Grammar Transformer

Great Grammar Transformer

A program to support grammar transformations

welcome1

Background basics

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.

To commence...

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.

Let's explore.

 

Constituent alteration

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.

ggt_img2
 
ggt_img5

Input/output

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.

 

Inquire (???) - is it true?

kitty-loves-me_inq

Command (.) - make it true.

kitty-loves-me_imp
 

Passive (.) - it's true.

kitty-loves-me_pvs

Exclaim (!!) - wow, it's very true!

kitty-loves-me_exc
 

Verb conjugation

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.

prsn_tense_select  
reverso_sneezed
 

A love that...

ggt_img11

... spans eternity

ggt_img12
 
synm1

Synonym sunrise

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.

synm6
 
synm3
synm5
 

I have finished welcoming you to my project. Now it can be exclaimed...

welcome2

Thanks and goodbye