Sunday, August 30, 2009

SpeechLogger – output log messages in speech form

Last week in our team outing we saw the movie “Transformers: Revenge Of The Fallen”. I loved “Transformers” which was released in 2007, and automatically became a fan of this one too. For those of you who have missed the action, here is the link Transformers movie. Although not unique to this movie, the computer generated audio updates and notifications caught my attention. I was planning something similar for my ‘computer-agents’ (a dream I am working on in my free time), but the application of audio for debugging looked exciting. More importantly, it will make debugging fun.

Now with the Microsoft’s Speech synthesizer in its version 3.0, things are a lot simpler and faster to accomplish. Moreover, .NET is like a song, even if you don’t know the complete lyrics you can manage just by humming. You can find more information on Microsoft's speech technologies and R&D at Microsoft speech, or look for "SpeechSynthesizer” class in MSDN.

Audio deserves a special treatment, the following screencast will add the audio dimension:

Now let us have a look at the design of SpeechLogger: The base over which SpeechLogger sits is Microsoft Speech Synthesizer. Currently, the speech API is in version 3.0.

To develop custom functionality, I have written SpeechGenerator and SpeechQueue classes.

SpeechGenerator is the one that interacts with Microsoft’s Speech Synthesizer. It plays speech and the background sound (if there is any) in separate threads, and also away from your worker or UI threads. This ensures that using speech in your application won’t interfere with application’s core functionality.

Ok, SpeechGenerator is the core, so why do we need SpeechQueue? The reason for this is if you log many messages all might play at once. So to provide synchronous nature over asynchronous mode, we have SpeechQueue class. SpeechQueue maintains a queue of all the speeches to be played and enqueues items as and when SpeechGenerator notifies it.

You can use the SpeechLogger class to log speech messages. So, lets have a look at the code you will have to write to use SpeechLogger:

// set background sound for critical level
SpeechLogger.AttachBackgroundSound(LogLevel.CRITICAL, @"d:\warning.wav");

// log message
SpeechLogger.Log("Preparing to copy file.", LogLevel.INFORMATION);

Here is the code used for the demo-application:

(click the image if it is not clearly visible)

You will soon see a packaged version of SpeechLogger in both in-process and out-process form. The in-process version will be a simple dll that you can add as a reference to your project. Out-process will be a Windows service for speech logging. So till then, happy speech logging.

Sunday, August 02, 2009

A case of knowledge corruption and its remedies

Information these days is flowing from all directions. Traditional sources like books, magazines, newspapers and articles have provided information for centuries. New forms like websites, blogs, emails and sms have emerged and newer ones are breeding. The delivery mechanism in itself has seen a tremendous technological enhancement ranging from text to on-demand services. Whether it is communicated officially or casually, is structured or unstructured, documented or loose, information is found in abundance these days.
Abundance is good and welcomed by all. Unlike commodities, information does not perish with consumption. It combines with the existing knowledge and gives new dimensions to think and work with. Hence, authenticity and correctness of information is of paramount importance for its recipients. Incorrect data cumulated over a period of time leads to knowledge corruption. This is a disaster in a world where knowledge is considered power.
Consider, for example, you receive an email containing statistics about the bandwidth consumption and the behavior pattern of an average Internet user. You find it interesting, believe it, and forward it to your friends and colleague. What you have just done is the beginning of knowledge corruption cycle, unless you were vigilant enough and verified the text you received.

This is a very trivial case with a low impact. Imagine the state of an organization or a team that is working on building a product and follows similar practices for its knowledge management.
In this connected world, the rate at which information can spread is exponential. The process of publishing is also very easy and quick. No certification or authenticity check, not even a simple sanity check is done or is in place. Anyone can publish and circulate anything and there is no accountability. There are no filters that can save you.
How can one ensure that he is not contributing in knowledge corruption? Here are a few simple points to keep in mind:
  • Always quote the source: This helps in building confidence. That’s how scientific journals work. Referencing is an important parameter used in Google’s PageRank algorithm.
  • Control excitement: Excitement leads you to skim information and this leads to half baked knowledge. Emotions make thinking bias. Don’t get carried away and don’t start cooking your own stories.
  • Verify before communicating any dubious information: If you are unsure about the things you are communicating, verify them. Use any search engine and keep searching unless you are convinced.
  • Do not make assumptions: If you are unsure about something, then tell that you don't know. Don't speak just for the sake of speaking.
  • Establish pattern once you have understood the information correctly, whenever feasible try to stay away from patterns during learning phase.
Role of technology and policies
Technology acts as an instrument for enforcing policies. Policies provide rules and filters for publishing information. Technology can also be used to check the authenticity. Here is how we can use a combination of technology and policies to ensure correctness:
  • Information publishing policy: Enforce policies that permit publishing only after authenticity is established. This might be difficult and time consuming for the world information, but is suited for use within organizations. How can this be done when we are not yet very close to machine learning and understanding? Till then, people will have to substitute for machines. This will enable a selected group of people to first validate that the information they are providing (existing information) is correct. Everything above it will be based on and will refer this verified information. How will we add a totally new knowledge base? And how do we add contradicting information (for example, people have different theories and beliefs which are completely opposite to each other)? What about thoughts and vague ideas? These can be categorized as personal opinions and best left to the readers’ perception. If followers increase beyond a certain number, a new religion is formed. This article should hence be categorized as personal beliefs.
  • Rating and collective intelligence: Fix ownership and build a rating system. People will have complete ownership of what they are publishing, circulating, or promoting. Trust-levels can be established by cashing on social networks. People can associate trust-levels to different entities. Say, for example, a person can set that he trusts an entity A (person, source, or information) 100% and trusts another entity B just 75%. The chain continues and the trust-levels are calculated for each entity by using the cumulative ratings. Two types of trust-levels can be established for each entity:
    • Global: This is the trust-level computed using the ratings provided by all the people who have rated the entity.
    • My circle: Trust-level computed using the ratings provided by only the people who are part of the reader’s circle.
    This is similar to other applications of collective intelligence that are already in use for features like “Find similar items” or “You might also like these”.