source: app/src/dgp/mgraph.cc @ 12743b9

Last change on this file since 12743b9 was 3748bd1, checked in by obrebski <obrebski@…>, 17 years ago

1) dgp nie wysypuje sie na nieznanych kategoriach
2) dodane i uzupelnione konfigi

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@49 e293616e-ec6a-49c2-aa92-f4a8b91c5d16

  • Property mode set to 100644
File size: 961 bytes
Line 
1
2#include "mgraph.hh"
3#include "thesymbols.hh"
4#include "const.hh"
5
6#include <stdio.h>
7
8int MGraph::add_node(char* seg)
9{
10  nodes[n].clear();
11 
12  char field1[80], field3[80], descr[256], gph[256];
13  char* cat;
14 
15  getfield(seg,"1",field1);
16  nodes[n].pos=atoi(field1);
17
18  getfield(seg,"3",field3);
19  if(!getfield(seg,"lem",descr)) strcpy(descr,"?,?");
20
21  cat=descr;
22  while(*cat!=',' && *cat ) ++cat;
23  if(*cat) ++cat;
24 
25//  Cat::add(cat);
26  if(Cat::index(cat)>0)
27    nodes[n].cat=cat;
28  else
29    nodes[n].cat="NULL";
30 
31  nodes[n].pred.clear();
32 
33  char* tok;
34  int previd;
35 
36  if(!getfield(seg,"gph",gph))
37  {
38    fprintf(stderr,"No gph field. Aborting (sorry).\n");
39    exit(1);
40  }
41
42  char* ids=strtok(gph,":");
43  if(n!=atoi(ids)){fprintf(stderr,"Invalid node id in line ?. Program aborted.\n"); exit(1); }
44 
45  char *preds;
46  while(preds=strtok(NULL,","))
47  {
48    previd=atoi(preds);
49    nodes[n].pred.push_back(&nodes[previd]);
50  }
51
52  return n++;
53}
54
Note: See TracBrowser for help on using the repository browser.