Sunday, April 01, 2007

 

A new Newsweek poll reveals frightening data about the curious disjunct between faith and science among Americans.  Pundits have attributed these results to anything from poor science education in pre-K programs to global warming.  According to the poll, while 51% percent of Americans still ascribe to Darwin's theory of gradual evolution through adaptation, an amazing 42% continue to cleave to Lamarkianism, while only 6% believe in Punctuated Equilibrium. 1% remain uncommitted and are waiting to hear more before they come to a final decision.

This has led me to wonder what else Americans believe:

The 2002 Roper Poll found that 48% of americans believe in UFO's, while 37% believe that there has been first hand contact between aliens and humans.  25% of Americans believe in alien abductions, while approximately 33% believe that humans are the only intelligent life in the universe, and that all the UFO stuff is bunk.

The 33% of people who ascribe to the anthropocentric view of the universe corresponds numerically with the 33% of Americans who opposed the recent deadline for troop withdrawal from Iraq (PEW Research center poll).   According to the Gallup poll, in 1996 33% of Americans thought they would become rich someday.  By 2003, this number had dropped to 31%.  According to a Scripps Howard/Ohio University poll, 33% of the American public suspects that federal officials assisted in the 9/11 terrorist attacks or took no action to stop them so the United States could go to war in the Middle East.  A Harris poll discovered that in 2004, 33% of adult Americans considered themselves Democrats.

PEW says that as of 2004, 33 million American internet users had reviewed or rated something as part of an online rating system.  33 million Americans were living in povery in 2001, according to the U.S. Census Bureau.  According to PEW, in 2006 33 million Americans had heard of VOIP.  Each year, 33 million Americans use mental health services or services to treat their problems and illnesses resluting from alcohol, inappropirate use of prescription medications, or illegal drugs.  The New York Times says that out of 33 countries, Americans are least likely to believe in evolution.  Researchers estimate that 33% of Americans born in 2000 will develop diabetes.  In the same year, 33 million Americans lost their jobs.

CBS pollsters discovered that 22% of Americans have seen or felt the presence of a ghost.  48% believe in ghosts.  ICR says 48% of Americans oppose embryonic stem-cell research.  CBS finds that 61% support embryonic stem-cell research.  There is no poll data available on whether they believe that embryos used for stem-cell research will one day become ghosts themselves.

82% of Americans believe that global warming is occuring, according to Fox News/Opinion Dynamics.  79% believe people's behavior has contributed to global warming.  89% do not believe the U.S. government staged or faked the Apollo moon landing, according to Gallup.  Gallup also found that 41% of Americans believe in ESP, 25% believe in Astrology, 20% believe in reincarnation, while only 9% believe in channeling.  A USA TODAY/ABC News/Stanford University Medical Center poll found that 5% of American adults have turned to acupuncture for pain relief.

According to Gallup, 44% of Americans go out of their way to see movies starring Tom Hanks.  34% go out of their way to avoid movies starring Tom Cruise.  Only 18% go out of their way to avoid Angelina Jolie.

posted by J Ashley on Sunday, April 01, 2007 2:34:28 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, March 07, 2007

In the Valentine's edition of The New Yorker, there was a rather nice portrait by Larissa MacFarquhar of Paul and Pat Churchland, connubial philosophers of the mind-body problem at UC San Diego.  For years they have been basically decrying in the wilderness against the way that philosophy of mind was being done without any regard for the experimental data being produced by studies in neurophysiology.  In the article, Pat Churchland says this prevalent approach was the result of Anglo-American common language philosophy, which holds that the object of philosophy is to clarify our ideas by analyizing language. The problem, as she sees it, is that clarifying incorrect notions about the relationship between mind and body does not get us to truth, but rather leads us simply to have sophisticated bad ideas.  The mind-body problem had become a problematic (to borrow from Foucault), when the evidence from neurophysiology was very clear -- there is the brain and that's it.  Everything else is language games.

The article continues on a disappointed note:

