source: _old/app/src/dgp/sgraph.hh @ 93afab8

Last change on this file since 93afab8 was a6e708f, checked in by tom <tom@…>, 13 years ago

ANULOWANIE POPRZEDNIEGO COMMITU

Revert "Replacing old implementation with working implementation"

This reverts commit 1e121f45e2d091fcd34a893291b8453e350d5884.

Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit.

Committer: tom <tom@lim.(none)>

On branch master
Changes to be committed:

(use "git reset HEAD <file>..." to unstage)

modified: _old/app/Makefile
deleted: _old/app/conf/Makefile
deleted: _old/app/conf/compiledic.conf
deleted: _old/app/conf/cor.conf
deleted: _old/app/conf/dgc.conf
deleted: _old/app/conf/dgp.conf
deleted: _old/app/conf/gph.conf
deleted: _old/app/conf/grp.conf
deleted: _old/app/conf/gue.conf
deleted: _old/app/conf/kor.conf
deleted: _old/app/conf/lem.conf
deleted: _old/app/conf/mar.conf
deleted: _old/app/conf/ser.conf
deleted: _old/app/conf/utt.conf
modified: _old/app/src/common/Makefile
modified: _old/app/src/compiledic/Makefile
modified: _old/app/src/compiledic/aut2fsa.cc
modified: _old/app/src/cor/Makefile
modified: _old/app/src/dgp/Makefile
new file: _old/app/src/dgp/canonize
new file: _old/app/src/dgp/dgc
modified: _old/app/src/dgp/grammar.hh
modified: _old/app/src/dgp/mgraph.hh
modified: _old/app/src/dgp/sgraph.hh
modified: _old/app/src/dgp/thesymbols.hh
new file: _old/app/src/dgp/tre
modified: _old/app/src/gue/Makefile
modified: _old/app/src/gue/guess.cc
modified: _old/app/src/kor/Makefile
modified: _old/app/src/kor/corlist.cc
modified: _old/app/src/kor/corr.cc
new file: _old/app/src/kor/corr.hh
modified: _old/app/src/kor/main.cc
modified: _old/app/src/lem/Makefile
modified: _old/app/src/lem/lem.cc
modified: _old/app/src/lib/Makefile
modified: _old/app/src/lib/auttools.cc
modified: _old/app/src/lib/symtab.cc
modified: _old/app/src/lib/tft.h
modified: _old/app/src/lib/tfti.h
modified: _old/app/src/lib/ttrans.h
modified: _old/app/src/lib/word.cc
modified: _old/app/src/lib/word.h
modified: _old/app/src/tok.c/Makefile
modified: _old/app/src/tok.c/cmdline_tok.ggo
modified: _old/app/src/tok.c/common_tok.cc
modified: _old/app/src/tok/Makefile
modified: _old/nawszelkiwypadek/tools/aut2fsa
modified: _old/nawszelkiwypadek/tools/cor_dic/makeLabels.pl
modified: _old/nawszelkiwypadek/tools/cor_dic/prep.pl
modified: _old/nawszelkiwypadek/tools/fsm2aut
modified: _old/nawszelkiwypadek/tools/gue_dic/canon.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/compile_user_dict.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/count_prefs.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/cut_prefs.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/makeLabels.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/prep.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/prep_user_dict.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/rmDup.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/stat.pl
modified: _old/nawszelkiwypadek/tools/gue_dic/stat_pre.pl
modified: _old/nawszelkiwypadek/tools/lem_dic/makeLabels.pl
modified: _old/nawszelkiwypadek/tools/lem_dic/prep.pl
modified: auto/defaults
modified: auto/options
modified: auto/output/Makefile
modified: auto/output/config_h
modified: auto/summary
modified: configure

  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef _SGRAPH_HH
2#define _SGRAPH_HH
3
4#include <stdio.h>
5
6#include <list>
7#include <vector>
8#include <bitset>
9
10#include "const.hh"
11#include "thesymbols.hh"
12
13
14using namespace std;
15
16class MNode;
17
18
19struct Arc
20{
21  int dst;
22  Role role;
23  int anc;
24 
25  Arc(int d, Role r, int a) : dst(d), role(r), anc(a) {};
26 };
27
28
29struct NodeProp
30{
31  bitset<MAXTYPES> required;
32  bitset<MAXTYPES> forbidden;
33
34  bool operator==(const NodeProp& p)
35  { return required==p.required && forbidden==p.forbidden; }
36
37  void clear()
38  { required.reset(), forbidden.reset(); }
39
40};
41
42
43struct SNode
44{
45 
46  MNode* mnode;
47
48  NodeProp prop;
49
50  bitset<MAXNODES> LV;
51  bitset<MAXNODES> LH;
52  bitset<MAXNODES> LD;
53  bool in_LH;
54
55  vector<Arc> heads;
56  vector<Arc> deps;
57
58  void clear()      { prop.clear(), LV.reset(), LD.reset(), LH.reset(), heads.clear(), deps.clear(); }
59  bool saturated()  { return prop.required.none(); }
60};
61
62
63
64class SGraph
65{
66public:
67
68  SNode nodes[MAXNODES];
69  int n; // number of nodes
70
71  enum Output { HEADS=1, DEPS=2, SETS=4, CONSTRAINTS=8 };
72
73  SGraph() : n(0) {}
74
75  void clear() { n=0; }
76 
77  int add_base_snode(MNode* mn);
78  int clone(int ancind, NodeProp newprop);
79  void update_left(int headind, int depind);
80  void update_right(int headind, int depind);
81
82  bool visible(int left, int right);
83  bool saturated(int node);
84
85  //--------------------------------------------------------------------
86
87  void read(FILE* f);
88  void write(FILE* f, list<int> nodelist, unsigned int info);
89
90  int sprint_node(char* buf, int n, unsigned int info);
91  int print_node(FILE* f, int n, unsigned int info);
92  int sprint_node_debug(char* buf, const char* pref, int n);
93  int print_node_debug(FILE* f, const char* pref, int n);
94
95  void print_arc(FILE* f, int left, int right, Role role, int dir); // 0 - left, 1 - right
96
97};
98
99
100inline bool SGraph::visible(int left, int right)
101{
102  return nodes[right].LV[left];
103}
104
105inline bool SGraph::saturated(int node)
106{
107  return nodes[node].saturated();
108}
109
110#endif
Note: See TracBrowser for help on using the repository browser.