Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / desktop / WPF

Semafon™ semantic phone number-to-text converter

5.00/5 (6 votes)
8 Oct 2015CPOL17 min read 39.5K  
App implements bi-directional semantic phone number-to-text converter, extended with novel Lottery+Quiz engine

Announcement

Semafon™ comes in two flavors: Windows/WPF app and responsive Web app.

Semafon™ for Web

Web app is available at: Semafon.com.  Search engine implements efficient multi-threading parallel processing algoritm. Additional filtering options on minimal word length has been added. Responsive UI web design optimized for both portrait/landscape device orientation made this web app auto-adaptable to wide variety of HW platforms including: desktop, notebooks, tablets/phablets and essentially any mobile phones. The app is optimized for both touch-screen and standard keyboard/mouse operations.

Following demo screenshot demonstrates sample search made on phone number 263-7422 resulting in couple best word matches: AMERICA (7-letters) and ERICA (5-letters). Current version implements 5 Language filters. It also allows the unfiltered operation mode producing the entire result set w/ll possible alpha-numeric combinations pertinent to the input number using the standard phone keypad encoding rules.

Image 1

Semafon™ for Win

Application software Semafon™ for Windows implements speech-enhanced Multi-Modal UI w/borderless application window and 10 user-selectable background themes, including multiple translucent ones. Application can run completely autonomously without Internet connectivity on any hardware PC platform w/various form-factors (Desktop/Notebook/Tablet) equipped with Windows OS 7/8. It supports traditional PC mouse and touch-screen operations. Multilingual dictionary is comprised of more than 30,000 words in English, Spanish, German and Russian.

Image 2

Semaphon™ SP-300 Demo screenshot

Overview of the Contest Entry

This application was an entry into Intel® App Innovation Contest 2013

Contest Credentials

  • Target Platform: All-In-One (AIO) 

  • Category: Entertainment

Application Semaphon™ has a modular architecture, comprised of 3 core components:

The modules listed above complements each other; they could be integrated in a single app (as proposed), or used as separate stand-alone Windows apps.  Detailed description, sample code snippets and implementation know-hows/best practices are thoroughly discussed in the following sections.

  • Bi-directional phone 'number-to-text' and 'text-to-number' semantically-sound conversion, corresponding to the standard phone keypad encoding schema (for example, the word AMERICA corresponds to phone number 263-7422); this module has been already partially implemented in existing CoolPhone™ iCP-707 application.
  • Novel "semantic phone" sweepstake engine built on the innovative idea of using "semantic" phone numbers as a sweepstake entry that allows picking the winner based on randomly selected word containing up to 7 letters, matching the owner's phone number; this module is currently under development. Multiple variations of the sweepstake rules/strategies, and further extension with a trivia quiz module are discussed in greater details in the following sections. 
  • Trivia quiz to be added at the end of sweepstake draw to pro-rate the value of the prize (multiply or reduce) based on the accuracy of winner's answers to the quiz. The quiz engine and corresponding unique content has been developed as online HTML5 application.
  • Intended uses for the Application 

    Feature/Edition matrix and potential use cases are listed below in Table 1 and Table 2:

    Table 1: Individual Users Features/Editions matrix for most common use cases
    Edition Features Dictionary Digits Speech
    Lite Basic phone number-to-text conversion, no dictionary N/A <=7 TTS
    Standard Phone number-to-text conversion with optional filtering on internal dictionary 10,000 words <=7 TTS
    Pro Phone number-to-text conversion with optional filtering on internal dictionary 20,000 words <=7 ASR/TTS
    Ultimate Phone number-to-text conversion with optional filtering on internal dictionary  50,000 words <=7 ASR/TTS
    International Includes selected local dictionaries containing words that can be typed using standard English Alphabet 3,000 words <=7 TTS
     
    Table 2: Potential use-cases of proposed app
    User Use case Edition
    Individual To customize the phone book by finding interesting word-letter combination, e.g. the phone# 452-6687 corresponding to the word 'GLAMOUR' Any
    Biz General To find descriptive word-letter combinations for their contact phones, e.g. the phone# 327-4466 corresponding to the word 'FASHION' Any
    Telecom To offer user customized phone number corresponding to words of choice Ultimate
    Lottery Novel type of Sweepstakes/Lottery based on randomly selected 7-letter word corresponding to "semantically sound" winning phone numbers either nationwide, or in specified area codes  (e.g. 212, 646 or 718 in the New York City) Ultimate
 
  • Application Development approach

    Application Development approach: Proposed application should utilize the novel UI features of AIO and capability of Windows OS platform, in particular, .NET/WPF framework and speech technology (TTS/ASR). Development strategy is based on the cornerstone principle of separation of programmatic concerns, namely: all layout and aesthetic enhancement to be achieved via WPF/XAML, data content to be stored operated on embedded SQL CE and its corresponding data access libraries included in .NET, and algorithmic part to be implemented via managed code.

  • Language and Framework

    Application code base will be developed using C# language and core .NET framework libraries. In addition to this, Microsoft SQL Server Compact edition (SQL CE) will be used with corresponding data access libraries.