These days, many philosophers give Pat credit for admonishing them that a person who wants to think seriously about the mind-body problem has to pay attention to the brain.  But this acknowledgment is not always extended to Pat herself, or to the work she does now.

 

The common language philosophy that Pat Churchland critisizes has its roots in german philosophy and the general post-Kantian diminishing of the relevance of Metaphysics.  The deathknell for metaphysics in the 20th century may have arrived with Wittgenstein's pronouncement in the Tractatus Logico-Philosophicus that  "[w]ovon man nicht sprechen kann, darĂ¼ber muss man schweigen."  There are different ways to take this, of course, one of which is to say that, as with the dove-tailing of Kant's first and second critiques, it delimits metaphysics in order to make room for faith (or occultism, or theosophy, or whatever).

The other is that it states what is already well known, that Metaphysic is dead, and there is nothing more to say about her.  But if philosophers can no longer talk about metaphysics, then what shall they talk about?  For years in Anglo-American philosophy, they talked about language.  Instead of the relation between appearance and reality in the world, they talked about appearance and meaning in language instead.  What the Churchlands found disturbing about this was that this seemed simply to be a way to practice metaphysics underground.  Philosophers could dismiss metaphysics on the one hand, but then reintroduce it in their conversations about language instead -- though insisting that all they were doing was discussing how we talk about metaphysical notions, not metaphysics itself.  Like vampire hunters to the rescue (though under-appreciated, as indicated above) the Churchlands moved in and reapplied Wittgenstein's dictum to this underground metaphysics.  I like to think of them as latter day versions of Maximus the Confessor, pointing out that the compromise monothelite christology was in fact simply the monophysite heresy under a new guise.  Claiming that Christ has two natures but one will is no better than claiming that he has one nature.  Claiming that mind and body are the same in the world but separated in language is no better than claiming that they are different in the world, also.

The natural endpoint for the Churchlands is, then, to make our language conform to the world, in order to remove these errors of thought.

One afternoon recently, Paul says, he was home making dinner when Pat burst in the door, having come straight from a frustrating faculty meeting. "She said, 'Paul, don't speak to me, my serotonin levels have hit bottom, my brain is awash in glucocorticoids, my blood vessels are full of adrenaline, and if it weren't for my endogenous opiates I'd have driven the car into a tree on the way home.  My dopamine levels need lifting.  Pour me a Chardonnay, and I'll be down in a minute.'"  Paul and Pat have noticed that it is not just they who talk this way -- their students now talk of psychopharmacology as comfortably as of food.

 

But if we cannot do metaphysics, and we should not even talk of it anymore, what should philosophers do with themselves?  Open Court Press may have found an answer with their Popular Culture and Philosophy series.  Not all the books listed below are from their press, but they do emphasize the point that if we cannot speak of metaphysics, that is if we cannot use philosophy to go beyond what we already know, then we ought to use her instead to explore those things that we are familiar with.  We should practice the perennial philosophy.

  1. The Beatles and Philosophy
  2. Monty Python and Philosophy
  3. U2 and Philosophy
  4. Undead and Philosophy
  5. Bob Dylan and Philosophy
  6. The Simpsons and Philosophy
  7. Harry Potter and Philosophy
  8. Buffy the Vampire Slayer and Philosophy
  9. James Bond and Philosophy
  10. The Sopranos and Philosophy
  11. Star Wars and Philosophy
  12. Baseball and Philosophy
  13. The Matrix and Philosophy
  14. More Matrix and Philosophy
  15. Woody Allen and Philosophy
  16. South Park and Philosophy
  17. The Lord of the Rings and Philosophy
  18. Poker and Philosophy
  19. Hip-Hop and Philosophy
  20. Basketball and Philosophy
  21. Hitchcock and Philosophy
  22. The Atkins Diet and Philosophy
  23. Superheroes and Philosophy
  24. Harley-Davidson and Philosophy
  25. The Grateful Dead and Philosophy
  26. Seinfeld and Philosophy
  27. Mel Gibson's Passion and Philosophy
  28. The Chronicles of Narnia and Philosophy
  29. Bullshit and Philosophy
  30. Johnny Cash and Philosophy
