Class Diagram Uml
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
3,651
On Slideshare
3,628
From Embeds
23
Number of Embeds
4

Actions

Shares
Downloads
36
Comments
0
Likes
0

Embeds 23

http://www.slideshare.net 18
http://hectoracademic.blogspot.com 3
http://translate.googleusercontent.com 1
http://hectoracademic.blogspot.com.au 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Current design 21-may-09 SRL System 1.0. Code extended by Hector Franco UML description
  • 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. 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. 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. 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. 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. 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 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. Current design first design SRL System UML description
  • 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. 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. 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. New design proposal
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. Design II 11/5 proposal
  • 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. 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. 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. 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. 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. 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. 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. 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);