About Author

Dr. Alexander Bell is a Microsoft technology veteran with development experience span from DOS to Win 8. He actively participates in digital life of online development communities (published 21 article and 36 tips on Codeproject). In the meantime, Dr. Bell is personally credited for the completion of 10+ of enterprise level FLCD projects. Beyond his professional duties, Alexander is deeply devoted to digital photo, classical music and art.

Round 1, Key Contest Ideas

Innovation and User Experience

Proposed application will be built upon several innovative ideas:

  • Unique proprietary Semaphon™ "semantic" phone number-to-text conversion engine
  • Novel highly-aesthetic borderless WPF windows solution with unique proprietary re-sizing features
  • Single-window solution providing intuitive navigation between functional areas  and "split-screen" areas
  • Novel efficient MMUI utilizing multi-touch capabilities of AIO and speech enhancement (ASR/TTS)
  • Unique proprietary search algorithm implemented as a parallel functions
  • Proprietary SQL CE data access library extension
  • Unique proprietary quiz engine  
  • Unique proprietary NY trivia quiz content
  • Unique proprietary English and Russian dictionary Database comprised of up to 7-letter words 
  • Unique proprietary Semaphon™ ("semantic phone numbers") sweepstake engine

Usage of key technical enabling vectors

  • Screen resolution of AIO allows high data density and efficient "split-screen" operations w/multiple functional areas 
  • UX improvement utilizing multi-touch features enabled in of AIO in conjunction with borderless WPF windows
  • MMUI speech enhancements (ASR/TTS) utilizing AIO multimedia capabilities and .NET  speech libraries
  • Big-screen AIO (Lenovo Horizon 27") well suited for proposed sweepstakes demonstrated in public places, or as televised show
  • Multi-core CPU powered AIO to boost the performance of TPL-based conversion algorithms
  • Voice commands can greatly extend the MMUI capability and add more entertainment to the app
  • Multiple external HID devices complementing AIO for better UX and entertaining factors

Viability and Significance of proposed Application for the Entertainment Category 

  • Proposed app will allow individual users to customize their phone books by finding semantically-sound and easy-to-memorize words corresponding to the numerical phone#. Organizing the phone book records with such "semantic" phone numbers is rather entertaining practical experience 
  • Telecom businesses can use proposed app to offer "semantic' phone numbers to the business/individual customers
  • Entertainment industry could greatly benefit from proposed novel "semantic" phone numbers Lottery/Sweepstakes (like tentatively called Lotto-212, or Lotto-646 for NY Manhattan, or Lotto-718 for other NY City areas)

Idea description and implementation details of proposed application  

Detailed description of Submission Ideas on conceptual and implementation levels and corresponding programmatic tasks/challenges/solutions is provided in the following sections. Multiple screenshots included in the body of the article illuminate the core concept of UI implementation and usage. Selected coding techniques, know-hows and other best practices will be posted as the project progressing.

Background

A bit of theory and FYI 

Regular phone keypads in addition to numbers, also contain letters corresponding to the digits, except for 0 and 1, which don't match any letters (see Fig.1). Thus, any digital combination in phone numbers has multiple alpha-numeric or just alphabetical matches, which in some cases containing meaningful words or even phrases, which is much easy to memorize than a sequence of seemingly-random digits. Thus, for example, phone number: 263-7422 corresponds to the word "AMERICA" (see Fig. 2). Following are samples of the "semantic" phone number-to-text conversion:

  • 776-5328 | PROJECT
  • 266-8378 | CONTEST
  • 946-3697 | WINDOWS  
  • 782-2377 | SUCCESS
  • 786-6371 | RUNNER-1 
  • 788-3469 | STUDIO-9
  • 194-6637 |  1-WINNER 

It's relevant to mention, that text-to-number conversion (just for certainty called "direct" conversion) represents a 'one-to-one' relationship, while the number-to-text (i.e. inverse) conversion corresponds to 'one-to-many' type of relationship. In other word, any phone number can be associated with variety of alphanumeric combinations, thus making the "inverse" number-to-text conversion and finding a "semantically-sound" set a much more difficult programmatic challenge.

Current version of CoolPhone™ iCP-707 implements Databases corresponding to English dictionary with more than 50,000 entries (words containing up to 7 letters) and rather sophisticated search engine utilizing Microsoft TPL multi-threading/parallel functions and Intel's CPU multi-core capabilities (typical for modern high-end AIO). Application also implements the unique proprietary localization technique for Russian- language based on graphic similarity of certain en/ru characters (this technique could be extended for any other languages upon existence of said similarity).

Existing CoolPhone™ application and planned extension

Existing app CoolPhone™ iCP-707 implements MMUI speech-enhancement innovative borderless WPF windows with unique proprietary move/re-size features (notice the window control box in a upper-right corner) and speech-enhanced GUI (aka MMUI), providing instructional voice messages to the Users via TTS (see the control box with typical "Playback", "Stop" buttons in Fig.1-Fig.3). Planned new version (CoolPhone™ 8)  should implement extended voice-command set, e.g. switching between layout palette, numeric entry, etc depends on the availability/quality of the microphone input). 

