Last change
on this file since 854bece was
e7de6cc,
checked in by Tomasz Obrebski <to@…>, 13 years ago
|
new version of dgp
added dgc, tre and compdic components
compiledic renamed to compdic_utf8
./configure updated
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | |
---|
2 | #include "mgraph.hh" |
---|
3 | #include "thesymbols.hh" |
---|
4 | #include "const.hh" |
---|
5 | |
---|
6 | #include <cstdio> |
---|
7 | |
---|
8 | int MGraph::add_node(char* seg) |
---|
9 | { |
---|
10 | MNode newnode; |
---|
11 | newnode.clear(); |
---|
12 | |
---|
13 | char field1[80], field3[80], field4[256], descr[256], gph[256]; |
---|
14 | char* cat; |
---|
15 | |
---|
16 | getfield(seg,"1",field1); |
---|
17 | newnode.pos=atoi(field1); |
---|
18 | |
---|
19 | getfield(seg,"3",field3); |
---|
20 | |
---|
21 | getfield(seg,"4",field4); |
---|
22 | strcpy(newnode.form,field4); |
---|
23 | |
---|
24 | if(!getfield(seg,"lem",descr)) strcpy(descr,"?,?"); |
---|
25 | |
---|
26 | cat=descr; |
---|
27 | while(*cat!=',' && *cat ) ++cat; |
---|
28 | if(*cat) ++cat; |
---|
29 | |
---|
30 | if(Cat::index(cat)>0) |
---|
31 | newnode.cat=cat; |
---|
32 | else |
---|
33 | newnode.cat="NULL"; |
---|
34 | |
---|
35 | newnode.pred.clear(); |
---|
36 | |
---|
37 | char* tok; |
---|
38 | int previd; |
---|
39 | |
---|
40 | if(!getfield(seg,"gph",gph)) |
---|
41 | { |
---|
42 | fprintf(stderr,"No gph field. Aborting (sorry).\n"); |
---|
43 | exit(1); |
---|
44 | } |
---|
45 | |
---|
46 | char* ids=strtok(gph,":"); |
---|
47 | if(size() != atoi(ids)) {fprintf(stderr,"Invalid node id in line ?. Program aborted.\n"); exit(1); } |
---|
48 | |
---|
49 | char *preds; |
---|
50 | while(preds=strtok(NULL,",")) |
---|
51 | { |
---|
52 | previd=atoi(preds); |
---|
53 | newnode.pred.push_back(previd); |
---|
54 | } |
---|
55 | |
---|
56 | nodes.push_back(newnode); |
---|
57 | return nodes.size()-1; |
---|
58 | } |
---|
59 | |
---|
Note: See
TracBrowser
for help on using the repository browser.