Blame view

tools/lia_ltbox/lia_ne_v2.2/src/onelinex.c 1.17 KB
f34231730   Jean-François Rey   add lia_ne + crf+...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  /*
   * Put on one line all tokens, after a token starting with XXXX : for
   * from_trs2token
   */
  /* FRED 0309  */
  
  #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
  ", ch1, ch2);
  	exit(0);
  }
  
  /* ................................................................ */
  
  /*
   * format intput:
   * 
   * XXXX0 sept heures XXXX1 à l' écoute d' XXXX2 RTM Chaîne Inter XXXX3 . XXXX4 _
   * 
   * format output: XXXX0 sept heures XXXX1 à l' écoute d' XXXX2 RTM Chaîne Inter
   * XXXX3 . XXXX4 _
   */
  
  int 
  main(int argc, char **argv)
  {
  	char            ch[TailleLigne], *pt;
  	int             nb, dejaone;
  
  	for (dejaone = False, nb = 0; fgets(ch, TailleLigne, stdin); nb++)
  		for (pt = strtok(ch, " \t
  "); pt; pt = strtok(NULL, " \t
  "))
  			if (strcmp(pt, "<s>")) {
  				if ((!strncmp(pt, "XXXX", 4)) || (!strncmp(pt, "xxxx", 4))) {
  					if (dejaone)
  						printf("
  ");
  					else
  						dejaone = True;
  					printf("%s", pt);
  				} else
  					printf(" %s", pt);
  			}
  	exit(0);
  }