A multi-lingual communicator
Assaf Solomovitch
Tsahi Talmor
Supervisor:
Nissim Natanov
Lab Chief Eng.
Ilana David
Softlab, EE Technion IIT 2006
Table of Contents
Introduction 5
The Phoneme Project 5
Goal of the Project 6
So what is .NET 7
An Introduction to C# 9
Windows Hooks 11
Design Principles 21
Class Diagram 22
Class Diagram overview 24
The Phoneme class is the heart of our application. To it attached three modules, each handles different aspect of the architecture: 24
1.The LowLevelKeyboard Hook and Win32API classes are responsible for interaction with the Windows system, installation of the hook and interception of keyboard presses. 24
The Phonetic translator is a generic class which represents the translation of one string to the other. It is responsible of the other two modules: 24
2.String trie class is our database, which holds the list of words in our language’s vocabulary. 24
3.The Hebrew translator, Heb2EnMap and PredefinedTranslation are all language specific code, in charge of correct translation to Hebrew. 24
Extending the Phoneme project should be fairly easy this way: 24
Migrating to a new language should take only the replacement of module 3, as we will describe later on. 24
Changing data base/data structure is easy and modular, changing only module 2. 24
Migrating the Phoneme application to any other platform should take the replacement of module one only. 24
For a complete description, see appendix B – Phoneme class documentaion 24
Data structure 25
Hebrew translation heuristics 27
How to add another language support 29
תעתיק העיצורים 30
Phoneme Class Documentation 31
Phoneme::AppProfile Class Reference 32
Phoneme::Heb2EnMap Class Reference 35
Phoneme::HebrewTranslator Class Reference 36
Phoneme::IPhoneticTranslatorUserInteraction Interface Reference 38
Phoneme::ITranslatable Interface Reference 39
Phoneme::LowLevelKeyboardHook Class Reference 40
Phoneme::LowLevelKeyboardHook::KeboardHookEventArgs Class Reference 43
Phoneme::Phoneme Class Reference 44
Phoneme::PhoneticTranslator Class Reference 47
Phoneme::predefinedTranslations Class Reference 51
Phoneme::StringTrie Class Reference 53
Phoneme::TrieNode Class Reference 56
Phoneme::Win32API Class Reference 59
Phoneme::Win32API::POINT Struct Reference 60
Phoneme::WordlistDBInterface Interface Reference 61
The End 62
Introduction The Phoneme Project
Many times people with a native language other than English correspond in instant messaging system, and wish to write in their own language (assume Hebrew), but do it in English letters, especially when one has poor English vocabulary. ZO DUGMA BE IVRIT. Moreover, when traveling abroad, keyboards usually have only English letters in them, which renders correspondence in Hebrew impossible. Our application intends to solve this problem, translating from phonetic Hebrew (or Russian and so on) written in Latin characters, to meaningful sentences in written in Hebrew. Our Target clients are:
-
People traveling abroad, Where keyboards have only English characters
-
People with a native language other than English, who have a limited vocabulary in English
-
People who communicate to elderly persons, who usually have a limited vocabulary in English.
Goal of the Project
This is first and foremost an academic project, intended to introduce us, the students, to the .NET framework as a whole, while also exposing us to the C# programming language.
Why Phoneme?
On first encounter, one might think that this application is easy and straight-forward. The truth is, that there is a lot of wisdom invested in it, so the minimized, unobtrusive GUI does not reflect the code complexity. On the contrary, we wrote a lot of code just to make the application transparent. We had to learn quite a few new technologies and subjects, that are all incorporated in this work some way or the other,
Among the things we have learnt:
-
Windows UI programming
-
The .NET platform and c#
-
Interoperability between .net and win32
-
Efficient data structures for language based databases
-
Creating Windows Forms and controls
-
Unicode character set
So what is .NET
.NET is first and foremost a library. It is an API that provides the developer with a large range of tools to create Windows applications, access databases, connect to the internet or provide web services.
.NET also provides the .NET Runtime, the environment in which code is run, threads are managed and various background services are provided.
.NET was designed with interoperability in mind. That is why the compilation of code is performed in two stages. First it is compiled into the Microsoft Intermediate Language (IL) and then it is compiled according to the specific platform. This allows for the same project to contain segments of code in different programming languages.
The IL is truly an intermediate language. It is low-level and simple and can be easily translated to the platform-specific code. It is also compiled "Just-In-Time", meaning that each segment of code is compiled as it is called and not before hand. This is more efficient since the chances of large portions of code being executed at one time are slim.
So we can see that this technique provides both performance improvement and language interoperability, allowing the developer to choose between VB.NET, managed C++ (managed means its intended for .NET), J++, J#, C# or any other .NET-supported language.
Another important concept worth mentioning in this context is assemblies. Assemblies are logical units that contain compiled code. Assemblies also contain metadata that describes the types and methods of the code. Moreover, they contain metadata about themselves that is called manifest and is intended to allow checking of the assembly's version and the assembly's integrity.
This means that all the data is stored in one place and the application doesn't need to access the registry or any other source.
Assemblies can be divided into two types: Private Assemblies and Shared Assemblies. The former is intended for use with commercial software or other applications that require the assembly to be stored in the same library and used internally. The latter is meant to be shared among different applications.
The .NET base class library provides the developer with a large range of possibilities, including:
-
Windows controls and GUI
-
Web Forms
-
Database access and manipulation
-
Access to the File System and the Registry
-
Networks and web applications
Share with your friends: |