posted by J Ashley on Wednesday, March 07, 2007 10:04:41 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]
 Thursday, March 01, 2007

In the comments section of a blog I like to frequent, I have been pointed to an article in the International Herald about Pierre Bayard's new book,  How to Talk About Books You Haven't Read.

Bayard recommends strategies such as abstractly praising the book, offering silent empathy regarding someone else's love for the book, discussing other books related to the book in question, and finally simply talking about oneself.  Additionally, one can usually glean enough information from reviews, book jackets and gossip to sustain the discussion for quite a while.

Students, he noted from experience, are skilled at opining about books they have not read, building on elements he may have provided them in a lecture. This approach can also work in the more exposed arena of social gatherings: the book's cover, reviews and other public reaction to it, gossip about the author and even the ongoing conversation can all provide food for sounding informed.

I've recently been looking through some AI experiments built on language scripts, based on the 1966 software program Eliza, which used a small script of canned questions to maintain a conversation with computer users.  You can play a web version of Eliza here, if you wish.  It should be pointed out that the principles behind Eliza are the same as those that underpin the famous Turing Test.  Turing proposed answering the question can machines think by staging an ongoing experiment to see if machines can imitate thinking.  The proposal was made in his 1950 paper Computing Machinery and Intelligence:

The new form of the problem can be described in terms of a game which we call the 'imitation game." It is played with three people, a man (A), a woman (B), and an interrogator (C) who may be of either sex. The interrogator stays in a room apart front the other two. The object of the game for the interrogator is to determine which of the other two is the man and which is the woman. He knows them by labels X and Y, and at the end of the game he says either "X is A and Y is B" or "X is B and Y is A." The interrogator is allowed to put questions to A and B thus:

C: Will X please tell me the length of his or her hair?

Now suppose X is actually A, then A must answer. It is A's object in the game to try and cause C to make the wrong identification. His answer might therefore be:

"My hair is shingled, and the longest strands are about nine inches long."

In order that tones of voice may not help the interrogator the answers should be written, or better still, typewritten. The ideal arrangement is to have a teleprinter communicating between the two rooms. Alternatively the question and answers can be repeated by an intermediary. The object of the game for the third player (B) is to help the interrogator. The best strategy for her is probably to give truthful answers. She can add such things as "I am the woman, don't listen to him!" to her answers, but it will avail nothing as the man can make similar remarks.

We now ask the question, "What will happen when a machine takes the part of A in this game?" Will the interrogator decide wrongly as often when the game is played like this as he does when the game is played between a man and a woman? These questions replace our original, "Can machines think?"

The standard form of the current Turing experiments is something called a chatterbox application.  Chatterboxes abstract the mechanism for generating dialog from the dialog scripts themselves by utilizing a set of rules written in a common format.  The most popular format happens to be an XML standard called AIML (Artificial Intelligence Markup Language).

What I'm interested in, at the moment, is not so much whether I can write a script that will fool people into thinking they are talking with a real person, but rather whether I can write a script that makes small talk by discussing the latest book.  If I can do this, it should validate Pierre Bayard's proposal, if not Alan Turing's.

posted by J Ashley on Thursday, March 01, 2007 11:46:18 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, February 25, 2007

Voice command technology, as exemplified in Part II, is probably the most useful and most easy to implement aspect of the Speech Recognition functionality provided by Vista.  In a few days of work, any current application can be enabled to use it, and the potential for streamlining workflow and making it more efficient is truly breathtaking.  The cool factor, of course, is also very high.

Having grown up watching Star Trek reruns, however, I can't help but feel that the dictation functionality is much more interesting than the voice command functionality.  Computers are meant to be talked to and told what to do, as in that venerable TV series, not cajoled into doing tricks for us based on finger motions over a typewriter.  My long-term goal is to be able to code by talking into my IDE in order to build UML diagrams and then, at a word, turn that into an application.  What a brave new world that will be.  Toward that end, the SR managed API provides the DictationGrammar class.

