Home arrow MySQL arrow Page 5 - Lord Of The Strings Part 1
MYSQL

Lord Of The Strings Part 1


I recently enjoyed the latest in the Lord of the Rings trilogy of movies at the cinema. I was intrigued by Tolkienís invented languages (such as Elvish and Dwarvish) and was curious to know where the languages came from, or more precisely, which real language was the biggest influence on Tolkien for his inventions. As I have been thinking about issues of string similarity recently (see Matching Strings and Algorithms), I wondered whether I could extend my ideas of string similarity to language similarity. In other words, could I discover to which real language Tolkienís artificial language is most similar?

Author Info:
By: Simon White
Rating: 5 stars5 stars5 stars5 stars5 stars / 55
March 15, 2004
TABLE OF CONTENTS:
  1. · Lord Of The Strings Part 1
  2. · Word Lists and Databases
  3. · Word Lists
  4. · Loading the Text Files to the DB
  5. · Running the Query

print this article
SEARCH DEVARTICLES

Lord Of The Strings Part 1 - Running the Query
(Page 5 of 5 )

Given that we stored the total number of rows in a variable, it is now quite easy to run a query to express the word counts as a percentage of the total number of words. The query rounds the percentages to the nearest number to one decimal place.


mysqlselect lang as languageround(100*count(word)/@total,1) as percent 
       from words group by lang
;
+-----------+---------+
language  percent |
+-----------+---------+
DANISH    |     1.9 |
DUTCH     |    13.3 |
ENGLISH   |     4.2 |
FINNISH   |    21.4 |
FRENCH    |    10.3 |
GERMAN    |    11.9 |
HUNGARIAN |     1.3 |
JAPANESE  |     8.6 |
LATIN     |     5.7 |
NORWEGIAN |     4.6 |
POLISH    |     8.1 |
SPANISH   |     6.4 |
SWAHILI   |     1.4 |
SWEDISH   |     0.9 |
TOLKIEN   |     0.0 |
+-----------+---------+
15 rows in set 
(3.56 sec)


By converting the output of this query to a comma-separated values file, and then loading it into Microsoft Excel, we can generate the following pie chart:

It is important that we understand how well represented the different languages are in the set of word lists, as this will affect our interpretation of the results of the lexical similarity analysis. Clearly  

Pie Chart of Rings

Finnish is well represented in our word lists, as are Dutch, French and German. With Finnish having the largest number of words, we have a good starting point for testing the belief that Finnish was the biggest influence on Tolkienís languages of Middle Earth.

In my next article, I will explain the algorithm that I used to analyze the word lists, present an overview of the Java source code, and reveal the language that, according to my findings, most influenced Tolkien.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
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 ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials