source: _old/app/src/dgp/grammar.hh @ 5f4d9c3

Last change on this file since 5f4d9c3 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.6 KB
Line 
1#ifndef _GRAMMAR_HH
2#define _GRAMMAR_HH
3
4#include <bitset>
5#include <vector>
6#include <list>
7#include <set>
8
9#include "const.hh"
10#include "thesymbols.hh"
11#include "sgraph.hh"
12
13
14using namespace std;
15
16class Link
17{
18  Role role;
19  FlagSet hflags;
20  FlagSet dflags;
21};
22
23
24class Grammar
25{
26
27 public:
28
29  //  enum CONSTR { SGL, OBL, LEFT, RIGHT, INIT, NONINIT, FIN, NONFIN };
30
31  Grammar() : types_sz(0), cats_sz(0), flags_sz(0) {} ;
32 
33  int types_sz;
34  int cats_sz;
35  int flags_sz;
36
37  vector< vector< Roles > >    connect;
38  RoleSet                      sgl;
39  vector< RoleSet >            obl;
40  RoleSet                      left;
41  RoleSet                      right;
42  vector< RoleSet >            lt;
43  vector< RoleSet >            gt;
44
45
46  //  vector< vector< vector<
47  vector< FlagSet >            set;
48  vector< FlagSet >            pass;
49
50  bool read(FILE* f);
51  void write(FILE* f);
52
53  void add_category(const char* s);
54  void add_type(const char* s);
55  void add_flag(const char* s);
56
57  void set_sgl(Role r)           { sgl.set(r); }
58  void set_obl(Cat c, Role r)    { obl[c].set(r); }
59  void set_left(Role r)          { left.set(r); }
60  void set_right(Role r)         { right.set(r); }
61  void set_order(Role r, Role s) { lt[s].set(r); }
62  void set_connect(Cat c, Cat d, Role r)   { connect[c][d].insert(r); }
63  void set_lt(Role r, Role s);
64  void compute_gt();
65
66
67  bool check_constr(NodeProp& hprop, NodeProp& dprop, int dir, Role role);
68
69};
70
71inline bool Grammar::check_constr(NodeProp& hprop, NodeProp& dprop, int dir, Role role)
72{
73  return 
74    !hprop.forbidden[role] &&
75    ( !right[role] || dir==1 ) &&
76    ( !left[role] || dir==0 )
77    ;
78}
79
80
81#endif
Note: See TracBrowser for help on using the repository browser.