/* This is -*- C -*- */
/* vim: set sw=2: */
/* $Id$ */

/*
 * meter.h
 *
 * Copyright (C) 2003 The Free Software Foundation, Inc.
 *
 */

/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA.
 */

#ifndef __METER_H__
#define __METER_H__

#include <glib.h>
#include <Python.h>
#include "phoneme.h"

typedef char Meter;
typedef enum {
  METER_STRESSED = '-',
  METER_UNSTRESSED = 'u',
  METER_UNKNOWN = '?',
  METER_ANY = '*',
} MeterType;

#define METER_UNKNOWN_PENALTY 0.6

#define METER_ERROR(a, b) \
  (((a) == METER_UNKNOWN || (b) == METER_UNKNOWN) ? METER_UNKNOWN_PENALTY : \
    (((a) != (b) && (a) != METER_ANY && (b) != METER_ANY) ? 1.0 : 0.0))

Meter *meter_from_phoneme_decomp (Phoneme *);
double metric_error_left (Meter *a, Meter *b);
double metric_error_right (Meter *a, Meter *b);

/* Python Extensions */

PyObject *py_meter_from_phoneme_decomp (PyObject *self, PyObject *args);
PyObject *py_metric_error (PyObject *self, PyObject *args);
PyObject *py_metric_error_left (PyObject *self, PyObject *args);
PyObject *py_metric_error_right (PyObject *self, PyObject *args);


#endif /* __METER_H__ */

