Current design
       21-may-09
        SRL System 1.0.
Code extended by Hector Franco
       UML description
DepTree                                                 Name of class
+ vector<string> stanza;
+ vector<unsigned int> pred...
DepTreeNode
+vector<DepTreeNode *> dtrs; // this node's dependents
+ DepTreeNode *parent; // points to this node's 'head‘
...
Tree // it is a struct
Postorder_list *postorder_list;       NO changes in Tree Distance implementation.
int *keyroots
non...
Description:
  + void re_label(Corpus_type training_data);

• Generate sub_dep_trees in traing and testing.
• For each sub...
1                 2
                                                          4
                                    Time -...
5                                            6                                   7
                               Time ->
...
8                                                   11                                   12
                            -
...
Current design
 first design
   SRL System
 UML description
DepTree                                       Name of class
+ vector<string> stanza;
+ vector<unsigned int> pred;         ...
Current design




DepTreeNode
+vector<DepTreeNode *> dtrs; // this node's dependents
+ DepTreeNode *parent; // points to ...
Tree // it is a struct
Postorder_list *postorder_list;       Current design
int *keyroots
none                            ...
New design

  proposal
DepTree
- vector<string> stanza;
- vector<unsigned int> pred;                                          new design
- vector...
new design




DepTreeNode
- vector<DepTreeNode *> dtrs; // this node's dependents
- DepTreeNode *parent; // points to thi...
new design




Corpus_type


- vector<DepTree *> data_set
+ Corpus_type (string file);
+ boolean write(string file);
+ voi...
Description:
  + void re_label(Corpus_type training_data);

• Generate sub_dep_trees in traing and testing.
• For each sub...
new design

Info_data //struct type.
unsigned int index; // which node is it
string form;
string lemma;
string pos;
string...
new design




