1 / 23

Online Dictionary and Thesaurus

Online Dictionary and Thesaurus. Presented by: M. Khalid Akhtar. Overview. World Wide Web: How efficient ? Objective? Perl: In brief Apache: Advantages MySQL: Advantages Database Schema Some common PERL syntax used in the program The Approach Search Form Subroutines

susanw
Download Presentation

Online Dictionary and Thesaurus

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Online Dictionary and Thesaurus Presented by: M. Khalid Akhtar

  2. Overview • World Wide Web: How efficient ? • Objective? • Perl: In brief • Apache: Advantages • MySQL: Advantages • Database Schema • Some common PERL syntax used in the program • The Approach • Search Form • Subroutines • Dictionary/Thesaurus Result page • References

  3. World Wide Web: How Efficient ? Difficult to find information! Stale/Missing links/web pages!! Time consuming! Sometimes special software required to view information! Irritating advertisements/banners

  4. Objective: Create an Online Dictionary and Thesaurus Using: HTML Perl & CGI Scripts MySql Database Apache Web Server

  5. Perl: In brief • Perl has Advanced Language Features • Highly portable • Higher level constructs than UNIX Shell scripts • More functionality than awk/sed • Strong support for pattern matching • Strong CGI support • Strong HTML parsing capability • Strong support for writing Web agents

  6. Apache: Advantages Apache web server is compiled with Processor-Specific Optimization to take advantage of the power of the new processor generation, giving it 5-30% more performance than any other Web Server. The main advantage of using the Apache web server is speed. Using the mod_perl module, Apache can return CGI requests on average 2-3 times faster than web servers that do not have mod_perl technology. It takes advantage of powerful API interface. Apache provides a robust and commercial grade reference implementation of the HTTP protocol. Its FREE !!

  7. MySQL: Advantages • MySQL is extremely good: • For logging. • When you open many connections; It connects very fast. • When SELECT and INSERT are used at the same time. • When updates are not combined with selects that take • a long time. • When most selects/updates use unique keys. • When many tables are used without long conflicting locks. • When you have big tables (MySQL uses a very compact table format).

  8. Database Schema

  9. Database Schema contd...

  10. Database Schema contd...

  11. Database Schema contd...

  12. WORDMEANING SITEREQ WORDID # MEANING1 MEANING2 MEANING3 : MEANING5 SITEID # SITEID # WORDSREQUESTED WORDSRETURNED WORDS WORDID # WORD WORDCONCEPTS WORDID # CONCEPT SITEID # CONCEPTDETAIL1 CONCEPTDETAIL2 : : : CONCEPTDETAIL9 Database Schema contd... WEBSITES SITEID # SITENAME Legends # - Foreign Key Red Fields - Primary Key Database Schema

  13. Some common PERL syntax used in the program... To connect to MySQL: $dbh = DBI->connect("DBI:mysql:$dbname", $user) or die "Can't connect: " . DBI->errstr; To store values in an ARRAY: push @siteids, $siteId; To process ARRAY elements: foreach $siteId (@siteids) { : : }

  14. Perl modules: The Approach • seachword.pl • dbInterface.pl • seachword.pl: Is the driving progam. • Once invoked, queries the database for • submitted word’s dictionary meaning or • thesaurus concepts, using routines from • dbInterface.pl.

  15. The Approach Contd … • Spawns user agents to fetch • meanings/concepts from WebSites. • Inserts meanings/concepts in the database. • Updates frequency stats. • Displays result in the browser. • Prints the search form in the Internet • browser to allow new searches.

  16. Search Form

  17. Check the meaning first in local database using: dbGetWordMeaning($dbh, $word) dbGetWordId($dbh, $word) dbGetSiteIdByFreq($dbh, $word) Subroutines: if (length $word != 0) { # First fetch the meaning from the database @meanings=&dbGetWordMeaning($dbh, $word); if ($#meanings < 0) { # Get the meaning from dictionary.com if (&parse_dictionary_com($word)) { # Fetch the meaning from the database @meanings=&dbGetWordMeaning($dbh, $word); }

  18. Subroutine contd... if ($#meanings < 0) { # Get the meaning from dictionary.com if (&parse_dictionary_com($word)) { # Fetch the meaning from the database @meanings=&dbGetWordMeaning($dbh, $word); } }

  19. Subroutine contd... if ($#meanings < 0) { # Get the meaning from dictionary.com if (&parse_dictionary_com($word)) { # Fetch the meaning from the database @meanings=&dbGetWordMeaning($dbh, $word); } } dbInsertWordMeaning($dbh, $siteId, $word, @meanings); dbUpdateSiteFreq($dbh, $siteId, 1); &dbUpdateSiteFreq($dbh, $siteId, 0); dbUpdateSiteFreq($dbh, $siteId, 0);

  20. The result page: Dictonary

  21. The result page: Thesaurus

  22. References • 1. Advanced PERL Programming by Sriram Srinivasan • 2. CGI Programming with PERL by Scott Guelich, Shishir Gundavaram and Gunther Birznieks • 3. The Complete HTML Reference by Thomas A. Powell • 4. PERL in Nutshell by Stephen Spainhour, Nathan Patwardhan • 5. Apache Web-Server by Lars Eilebrecht • 6. Apache Server Unleashed by Richard Bowen, Ken A. L. Coar, Rich Bowen, Patrik Grip-Jansson, Matthew Marlowe, Mohan Chinnapan • 7. http://www.apache.org • 8. http://addy.com/dc/html/writing_cgi_scripts.html • 9. http://www.cs.tcd.ie/research_groups/aig/iag/toplevel2.html • 10. http://www.mysql.com

  23. Questions !

More Related