-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSynTreeSQ.h
More file actions
executable file
·72 lines (59 loc) · 2.14 KB
/
SynTreeSQ.h
File metadata and controls
executable file
·72 lines (59 loc) · 2.14 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef SYNTREESQ_H_INCLUDED
#define SYNTREESQ_H_INCLUDED
#include "Common.h"
using namespace std;
namespace RelationTree{
struct TreeNode
{
string value; //篇章关系,不是真正的value
TreeNode *parent;
int id;
int level;
int LeftOrRight; //0:left, 1:right -1:s
int Begin;
int Back;
TreeNode *BinSib;
vector<TreeNode*> children;
TreeNode(const string&m_v, TreeNode* m_parent):value(m_v),parent(m_parent),id(0),LeftOrRight(-1),level(0){};
};
int LeftBranket(const string& s, string & str_flw_lb);
}
struct EvaluateStruct
{
map<string, pair<int,int> > relCountMap; //relation:count
map<int,int> eximCountMap; //explicit/implicit:count
};
class SynTreeSQ
{
public:
RelationTree::TreeNode root;
SynTreeSQ():root("",NULL){};
int ParseTree(const string& s, int mode=-1);
int ParseTree_1(const string& s, int mode=-1);
int ClearTree();
void PrintTree(RelationTree::TreeNode *node);
void PrintTreeOri(RelationTree::TreeNode *node);
RelationTree::TreeNode* GetNodeWithId(int id);
void GetStrVec(int begin, int back,vector<string>&result);
int GetSize(){return nodeIdMap.size();}
string GetSpanWithNode(RelationTree::TreeNode*);
void PrintRelTree(RelationTree::TreeNode *node,int mode);
void PrintRelTree_1(RelationTree::TreeNode *node,int mode);
void PrintSegTree(RelationTree::TreeNode *node,int mode);
float EvaluationForStr(set<string> &canSet,set<string>&refSet);
float EvaluationForStr(set<string> &canSet,set<string>&refSet,EvaluateStruct &evs);
void Convert2Tuple(RelationTree::TreeNode* node,set<string>&tuple);
void Convert2TupleComplete(RelationTree::TreeNode* node,set<string>&tuple);
void Convert2TupleNonBin(RelationTree::TreeNode* node,set<string>&tuple);
void Convert2TupleCompleteNonBin(RelationTree::TreeNode* node,set<string>&tuple);
void Binarization(RelationTree::TreeNode *);
void Bin2NonBin(RelationTree::TreeNode *node);
void test();
public:
std::vector<std::string> sentenceVec;
RelationTree::TreeNode* CompleRoot;
map<int, RelationTree::TreeNode*> nodeIdMap;
private:
};
void InitKeySet();
#endif // SYNTREESQ_H_INCLUDED