Symbol_table_type
- vector<Info_data *> data; // this node's dependents
+ Symbol_table_type()
+ int encode(...
1                 2
                                                          4
                                    Time -...
5                                            6                                 7
                               Time ->
 s...
8                                                              11                                   12
                   ...
Design II
 11/5
 proposal
DepTree
+ vector<string> stanza;
+ vector<unsigned int> pred;                                       Design II
+ vector<vec...
Design II




DepTreeNode
+vector<DepTreeNode *> dtrs; // this node's dependents
+ DepTreeNode *parent; // points to this ...
Design II




Corpus_type


- vector<DepTree *> data_set
+ Corpus_type (string file);
+ boolean write(string file);
+ void...
Description:
  + void re_label(Corpus_type training_data);

• Generate sub_dep_trees in traing and testing.
• For each sub...
1                 2
                                                          4
                                    Time -...
5                                            6                                 7
                               Time ->
 s...
8                                                   11                                   12
                            -
...
Description:
     + getMap(Corpus_type training_data);

• New functions:
• On depTree:
+ getMap_tdep_tdis(AlignRecord &)
/...
Upcoming SlideShare
Loading in …5
×

Class Diagram Uml

3,254 views
3,091 views

Published on

Published in: Education, Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,254
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
38
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Class Diagram Uml

  1. 1. Current design 21-may-09 SRL System 1.0. Code extended by Hector Franco UML description
  2. 2. DepTree Name of class + vector<string> stanza; + vector<unsigned int> pred; atributes + vector<vector<pair<unsigned int, string> > > apreds; + vector<DepTreeNode *> all_nodes; + vector<unsigned int> pos_order_vector + DepTree(void); + DepTree(vector<string> input); methods + bool build_tree(void); + void export_tree(ofstream &f); + bool is_pred(unsigned int index); + bool get_sem_dep(unsigned int dep_index, unsigned int head_index, string &rel); + bool set_sem_dep(unsigned int dep_index, unsigned int head_index, string &rel); + bool get_syn_dep(unsigned int dep_index, unsigned int head_index, string &rel); + DepTreeNode *get_lub(DepTreeNode *dt1, DepTreeNode *dt2, vector<DepTreeNode *>& lpath, vector<DepTreeNode *>& rpath); + bool make_subset_for_pred(unsigned int p_index, vector<DepTreeNode *>& nodes); + bool make_fresh_tree_for_pred(unsigned int p_index, DepTree& sub_tree); + bool export_a_sub_tree(unsigned int p_index, ofstream& sub_tree_f); + bool set_post_order_index() + boid set_pointers() + unsigned int post_order_2_dep_order(unsigned int val); + unsigned int sub_tree_order_2_sentence_order(unsigned int val); // debug: + void dot_show(void); + void dot_show(ofstream &f); + void show_stanza(void); + void show_words(void); + test1();
  3. 3. DepTreeNode +vector<DepTreeNode *> dtrs; // this node's dependents + DepTreeNode *parent; // points to this node's 'head‘ + unsigned int index; // which node is it + unsigned int post_order_index; + DepTreeNode * me; + string form; + string lemma; + string pos; + string dep_rel; // what rel. between head and this node + string pred; + DepTree *cntr; // container via this can back up to whole tree if necessary + DepTreeNode(void); + set_post_order_index(unsigned int & counter, vector<unsigned int & post_order_vector>) + DepTreeNode(DepTree *dt, unsigned int i); + void show();
  4. 4. Tree // it is a struct Postorder_list *postorder_list; NO changes in Tree Distance implementation. int *keyroots none Postorder_list // it is a struct Int type; Enum wildtype wild Float weight Int father Int sons Int leftmostleaf none AlignRecord // it is a struct alignOutcome// it is a struct Start_of_match N // node index End_of_match Enum matchtype match_type Align_src_trg; none Align_trg_src none
  5. 5. Description: + void re_label(Corpus_type training_data); • Generate sub_dep_trees in traing and testing. • For each sub_dep_tree: Get a ordered list of the most near sub dependences trees on training data with out alignment, and generat the alignment only if is need it. For each semantic relation take the K first and select the most frequent label (or other KNN voting method). Using the pointer on info copy back the selected semantic relation and update stanza.
  6. 6. 1 2 4 Time -> 3 sub Tree predicate Deep sub Tree Tree sentence Deep predicate Hard disk: Tree sub Corpus 1 Training data sentence Tree predicate Testing data Deep sub Corpus 2 Tree Tree 1 training and Deep sentence predicate testing data Tree are at the file sentence system 2 data is read it, and 3 each corpus 4 each created a contains sentence is corpus. sentences in a discomposed dependency in sub- tree structure trees, one for each
  7. 7. 5 6 7 Time -> sub t1 Tree q1 predicate t2 sub Tree t3 predicate sub Tree predicate sub Tree q1 predicate 5-6 each sub-tree is translated 6-7 for each sub-tree from the training data, is into a tree structure, for tree- found the K nearest (knn), distance algorithm And save the possible alignments. If found just one of the most nears trees, who contain the wanted semantic relation beween the wanted 2 nodes.
  8. 8. 8 11 12 - Time -> 10 q1 sentence Corpus 2 Output file Deep Tree sentence 8-10 using maping nodes 10-11 for each relation it’s selected the dep-tree to tree-distance most voted label, and save the results in the sentences, 11-12, all corpus is write back into the file system in the same format with new the labels, ready for the scoring script.
  9. 9. Current design first design SRL System UML description
  10. 10. DepTree Name of class + vector<string> stanza; + vector<unsigned int> pred; atributes + vector<vector<pair<unsigned int, string> > > apreds; Current design + vector<DepTreeNode *> all_nodes; + DepTree(void); methods + DepTree(vector<string> input); + bool build_tree(void); + void export_tree(ifstream &f); // not yet implemented + bool is_pred(unsigned int index); + bool get_sem_dep(unsigned int dep_index, unsigned int head_index, string &rel); + bool get_syn_dep(unsigned int dep_index, unsigned int head_index, string &rel); + DepTreeNode *get_lub(DepTreeNode *dt1, DepTreeNode *dt2, vector<DepTreeNode *>& lpath, vector<DepTreeNode *>& rpath); + bool make_subset_for_pred(unsigned int p_index, vector<DepTreeNode *>& nodes); + bool make_fresh_tree_for_pred(unsigned int p_index, DepTree& sub_tree); + bool export_a_sub_tree(unsigned int p_index, ofstream& sub_tree_f); // debug: + void dot_show(void); + void dot_show(ofstream &f); + void show_stanza(void); + void show_words(void);
  11. 11. Current design DepTreeNode +vector<DepTreeNode *> dtrs; // this node's dependents + DepTreeNode *parent; // points to this node's 'head‘ + unsigned int index; // which node is it + string form; + string lemma; + string pos; + string dep_rel; // what rel. between head and this node + string pred; + DepTree *cntr; // container via this can back up to whole tree if necessary + DepTreeNode(void); + DepTreeNode(DepTree *dt, unsigned int i); + void show();
  12. 12. Tree // it is a struct Postorder_list *postorder_list; Current design int *keyroots none No objects in tree distance implementation Postorder_list // it is a struct Int type; Enum wildtype wild Float weight Int father Int sons Int leftmostleaf none AlignRecord // it is a struct alignOutcome// it is a struct Start_of_match N // node index End_of_match Enum matchtype match_type Align_src_trg; none Align_trg_src none
  13. 13. New design proposal
  14. 14. DepTree - vector<string> stanza; - vector<unsigned int> pred; new design - vector<vector<pair<unsigned int, string> > > apreds; -vector<DepTreeNode *> all_nodes; + DepTree(vector<string> input); + bool export_a_sub_tree(unsigned int p_index, ofstream& sub_tree_f); + void export_tree(ifstream &f); // not yet implemented +bool get_subset_for_preds( * vector<DepTree>) -DepTree(void); - bool build_tree(void); -bool is_pred(unsigned int index); -DepTreeNode *get_lub(DepTreeNode *dt1, DepTreeNode *dt2, vector<DepTreeNode *>& lpath, vector<DepTreeNode *>& rpath); - bool make_subset_for_pred(unsigned int p_index, vector<DepTreeNode *>& nodes); - bool make_fresh_tree_for_pred(unsigned int p_index, DepTree& sub_tree); // debug: + bool get_sem_dep(unsigned int dep_index, unsigned int head_index, string &rel); + bool get_syn_dep(unsigned int dep_index, unsigned int head_index, string &rel); + void dot_show(void); + void dot_show(ofstream &f); + void show_stanza(void); + void show_words(void);
  15. 15. new design DepTreeNode - vector<DepTreeNode *> dtrs; // this node's dependents - DepTreeNode *parent; // points to this node's 'head‘ - int Info; // it works as a pointer in the symbol table. - DepTree *cntr; // container via this can back up to whole tree if necessary + DepTreeNode(string); + void update_string(string); - DepTreeNode(void); - DepTreeNode(DepTree *dt, unsigned int i); //Debug: + void show();
  16. 16. new design Corpus_type - vector<DepTree *> data_set + Corpus_type (string file); + boolean write(string file); + void re_label(Corpus_type training_data); - get_label(DepTree s, DepTree t, node1, node2)
  17. 17. Description: + void re_label(Corpus_type training_data); • Generate sub_dep_trees in traing and testing. • For each sub_dep_tree: Get a ordered list of the most near sub dependences trees on training data with alignment, For each semantic relation take the K first and select the most frequent label (or other KNN voting method). Using the pointer on info copy back the selected semantic relation and update stanza.
  18. 18. new design Info_data //struct type. unsigned int index; // which node is it string form; string lemma; string pos; string dep_rel; // what rel. between head and this node string pred; string * p_cad // to update the string that generates it-selve. DepTreeNode * p_depTreeNode; // back to the none
  19. 19. new design Symbol_table_type - vector<Info_data *> data; // this node's dependents + Symbol_table_type() + int encode(Info_data* d) + Info_data * decode(int code); + double distance(int codeA, int codB);
  20. 20. 1 2 4 Time -> 3 sub Tree predicate Deep sub Tree Tree sentence Deep predicate Hard disk: Tree sub Corpus 1 Training data sentence Tree predicate Testing data Deep sub Corpus 2 Tree Tree 1 training and Deep sentence predicate testing data Tree are at the file sentence system 2 data is read it, and 3 each corpus 4 each created a contains sentence is corpus. sentences in a discomposed dependency in sub-trees, tree structure one for each predicate
  21. 21. 5 6 7 Time -> sub t1 Tree q1 predicate t2 sub Tree t3 predicate sub Tree predicate sub Tree q1 predicate 5-6 each sub-tree is translated 6-7 for each sub-tree from the into a tree structure, for tree- training data, is found the K distance algorithm nearest (knn), And save the possible alignments.
  22. 22. 8 11 12 9 Time -> 10 q1 sentence Corpus 2 Info node Output file Deep Tree sentence 8-10 each node can access to this 10-11 for each relation it’s selected the information on the symbol table, and from most voted label, and save the results in that information, access to the original the sentences, tree, node to node. 11-12, all corpus is write back into the file system in the same format with new the labels, ready for the scoring script.
  23. 23. Design II 11/5 proposal
  24. 24. DepTree + vector<string> stanza; + vector<unsigned int> pred; Design II + vector<vector<pair<unsigned int, string> > > apreds; + vector<DepTreeNode *> all_nodes; + DepTree(void); + DepTree(vector<string> input); + bool build_tree(void); + void export_tree(ifstream &f); // TO IMPLEMENT + bool is_pred(unsigned int index); + bool get_sem_dep(unsigned int dep_index, unsigned int head_index, string &rel); + bool get_syn_dep(unsigned int dep_index, unsigned int head_index, string &rel); + DepTreeNode *get_lub(DepTreeNode *dt1, DepTreeNode *dt2, vector<DepTreeNode *>& lpath, vector<DepTreeNode *>& rpath); + bool make_subset_for_pred(unsigned int p_index, vector<DepTreeNode *>& nodes); + bool make_fresh_tree_for_pred(unsigned int p_index, DepTree& sub_tree); + bool export_a_sub_tree(unsigned int p_index, ofstream& sub_tree_f); + getMap_tdep_tdis(AlignRecord &) // debug: + void dot_show(void); + void dot_show(ofstream &f); + void show_stanza(void); + void show_words(void);
  25. 25. Design II DepTreeNode +vector<DepTreeNode *> dtrs; // this node's dependents + DepTreeNode *parent; // points to this node's 'head‘ + unsigned int index; // which node is it + string form; + string lemma; + string pos; + string dep_rel; // what rel. between head and this node + string pred; + DepTree *cntr; // container via this can back up to whole tree if necessary + DepTreeNode(void); + DepTreeNode(DepTree *dt, unsigned int i); + void show();
  26. 26. Design II Corpus_type - vector<DepTree *> data_set + Corpus_type (string file); + boolean write(string file); + void re_label(Corpus_type training_data); - get_label(DepTree s, DepTree t, node1, node2)
  27. 27. Description: + void re_label(Corpus_type training_data); • Generate sub_dep_trees in traing and testing. • For each sub_dep_tree: Get a ordered list of the most near sub dependences trees on training data with out alignment, and generat the alignment only if is need it. For each semantic relation take the K first and select the most frequent label (or other KNN voting method). Using the pointer on info copy back the selected semantic relation and update stanza.
  28. 28. 1 2 4 Time -> 3 sub Tree predicate Deep sub Tree Tree sentence Deep predicate Hard disk: Tree sub Corpus 1 Training data sentence Tree predicate Testing data Deep sub Corpus 2 Tree Tree 1 training and Deep sentence predicate testing data Tree are at the file sentence system 2 data is read it, and 3 each corpus 4 each created a contains sentence is corpus. sentences in a discomposed dependency in sub- tree structure trees, one for each
  29. 29. 5 6 7 Time -> sub t1 Tree q1 predicate t2 sub Tree t3 predicate sub Tree predicate sub Tree q1 predicate 5-6 each sub-tree is translated 6-7 for each sub-tree from the into a tree structure, for tree- training data, is found the K distance algorithm nearest (knn), And save the possible alignments.
  30. 30. 8 11 12 - Time -> 10 q1 sentence Corpus 2 Output file Deep Tree sentence 8-10 using maping nodes 10-11 for each relation it’s selected the dep-tree to tree-distance most voted label, and save the results in the sentences, 11-12, all corpus is write back into the file system in the same format with new the labels, ready for the scoring script.
  31. 31. Description: + getMap(Corpus_type training_data); • New functions: • On depTree: + getMap_tdep_tdis(AlignRecord &) // gives a post order alignment. Corpus_type + void re_label(Corpus_type training_data);

×