Whereas the Grammar class works as a gatekeeper, restricting the phrases that get through to the speech recognized handler down to a select set of rules, the DictateGrammar class, by default, kicks out the jams and lets all phrases through to the recognized handler.

In order to make Speechpad a dictation application, we will add the default DicatateGrammar object to the list of grammars used by our speech recognition engine.  We will also add a toggle menu item to turn dictation on and off.  Finally, we will alter the SpeechToAction() method in order to insert any phrases that are not voice commands into the current Speechpad document as text.  Create an local instance of DictateGrammar for our Main form, and then instantiate it in the Main constructor.  Your code should look like this:

	#region Local Members
		
        private SpeechSynthesizer synthesizer = null;
        private string selectedVoice = string.Empty;
        private SpeechRecognitionEngine recognizer = null;
        private DictationGrammar dictationGrammar = null;
        
        #endregion
        
        public Main()
        {
            InitializeComponent();
            synthesizer = new SpeechSynthesizer();
            LoadSelectVoiceMenu();
            recognizer = new SpeechRecognitionEngine();
            InitializeSpeechRecognitionEngine();
            dictationGrammar = new DictationGrammar();
        }
        

Create a new menu item under the Speech menu and label it "Take Dictation".  Name it takeDictationMenuItem for convenience. Add a handler for the click event of the new menu item, and stub out TurnDictationOn() and TurnDictationOff() methods.  TurnDictationOn() works by loading the local dictationGrammar object into the speech recognition engine. It also needs to turn speech recognition on if it is currently off, since dictation will not work if the speech recognition engine is disabled. TurnDictationOff() simply removes the local dictationGrammar object from the speech recognition engine's list of grammars.

		
        private void takeDictationMenuItem_Click(object sender, EventArgs e)
        {
            if (this.takeDictationMenuItem.Checked)
            {
                TurnDictationOff();
            }
            else
            {
                TurnDictationOn();
            }
        }

        private void TurnDictationOn()
        {
            if (!speechRecognitionMenuItem.Checked)
            {
                TurnSpeechRecognitionOn();
            }
            recognizer.LoadGrammar(dictationGrammar);
            takeDictationMenuItem.Checked = true;
        }

        private void TurnDictationOff()
        {
            if (dictationGrammar != null)
            {
                recognizer.UnloadGrammar(dictationGrammar);
            }
            takeDictationMenuItem.Checked = false;
        }
        

For an extra touch of elegance, alter the TurnSpeechRecognitionOff() method by adding a line of code to turndictation off when speech recognition is disabled:

        TurnDictationOff();

Finally, we need to update the SpeechToAction() method so it will insert any text that is not a voice command into the current Speechpad document.  Use the default statement of the switch control block to call the InsertText() method of the current document.

        
        private void SpeechToAction(string text)
        {
            TextDocument document = ActiveMdiChild as TextDocument;
            if (document != null)
            {
                DetermineText(text);
                switch (text)
                {
                    case "cut":
                        document.Cut();
                        break;
                    case "copy":
                        document.Copy();
                        break;
                    case "paste":
                        document.Paste();
                        break;
                    case "delete":
                        document.Delete();
                        break;
                    default:
                        document.InsertText(text);
                        break;
                }
            }
        }

        

With that, we complete the speech recognition functionality for Speechpad. Now try it out. Open a new Speechpad document and type "Hello World."  Turn on speech recognition.  Select "Hello" and say delete.  Turn on dictation.  Say brave new.

This tutorial has demonstrated the essential code required to use speech synthesis, voice commands, and dictation in your .Net 2.0 Vista applications.  It can serve as the basis for building speech recognition tools that take advantage of default as well as custom grammar rules to build adanced application interfaces.  Besides the strange compatibility issues between Vista and Visual Studio, at the moment the greatest hurdle to using the Vista managed speech recognition API is the remarkable dearth of documentation and samples.  This tutorial is intended to help alleviate that problem by providing a hands on introduction to this fascinating technology.

