// // MODULE: cdlearn.pp // // DESCRIPTION: this module contains the propagation patterns which // involve cd-cd and obj-cd at the same time; this includes // patterns from the root vertex CDL_Algorithm and patterns // to common vertices. // // PPs: // Run // RemoveDuplicates // PrintOutput // GetIdentifier // GetLabelIdent // // History: // Cristina Lopes, Dec. 92 - created. // // // Run (*in* Obj_graph *objgraph, *in* Demeter_in *dem_in) // // WHAT: entry point to cd-learn; learn from objgraph+dem_in and // build a Cd_graph. // INDEP: 1 // *interface* void Run (Obj_graph *objgraph, Demeter_in *dem_in) *from* CDL_Algorithm *to* Cd_graph *bypassing* -> *, cd_in, * *primary* Cd_graph (@ if (dem_in) this->InitLearn ((Cd_graph *)dem_in->get_input()); if (!objgraph->get_adjacencies()) return; Object_list_iterator next_arg(* ((Object_Comma_list*)objgraph->get_adjacencies())); Object *obj; // Make cdg learn with each new object; // The working cdg is this one. if (objgraph->get_adjacencies()) while (obj = next_arg()) this->Learn(obj); @) // // RemoveDuplicates() // // WHAT : remove duplicate adjacency names (if any) at the end. // INDEP: 1 // *interface* void RemoveDuplicates () *from* CDL_Algorithm *through* -> *, cd_out, * *to* Cd_graph *primary* Cd_graph (@ Adjacency_Nlist* n_list = new Adjacency_Nlist(); adjacencies->RemoveDuplicates (n_list); this->rset_adjacencies (n_list); @) // // PrintOutput() // // INDEP: 1 // WHAT : print the learned class dictionary graph. // *interface* void PrintOutput () *from* CDL_Algorithm *to* Cd_graph *through* -> *, cd_out, * *primary* Cd_graph (@ this->g_print(); @) // // GetIdentifier (*out* Ident *&name) // // WHAT : get the identifiers of several objects; identified objects // are // *at obj-cd: // - Object objects // - Object parts of Labeled_part objects // - Label objects // *at cd-cd: // - Adjacency objects // - Opt_labeled_term objects // INDEP: 14/17 // unecessary elements: // Object in *bypassing* -> Object, description, * // Labeled_part in *bypassing* -> Labeled_part, label, * // Adjacency in *through* -> Adjacency, source, * // // *interface* void GetIdentifier (Ident *&name) *from* Object Labeled_part *to* Ident *bypassing* -> Object, description, * *bypassing* -> Labeled_part, label, * *from* Label *to* Ident *from* Adjacency *to* Ident *through* -> Adjacency, source, * *from* Opt_labeled_term Term_Sandwich *to* Ident //*through* -> *, vertex, * *bypassing* => Opt_labeled_term, * //*bypassing* -> *, repeated, * *bypassing* -> *, firstset, * *primary* Ident (@ name = this; @) // // GetLabelIdent (*out* Ident *&name) // // // WHAT : get the identifiers of several Labels; identified labels are // *at obj-cd: // - Label parts of Labeled_part objects // *at cd-cd: // - Labeled objects // INDEP: 5/6 // unecessary elements: // Labeled_part in *bypassing* -> Labeled_part, obj, * // *interface* void GetLabelIdent (Ident *&name) *from* Any_vertex *to* Labeled *from* Labeled_part *to* Label *bypassing* -> Labeled_part, obj, * *primary* Labeled (@ name = this->get_label_name(); @) *primary* Label (@ this->GetIdentifier (name); @)