Image 3

Fig.1: CoolPhone™ iCP-707 sample screenshot shows all unfiltered text matches corresponding to phone number 263-7422

Image 4

Fig.2: CoolPhone™ iCP-707 sample screenshot shows filtered on internal dictionary matches corresponding to phone number 263-7422 starting with with "AMERICA" on the top

Image 5

Fig.3: CoolPhone™ iCP-707 sample screenshot corresponding to the same phone number 263-7422 showing different ('LIGHT') theme 

Existing app can process the numbers with up to 7 digits; the entry can contain less that 7 digits; for example, the 6-digit number 946369 matches the word "WINDOW". Both existing and planned app app can run in a standalone mode completely autonomously without any need for Internet connection, thus properly addressing the privacy concerns.

Built-in Dictionaries 

All editions come with built-in English Dictionary used to filtering and finding "semantically sound" letter combinations pertinent to numerical phone number. International edition also includes unique proprietary Russian dictionary comprised of up to 7-letter words which can be written with Latin typefaces (e.g., letter "C", or "T" are included in both Cyrillic/Latin alphabets; phonetic differences are not not important in the context of this type of filtering).  So far, the built in English Dictionary contains word entries with the following distribution:

  • 7-letter words: 24K
  • 6-letter words: 16K
  • 5-letter words: 8.5K
  • 4-letter words: 3.7K
  • 3-letter words: 0.6K 
Novel Semaphon™ sweepstakes on 'semantic' phone numbers 

The idea of the sweepstake based on semantically-sound phone numbers produced by Semaphon™ engine is rather intuitive and straightforward. It could be conducted nation-wide or per specific area code. For the sake of clarity let's assume that the sweepstake is conducted in NYC, thus the area codes will correspond to 212, or 646 or 718 (also 347 could be added).  The phone owners with this specific area codes are automatically enrolled/eligible to this type of novel "NYC Lottery). The sweepstake authorities can periodically conduct the draw by randomly selecting the word entry from the "pool" corresponding to the application dictionary. To ensure the trustfulness, official rules may require two steps of "randomization"; firstly, a single word will be randomly selected by N different appointed trustees (for e.g., 10 Educational Institutions in NYC), and final word selection will be made from that 10 entries using some highly visible/traceable tools, potentially televised. The winner of the particular Lottery draw will receive some promotional stuff from the sponsoring business entities, foundations, etc. There might be many types of Sweepstake on "semantically-sound" phone number with different scenario/rules and odds of winning, like the ones partially listed below:

"7-of-7 Semaphon™ Lottery"  

Starting with the most straightforward "7-of-7" Lottery type: the winner should be selected by having the phone number with exact match to that random word (for example, if the word is "ANDROID" the the winning phone numbers are 263-7643 in each of the listed above area codes). The odds of winning in a single draw on 7-letter word is about 1/10m.

"6/7-of-7 Semaphon™ Lottery"

