Navigation
Popular content
Active forum topics
|
Telly - turn telephone numbers into words![]() TellyTable of contents for this article Telly is a computer program that finds real words for telephone numbers that can be typed into a phone instead of the number and that may be easier to remember. It currently covers two languages—English and German. Try it, you may like it. Instructions for use
A long number can take an inordinate time, so you may have to break off. You can do that by clicking on your web browser's reload button. Limitations
Progress barThe progress bar is only shown in phase 2 (see above), while the program is searching for words. It shows two figures, the number of complete conversions and the total number currently being held, which also includes partial conversions waiting for further conversion attempts. The width of the bar is a hyperbolic function of the second figure. When the total number shrinks or stays the same, the bar changes its color from violet to yellow. The final number of results may be smaller than the figures shown in the progress bar, because the results are filtered before they are ultimately put on the screen. HistoryThe idea had been with me for a couple of years already. I saw it as an interesting exercise to check out what JavaScript can do, how it behaves in current web browsers, and how well I could invent a suitable algorithm. In fact there are near-trivial algorithms for this problem, but they are slow. While tuning it, I could increase the speed of the program more than 100-fold. First I searched for suitable dictionaries. Since I have no inflection engine, I needed large dictionaries that contained the most important inflected versions of the words. I also wanted upper and lower case, so the user can notice names and all-upper-case abbreviations. There are not many suitable dictionaries around, but I found one for English and one for German and reformatted and preprocessed these for my purposes. Then I wrote the program. The first fully functional version was written in one day. Finally I polished and rewrote parts of it several times to improve their output quality and performance and added nice display elements, which took a few days. Web browsersOver the course of my work I compared the behavior of a few web browsers under the heavy load of Telly. One of the most unpleasant problems I had to solve is there by design—browsers unavoidably throw a warning dialog to the user when a script program runs for a certain time. Usually the time is 5 seconds, but Internet Explorer sporadically threw such dialogs already after a much shorter time. I suspect that its design is defective in this respect. Another problem is that the JavaScript implementations, also by design, do not provide for multi-threading. Even worse, the browser itself becomes unresponsive as long as a JavaScript program runs. To defeat the browsers, I had to cut the work into time-sliced chunks and give the browser short intervals of free time. The grotesque consequence is that my program could be perfectly multi-threaded, yet the browsers cannot make use of this and force it back into a single thread. My impression was that I was not working with and using the browser, but fighting them and defending against their undesirable behavior, because they refused, by design, to do what I think they should do. In short, today's browsers are still a rather poor platform for general cross-platform computing. Technical detailsTelly is a client-server program system, where most of the actual work is done on the client and only a few key functions on the server. This makes it possible to avoid performance degradation due to many simultaneous users. In fact, Telly scales to thousands of simultaneous users. The programming language for the client is, of course, JavaScript, the most widespread, underestimated, and misunderstood language of our time. JavaScript is extremely flexible and powerful, and its expressiveness is very hard to beat. JavaScript beats programming languages like Java hands-down in these respects. The current version of Telly is moderately optimized for speed. It can still take a long time for long numbers though, which is probably unavoidable, because the program lists each combination of partial results, yielding large numbers of results for longer telephone numbers. The telephone number length is currently arbitrarily limited to 20 characters, the first of which can be a plus sign (+). All other characters beside the plus and digits are automatically removed. The program now limits itself to as few words as possible in each solution, plus one or two. If, for example, the best result has three words, the program will ignore solutions with more than five words, and if there are enough solutions with three or four words, it will output only these and no five-word solutions. The limit is currently set as follows. If the best and second-best solutions, judged by the number of words needed, yield more than 256 solutions, only these will be given, otherwise all third-best solutions are also given. A problem is the long loading time when a language is used for the first time. There is also no progress display on the first loading page, because it is just one command (JSON.parse) that takes a long time, like minutes, on slow browsers, while taking only seconds on the latest Firefox, version 3.5.3. While this one command is being executed, the browser cannot do anything else, like displaying a progress bar. The reason is that a significant amount of data has to be put into a JavaScript dictionary object, which is done through a JSON parser. Modern browsers have native JSON support, but only Firefox seems to do it right and has put JSON into the fast native code of the interpreter. The others, including Internet Explorer 8 and Google Chrome, also provide native JSON support, but the performance is like that of Douglas Crockford's JavaScript JSON implementation, json2.js. This gives rise to the strong suspicion that the other browser makers have taken the shortcut of simply implementing JSON in interpreted JavaScript, which is pretty much a joke. This means that you currently may have to wait a minute or more until the program has loaded a language on Internet Explorer or other browsers. Only in Firefox can you currently experience Telly as it should be. During one session without reload Telly keeps the English and one other dictionary in the browser's memory at the same time. That is why the second use and subsequent uses of the same language can be a lot faster, and you can always switch to and from English quickly, once the dictionaries are loaded. In fact, Telly is a good stress test of the browser. A good browser will pass muster, while a bad one can be many times slower and even give error messages. Keywords: Programm Telefonnummer Telefonnummern Nummer Nummern Zahl Zahlen Ziffern deutsch deutsches Wort deutsche Wörter Buchstaben übersetzen umsetzen konvertieren umwandeln phonetisch Handy English figures digit digits letters convert transform phonetic DiscussionPlease participate by adding a new comment or replying to existing comments. Vote for Telly:
|
User login
Donations If this web site has helped you, please help us too! Recent blog posts
Windows news ticker
Who's new
Who's online
There are currently 0 users and 6 guests online.
hits since 2009-09-09 |
1 day 2 hours ago
1 day 4 hours ago
4 days 3 hours ago
4 days 4 hours ago
1 week 2 days ago
1 week 5 days ago
1 week 5 days ago
1 week 5 days ago
1 week 6 days ago
1 week 6 days ago