posted by J Ashley on Sunday, February 25, 2007 11:43:49 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, February 24, 2007

Playing with the speech synthesizer is a lot of fun for about five minutes (ten if you have both Microsoft Anna and Microsoft Lila to work with)  -- but after typing "Hello World" into your Speechpad document for the umpteenth time, you may want to do something a bit more challenging.  If you do, then it is time to plug in your expensive microphone, since speech recognition really works best with a good expensive microphone.  If you don't have one, however, then go ahead and plug in a cheap microphone.  My cheap microphone seems to work fine.  If you don't have a cheap microphone, either, I have heard that you can take a speaker and plug it into the mic jack of your computer, and if that doesn't cause an explosion, you can try talking into it.

While speech synthesis may be useful for certain specialized applications, voice commands, by cantrast, are a feature that can be used to enrich any current WinForms application. With the SR Managed API, it is also easy to implement once you understand certain concepts such as the Grammar class and the SpeechRecognitionEngine.

We will begin by declaring a local instance of the speech engine and initializing it. 

	#region Local Members
		
        private SpeechSynthesizer synthesizer = null;
        private string selectedVoice = string.Empty;
        private SpeechRecognitionEngine recognizer = null;
        
        #endregion
        
        public Main()
        {
            InitializeComponent();
            synthesizer = new SpeechSynthesizer();
            LoadSelectVoiceMenu();
            recognizer = new SpeechRecognitionEngine();
            InitializeSpeechRecognitionEngine();
        }
        
        private void InitializeSpeechRecognitionEngine()
        {
            recognizer.SetInputToDefaultAudioDevice();
            Grammar customGrammar = CreateCustomGrammar();
            recognizer.UnloadAllGrammars();
            recognizer.LoadGrammar(customGrammar);
            recognizer.SpeechRecognized += 
            	new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
            recognizer.SpeechHypothesized += 
            	new EventHandler<SpeechHypothesizedEventArgs>(recognizer_SpeechHypothesized);
        }
   
        private Grammar CreateCustomGrammar()
        {
            GrammarBuilder grammarBuilder = new GrammarBuilder();
            grammarBuilder.Append(new Choices("cut", "copy", "paste", "delete"));
            return new Grammar(grammarBuilder);
        }
        

The speech recognition engine is the main workhorse of the speech recognition functionality.  At one end, we configure the input device that the engine will listen on.  In this case, we use the default device (whatever you have plugged in), though we can also select other inputs, such as specific wave files.  At the other end, we capture two events thrown by our speech recognition engine.  As the engine attempts to interpret the incoming sound stream, it will throw various "hypotheses" about what it thinks is the correct rendering of the speech input.  When it finally determines the correct value, and matches it to a value in the associated grammar objects, it throws a speech recognized event, rather than a speech hypothesized event.  If the determined word or phrase does not have a match in any associated grammar, a speech recognition rejected event (which we do not use in the present project) will be thrown instead.

In between, we set up rules to determine which words and phrases will throw a speech recognized event by configuring a Grammar object and associating it with our instance of the speech recognition engine.  In the sample code above, we configure a very simple rule which states that a speech recognized event will be thrown if any of the following words: "cut", "copy", "paste", and "delete", is uttered.  Note that we use a GrammarBuilder class to construct our custom grammar, and that the syntax of the GrammarBuilder class closely resembles the syntax of the StringBuilder class.

This is the basic code for enabling voice commands for a WinForms application.  We will now enhance the Speechpad application by adding a menu item to turn speech recognition on and off,  a status bar so we can watch as the speech recognition engine interprets our words, and a function that will determine what action to take if one of our key words is captured by the engine.

