Select Git revision
process_xml_for_slu.c
-
Benoit Favre authoredBenoit Favre authored
process_xml_for_slu.c 10.90 KiB
/* Process Rocio XML for SLU */
/* FRED 0215 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
/*................................................................*/
#define TailleLigne 8000
#define True 1
#define False 0
void ERREUR(char *ch1,char *ch2)
{
fprintf(stderr,"ERREUR : %s %s\n",ch1,ch2);
exit(0);
}
void ERREURd(char *ch1, int i)
{
fprintf(stderr,"ERREUR : %s %d\n",ch1,i);
exit(0);
}
/*................................................................*/
/* FST DICO */
#define MAX_SIZE_DICO 1000
#define IGLOU 1
#define PENALGLOU 100
#define PENALEND 100
#define PENALSUB 10
#define STARTNEW 2
char *CHglouton="<joker>";
char *CHepsilon="<epsilon>";
char *T_dico_action[MAX_SIZE_DICO],*T_dico_word[MAX_SIZE_DICO];
int NbAction=STARTNEW,NbWord=STARTNEW;
int from_action_to_index(char *ch)
{
int i;
for(i=STARTNEW;(i<NbAction)&&(strcmp(ch,T_dico_action[i]));i++);
if (i==NbAction) T_dico_action[NbAction++]=strdup(ch);
if (NbAction==MAX_SIZE_DICO) ERREUR("cste MAX_SIZE_DICO too small","");
return i;
}
int from_word_to_index(char *ch)
{
int i;
for(i=STARTNEW;(i<NbWord)&&(strcmp(ch,T_dico_word[i]));i++);
if (i==NbWord) T_dico_word[NbWord++]=strdup(ch);
if (NbWord==MAX_SIZE_DICO) ERREUR("cste MAX_SIZE_DICO too small","");
return i;
}
/*................................................................*/
/* format:
<homeostasis version="25-11-2014">
<liste_section sequences="1,2,3,4,5,6,7,8,9" ordre="variable" repetition="oui" action="exclusive">
<section id="1" action="start_scene1">
<sequence ordre="strict" repetition="non" action="" lang="eng">
<keyword action="start_scene1" lang="esp"> uno </keyword>