General Info

The purpose of this webpage is to provide an interactive visual representation of the data generated by the C++ application side of the project.

The page uses PHP in conjunction with HTML, jQuery, and CSS to read data from a file (generated by the C++ application) and then insert this data into an HTML structure. Interactivity is made possible by jQuery event handlers which dynamically alter the HTML and CSS of the page.

Use

The top N (default N = 5) words generated by the C++ application are conveyed to the page via a text file. These five words are displayed on the left side of the page, with the most-used word being the top (largest) and the least used of the N being at the bottom (smallest). Clicking on a word will cause the sentences in which that word appears (max of 10) to be displayed on the right side of the page. For a word that appears in >10 sentences, a random sample of 10 will be shown. The word whose sentences are currently displayed will be highlighted with a lighter blue color than the others.

Modifying the Page's Code

For anyone wishing to alter the amount of words displayed on the page, changes will need to be made to both the C++ application and the page's code.

The C++ application will need to be altered so that data written to the shared text file will include information on however many words the user wishes to see on the webpage. This doesn't require much work, all that must be changed is a global variable that governs the loops that write the text file.

Alterations to the webpage are slightly more extensive than those that must be made to the C++ application. To control the amount of data that is read from the shared text file, the $TOP_WORD_COUNT variable should be set to the amount of 'top' words that are expected to be in the text file. Sections of code will also need to be added or deleted that create the words on the left side and the divs on the right side (that contain the sentences). The divs will also need to be populated within these blocks. Also, jQuery click events will need to be added for the new words. Both the jQuery and the HTML/PHP changes can be easily accomplished by copying and pasting code and making small changes. Small CSS changes will also need to be made to alter the font size of the words on the left.

Questions?

Any questions concerning the webpage and/or C++ application can be directed to dave.ferris@snc.edu, and will happily be answered.