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

/*
 * dictionary.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 __DICTIONARY_H__
#define __DICTIONARY_H__

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

typedef struct _DictionaryWord DictionaryWord;
struct _DictionaryWord {
  char    *word;
  Phoneme *decomp;
  int      syllables;
  int      word_count;
  Meter   *meter;
  long     hash;
  unsigned synthesized : 1;
};

typedef void (*DictionaryFn) (DictionaryWord *, gpointer);

DictionaryWord *dictionary_add_word   (const char      *word,
				       Phoneme         *decomp);

DictionaryWord *dictionary_get_word   (const char *word);

Phoneme        *dictionary_get_decomp (const char *phrase);

void            dictionary_load_pronunciation  (const char *filename);

void            dictionary_foreach_by_tail (Phoneme *decomp,
					    DictionaryFn fn,
					    gpointer user_data);

PyObject       *dictionary_word_to_py   (DictionaryWord *dword);
DictionaryWord *dictionary_word_from_py (PyObject *py_dword);

/* Python Extensions */

PyObject *py_dictionary_load   (PyObject *self, PyObject *args);

PyObject *py_dictionary_lookup (PyObject *self, PyObject *args);

#endif /* __DICTIONARY_H__ */

