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

/*
 * token.h
 *
 * Copyright (C) 2003 The Free Software Foundation, Inc.
 *
 * Developed by Jon Trowbridge <trow@gnu.org>
 */

/*
 * 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 __TOKEN_H__
#define __TOKEN_H__

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

#include "phoneme.h"
#include "meter.h"
#include "dictionary.h"

typedef struct _Token Token;
struct _Token {
  char            *word;
  PartOfSpeechTag  tag;
  Phoneme         *decomp;
  int              syllables;
  int              word_count;
  Meter           *meter;

  unsigned left_glue : 1;
  unsigned is_break  : 1;
};

typedef void (*TokenFn) (Token *, gpointer);

#define token_is_break(t) ((t)->is_break)

Token          *token_lookup  (const char     *word,
			       PartOfSpeechTag tag);
Token          *token_pick    (PartOfSpeechTag tag);
Token          *token_break   (void);

PartOfSpeechTag token_get_pos        (Token *token);
int             token_get_syllables  (Token *token);
Meter          *token_get_meter      (Token *token);
int             token_get_word_count (Token *token);

PyObject *token_to_py (Token *token);
Token    *token_from_py (PyObject *py_token);

/* Python Extensions */

PyObject *py_token_lookup (PyObject *self, PyObject *args);
PyObject *py_token_pick   (PyObject *self, PyObject *args);
PyObject *py_token_break  (PyObject *self, PyObject *args);




#endif /* __TOKEN_H__ */