Add a new menu item labeled "Speech Recognition" under the "Speech" menu item, below "Read Selected Text" and "Read Document".  For convenience, name it speechRecognitionMenuItem.  Add a handler to the new menu item, and use the following code to turn speech recognition on and off, as well as toggle the speech recognition menu item.  Besides the RecognizeAsync() method that we use here, it is also possible to start the engine synchronously or, by passing it a RecognizeMode.Single parameter, cause the engine to stop after the first phrase it recognizes. The method we use to stop the engine, RecognizeAsyncStop(), is basically a polite way to stop the engine, since it will wait for the engine to finish any phrases it is currently processing before quitting. An impolite method, RecognizeAsyncCancel(), is also available -- to be used in emergency situations, perhaps.

        private void speechRecognitionMenuItem_Click(object sender, EventArgs e)
        {
            if (this.speechRecognitionMenuItem.Checked)
            {
                TurnSpeechRecognitionOff();
            }
            else
            {
                TurnSpeechRecognitionOn();
            }
        }

        private void TurnSpeechRecognitionOn()
        {
             recognizer.RecognizeAsync(RecognizeMode.Multiple);
             this.speechRecognitionMenuItem.Checked = true;       
        }

        private void TurnSpeechRecognitionOff()
        {
            if (recognizer != null)
            {
                recognizer.RecognizeAsyncStop();
                this.speechRecognitionMenuItem.Checked = false;
            }
        }
        

We are actually going to use the RecognizeAsyncCancel() method now, since there is an emergency situation. The speech synthesizer, it turns out, cannot operate if the speech recognizer is still running. To get around this, we will need to disable the speech recognizer at the last possible moment, and then reactivate it once the synthesizer has completed its tasks. We will modify the ReadAloud() method to handle this.

 
       private void ReadAloud(string speakText)
       {
            try
            {
               SetVoice();
               recognizer.RecognizeAsyncCancel();
               synthesizer.Speak(speakText);  
               recognizer.RecognizeAsync(RecognizeMode.Multiple);
            }
            catch (Exception ex)
            {
               MessageBox.Show(ex.Message);
            }
       
       }
The user now has the ability to turn speech recognition on and off. We can make the application more interesting by capturing the speech hypothesize event and displaying the results to a status bar on the Main form.  Add a StatusStrip control to the Main form, and a ToolStripStatusLabel to the StatusStrip with its Spring property set to true.  For convenience, call this label toolStripStatusLabel1.  Use the following code to handle the speech hypothesized event and display the results:
        
        private void recognizer_SpeechHypothesized(object sender, SpeechHypothesizedEventArgs e)
        {
            GuessText(e.Result.Text);
        }

        private void GuessText(string guess)
        {
            toolStripStatusLabel1.Text = guess;
            this.toolStripStatusLabel1.ForeColor = Color.DarkSalmon;
        }
        

Now that we can turn speech recognition on and off, as well as capture misinterpretations of the input stream, it is time to capture the speech recognized event and do something with it.  The SpeechToAction() method will evaluate the recognized text and then call the appropriate method in the child form (these methods are accessible because we scoped them internal in the Textpad code above).  In addition, we display the recognized text in the status bar, just as we did with hypothesized text, but in a different color in order to distinguish the two events.

        
        private void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            string text = e.Result.Text;
            SpeechToAction(text);
        }

        private void SpeechToAction(string text)
        {
            TextDocument document = ActiveMdiChild as TextDocument;
            if (document != null)
            {
                DetermineText(text);
                
                switch (text)
                {
                    case "cut":
                        document.Cut();
                        break;
                    case "copy":
                        document.Copy();
                        break;
                    case "paste":
                        document.Paste();
                        break;
                    case "delete":
                        document.Delete();
                        break;
                }
            }
        }

        private void DetermineText(string text)
        {
            this.toolStripStatusLabel1.Text = text;
            this.toolStripStatusLabel1.ForeColor = Color.SteelBlue;
        }

        

Now let's take Speechpad for a spin.  Fire up the application and, if it compiles, create a new document.  Type "Hello world."  So far, so good.  Turn on speech recognition by selecting the Speech Recognition item under the Speech menu.  Highlight "Hello" and say the following phrase into your expensive microphone, inexpensive microphone, or speaker: delete.  Now type "Save the cheerleader, save the".  Not bad at all.

posted by J Ashley on Saturday, February 24, 2007 2:31:13 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]