MySQL
  Home arrow MySQL arrow Page 5 - Lord Of The Strings Part 2
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

Lord Of The Strings Part 2
By: Simon White
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 27
    2004-03-17

    Table of Contents:
  • Lord Of The Strings Part 2
  • The Size of the Problem
  • Discovering String Similarities
  • A Class Called Compare
  • Analyzing the Results
  • The Finnish Line
  • Differences on the Table

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Lord Of The Strings Part 2 - Analyzing the Results


    (Page 5 of 7 )

    With the first pass mechanism incorporated into the algorithm as described, I found that the program runs in quite acceptable time. On my 1.6 GHz PC with 768 MB Ram using Sun's Java J2SE 1.4.2 and MySQL 3.23.49, it runs to completion in about four minutes. The java program and database both run on the same machine, so there is no network latency in this configuration. The main reason for this relatively quick execution time is the first pass mechanism that returns a subset of the whole dictionary of words. Without this mechanism, I am certain that the program would take orders of magnitude longer to finish. (And if it took longer to finish, then my idea of storing results back into the database as they are found would gain significance.)

    Anyway, let's have a look at the results obtained. First of all, let's see how many exact matches were found and for which languages:


    mysqlselect count(*), lang from matches where similarity=1.0 group by lang;
    +----------+-----------+
    count(*) | lang      |
    +----------+-----------+
    |        DANISH    |
    |        DUTCH     |
    |        ENGLISH   |
    |       13 FINNISH   |
    |        FRENCH    |
    |        GERMAN    |
    |        HUNGARIAN |
    |        JAPANESE  |
    |        LATIN     |
    |        NORWEGIAN |
    |        POLISH    |
    |        SPANISH   |
    |        SWEDISH   |
    +----------+-----------+
    13 rows in set 
    (0.00 sec)

    The most exact matches were found for Finnish. By executing the following query, we can inspect the words of those exact matches:


    select word from matches where similarity=and lang='Finnish';

    The exact matches were found for the Finnish words 'andor', 'aragorn', 'arwen', 'balin', 'hobbit', 'ilmarin', 'lindon', 'maia', 'nahar', 'ori', 'rohan', 'sylvan', and 'velar'; whilst English scored exact matches for the words 'goblin', 'hobgoblin' and 'thrush'.

    The following query shows the frequency with which each language was chosen as being most similar, over the whole set of 470 Tolkien words.


    mysqlselect langcount(*) as hits 
           from matches 
           group by lang 
           order by hits desc
    ;
    +-----------+------+
    lang      hits |
    +-----------+------+
    FINNISH   |  100 |
    ENGLISH   |   64 |
    SPANISH   |   62 |
    JAPANESE  |   52 |
    DUTCH     |   40 |
    LATIN     |   26 |
    POLISH    |   25 |
    DANISH    |   19 |
    NORWEGIAN |   19 |
    FRENCH    |   18 |
    HUNGARIAN |   18 |
    GERMAN    |   16 |
    SWAHILI   |    |
    SWEDISH   |    |
    +-----------+------+
    14 rows in set 
    (0.00 sec)

    More MySQL Articles
    More By Simon White


       · First of all, I really enjoyed reading the article both for its originality and its...
     

    MYSQL ARTICLES

    - MySQL and BLOBs
    - Two Lessons in ASP and MySQL
    - Lord Of The Strings Part 2
    - Lord Of The Strings Part 1
    - Importing Data into MySQL with Navicat
    - Building a Sustainable Web Site
    - Creating An Online Photo Album with PHP and ...
    - Creating An Online Photo Album with PHP and ...
    - PhpED 3.2 – More Features Than You Can Poke ...
    - Creating An Online Photo Album with PHP and ...
    - Creating An Online Photo Album with PHP and ...
    - Security and Sessions in PHP
    - Setup Your Personal Reminder System Using PHP
    - Create a IP-Country Database Using PERL and ...
    - Developing a Dynamic Document Search in PHP ...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT