// (c) MIT 2003.  All rights reserved.

// -*-Mode: Java-*- 
// $Id: SentenceRecognizer.java,v 1.4 2003/03/06 00:40:49 moltmans Exp $
// SentenceRecognizer.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Thu Feb  3 18:56:41 2000> 
// Time-stamp: <2000-05-11 20:53:52 moltmans> 
package rec.annotate.recognizers;

import java.util.*;
import rec.sys.*;
import rec.util.*;
import rec.annotate.widgets.*;

/**
 * Recognize sentences parsed from speech input.
 **/
public class SentenceRecognizer extends Recognizer 
{
  private static final String m_SentenceTag = "sentence";
  
  public boolean recognize( Surface s, Widget w )
  {
    WUtterance utterance = (WUtterance)w;

    if ( utterance.hasTag( m_SentenceTag ) ) {
      Widget sentence = new WSentence( s, utterance );
      s.replaceWidget( w, sentence );
      return true;
    }

    return false;
  }
  
  public Iterator getInputTypes()
  {
    Vector v = new Vector();

    v.addElement( "rec.sys.WUtterance" );
    v.addElement( "rec.sys.WTextUtterance" );
    v.addElement( "rec.sys.WSpeechUtterance" );

    return( v.iterator() );
  }

  public Iterator getOutputTypes()
  {
    Vector v = new Vector();

    v.addElement( "rec.annotate.widgets.WSentence" );

    return( v.iterator() );
  }
}