This variation in addition to 7-of-7 "Grand Prize" may include smaller prices corresponding to 6-of-7 letters (another draw of random 6-letter word) with odds much higher than in the first one (for example, if the randomly selected word is "STUDIO" then all winning phone numbers will include the ones either starting, or ending with digital combination "788346" (potentially 20 winners). The same idea could be further extrapolated to establish various sweepstakes on 'CoolPhone' numbers. 

Passive vs Active participation 

In a "passive" scenario any User with a phone, either corresponding to local area code, or nationwide (depends on the specific rules) is eligible for the sweepstakes. After the draw completion, winning number will be called offering the prize or some promotional stuff.

To the contrary, the "active" participation requires the User to register for particular sweepstake, potentially with some initial money contribution (note: the latter might be considered a "gambling" and could be prohibited in certain areas). The draw will identify the winner from the pool of a registered Users.

Adding more edutainment to sweepstake: NY trivia quiz

Sweepstakes described above can implement a second round, adding more entertainment in conjunction with some educational aspects, namely: trivia quiz. For conceptual clarity, assuming that a sweepstake is conducted in the New York City (corresponding to area codes: 212, 646 and 718), then the "CoolPhone" number winner(s) selected at the first round will be promoted to the second round, that requires to answer the NY trivia quiz. Such quiz can be comprised of several trivia Questions, and the final prize will depend on the contestant(s) success in answering these question. The rule could be set as either "all or nothing", or a bit more relaxed, prorated w/correct answer percentage.  Instead of penalizing for incorrect answer, it could work the other way, rewarding the winner for each correct answer, like a prize "double" option, etc.

Input Devices (HID)

Novel MMUI utilizing various types of HID will help making the sweepstakes more entertaining. For example, the draw process might be implemented no just as a simple random generator, but having some human interaction. That may include "multi-mice" input (yeah, that's right: you can connect multiple mice to the PC and they will work fine in "perfect harmony". This feature itself could lead to the development of various multi-user PG games based on idea of competing mouse movement/actions).

Split-screen and Multi-mice input

In this scenario, several Performers have to enter some arbitrary numbers using split-screen mode and multiple mice input (one per each Performers ). For example, three Performers can run three random generators in their own screen areas to produce a set of random numbers. System will calculate the aggregate value based on this set, for example a median value that will be used as an index to pick the 7-letter words from application dictionary. . The winner will be selected based on the rules specified in previous sub-chapter.  This idea could be further extended to any type of multiple HID devices, adhering to the modern MMUI concept, for example: wireless PC presenter hardware (like Logitech Wireless Presenters R400/R600, but most recommended are the ones that does not include laser pointers because of potential hazard), or even wireless microphone to enter the voice command (app will include ASR extension)

Potential transmission channels/audiences

Proposed application can serve as a technical platform for televised sweepstakes, either translated through traditional TV channels, or using interactive WebTV channels (RIA based on Internet community generated content and ). In both cases, in order to make the show more entertaining it will be highly desirable to run this application on sophisticated hardware platform with big touch-screen (such as AIO Lenovo Horizon 27") and various HID devices. 

Using the code

This section will be continuously updated as project progressing.

Listing 1. Jagged array corresponding to Phone keypad text-to-number encoding schema

C
        // Jagged array corresponding to phone keypad alpha-numerics
        internal static readonly char[][] CharsetStd = 
        {
            new char[] {'0'},
            new char[] {'1'},
            new char[] {'A','B','C'},
            new char[] {'D','E','F'},
            new char[] {'G','H','I'},
            new char[] {'J','K','L'},
            new char[] {'M','N','O'},
            new char[] {'P','Q','R','S'},
            new char[] {'T','U','V'},
            new char[] {'W','X','Y','Z'}
        };

Please note that the first index of the jagged array shown above corresponds to the phone keypad digit.

Points of Interest

Proposed app implements variety of data operations performed via standard SQL/T-SQL combined with unique highly-optimized parallel (multi-thread via TPL) algorithms, utilizing the substantial computational power of the target AIO platform, powered by multi-core CPU by Intel. It includes multiple innovative solutions introduced by the author to various developer communities and already partially discussed, plus a set of unique solutions and know-hows implemented for the first time in proposed app. Partial list of the said innovations follow: 

  • Unique proprietary search algorithm implemented as a parallel functions
  • Unique proprietary English dictionary Database comprised of up to 7-letter words
  • Unique proprietary Russian dictionary Database comprised of up to 7-letter words 
  • Unique borderless WPF Window design/layout and re-sizing solution
  • Proprietary SQL CE data access library extension
  • Unique proprietary quiz engine
  • Unique proprietary NY trivia quiz content
  • Unique proprietary Semaphon™ sweepstake engine 
International extension

Proposed app implements unique proprietary Russian dictionary Database of up to 7-letter words that can be displayed with Latin character set, therefore, can be entered by using a standard phone keypad, for example: the word 'CTEHA' that can be typed with all latin letters (it means a 'Wall' in Russian) due to some graphical similarities in latin/cyrillic character sets.

Dynamic Theme Selector

Semaphon SP-300 app implements multiple user-selectable Themes, including several "stylish" translucent ones. Theme are programmed in XAML and stored in separate file like: Dark.xaml, Light.xaml, Navy.xaml. Following XAML snippet shows how to add the Theme on Windows level (note: it could also be done on App level):

 

XML
<Window.Resources>
     <ResourceDictionary>
         <ResourceDictionary.MergedDictionaries>
             <ResourceDictionary Source="Themes\Main\Dark.xaml"/>
         </ResourceDictionary.MergedDictionaries>
     </ResourceDictionary>
 </Window.Resources>

In order to switch Themes programmatically, a control Button event handler was implemented as shown below:

C#
#region private method: Set Window Theme
/// <summary>
/// relative path to Theme files
/// </summary>
private readonly Dictionary<int, string> _dThemesUri = new Dictionary<int, string>  {
    { 0, _themeDark },
    { 1, _themeLight },
    { 2, _themeBeige },
    { 3, _themeBeigeT },
    { 4, _themeGreenT },
    { 5, _themeNavy },
    { 6, _themeNavyT },
    { 7, _themePinkT },
    { 8, _themeRedT },
    { 9, _themeWoodT },
    { 10, _themeGhost}
};

/// <summary>
/// Set this  Window Theme resource dictionary
/// </summary>
/// <param name="ThemeCode">bool</param>
private void SelectTheme(int ThemeCode)
{
    try
    {
        // prefix to the relative Uri for Theme resources (xaml file)
        string _prefix = String.Concat(typeof(App).Namespace, ";component/");

        // clear all resource dictionaries in this window
        // Note: on app level use: Application.Current.Resources.MergedDictionaries.Clear();
        this.Resources.MergedDictionaries.Clear();

        // add resource theme dictionary to this window
        // Note: on app level use: Application.Current.Resources.MergedDictionaries.Add
        this.Resources.MergedDictionaries.Add
        (
            new ResourceDictionary { Source = new Uri(String.Concat(_prefix + _dThemesUri[ThemeCode]), UriKind.Relative) }
        );
    }
    catch { }
}
#endregion

The following Demo screenshot demonstrates sample Themes and Multi-lingual support features in current release of Semaphon SP-300:

 

Image 6

Fig.6 Semaphon SP-300 with default 'dark' background theme (Language: English)

 

Image 7

Fig.7 Semaphon SP-300 with translucent theme dynamically selected  (Language: English)

 

Image 8

Fig.8 Semaphon SP-300 with 'Light' theme dynamically selected (Language: German)

 

Image 9

Fig.9 Semaphon SP-300 with 'Navy' theme dynamically selected   (Language: German)

 

Image 10

Fig.10 Semaphon SP-300 with 'Navy' theme dynamically selected   (Language: Russian)

Responsive Web design

Even though plethora of options is currently available (starting with Bootstrap), but for both practical/didactic purpose the entire responsive Web layout design was done "from scratch" using just pure CSS technique. The biggest challenge in responsive web UI design practice is the layout transformation pertinent to the swich between landscape and portrait device orientation. The next issue is dealing with wide variation of possible screen resolutions. CSS provides excellent options to handle both issues. On a very a basic level, just adding CSS statement like the following and setting the appropriate property values (for example, increasing the font-size:2em;) will serve the purpose reasonably well:

CSS
@media (max-width:720px), (orientation: portrait ) and (max-width:1024px)
{
// add your stuff here
}

Note: optionally it could be stated as:

CSS
@media screen 

A bit tricky part: CSS @media allows use of AND logical operator, but there is no OR operator: instead, just use a comma (,) to aggregate the cases in the same way as it could be done with logical OR.

History

  • 2002-2014 Multiple Voice-controled and speech enhanced engineering and office applications developed and published by the author
  • Feb 2013: CoolPhone iCP-707 production pilot has been developed by author
  • Aug 2013: Article submitted to the Intel® App Innovation Contest 2013 (AIO/Entertainment)
  • 2014: Semafon™ SP-300 has been released [1,2]
  • 2015 Semafon™ web app has been released

 

Image 11

Fig. 11 Semaphon SP-300 minimal word length filter added (set to 5 in this demo screenshot)

Acronyms and Abbreviations 

  • AIO All-In-One
  • ASR Automatic Speech Recognition
  • BI Business Intelligence
  • HID Human Interface Device
  • GUI Graphical User Interface
  • MMUI Multi-Modal User Interface (multi-touch, speech-enhanced)
  • MoMA Museum of Modern Art (NYC)
  • RIA Rich Internet Application
  • SQL CE SQL Compact Edition
  • TPL Task Parallel Library
  • TTS Text-to-Speech
  • UI User Interface
  • UX User eXperience
  • WPF Windows Presentation Foundation
  • XAML Extensible Application Markup Language

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)