← Documentation
ADS-IDAC Engine 5.0.0
ConceptComposedUnit.cpp
Go to the documentation of this file.
1// ConceptComposedUnit.cpp: implementation of the ConceptComposedUnit class.
2//
4
6using namespace std;
7
9// Construction/Destruction
11
13{
14 this->m_ID_Type = 002;
15 this->m_Indefinite_Concept_ID_pt = NULL;
16 this->m_label_ID_pt = NULL;
17 this->m_CoreID_pt = NULL;
18 //002--ConceptComposedUnit
19}
20
22{
23/* delete this->m_CoreID_pt;
24 delete this->m_label_ID_pt;
25 delete this->m_Indefinite_Concept_ID_pt;
26*/
27 this->m_Spec_array.clear();
28 this->m_antonym_list.clear();
29 this->m_ID_antonym_list.clear();
30 this->m_ID_spec_list.clear();
31}
32
34{
35
36
37}
38
40{
41 bool Contain = false;
42// ConceptBasicUnit * B_pt;
44 vector<IDElement *>::iterator ID_itr;
45
46 if(m_CoreID_pt == (IDElement*)_B_pt)
47 {
48 Contain = true;
49 return Contain;
50 }
51 for(ID_itr = this->m_Spec_array.begin(); ID_itr!= this->m_Spec_array.end() && Contain == false; ID_itr++)
52 {
53 if((*ID_itr)->m_ID_Type == 001)
54 {
55 if((*ID_itr) == (IDElement *)_B_pt)
56 {Contain = true;}
57 }
58 else if((*ID_itr)->m_ID_Type == 002)
59 {
60 C_pt = (ConceptComposedUnit *)(*ID_itr);
61 Contain = C_pt->CheckWetherContainThisBasicConcept(_B_pt);
62 }
63 }
64 return Contain;
65}
66
68{
69 bool Contain = false;
70 vector<IDElement *>::iterator ID_itr;
71 if (this->m_CoreID_pt == _ID_pt)
72 {
73 Contain = true;
74 return Contain;
75 }
76 for(ID_itr = this->m_Spec_array.begin(); ID_itr != this->m_Spec_array.end() && Contain == false; ID_itr++)
77 {
78 if((*ID_itr) == _ID_pt)
79 {
80 Contain = true;
81 }
82 }
83 return Contain;
84}
85
87{
88 vector<IDElement*>::iterator ID_itr;
89 ConceptComposedUnit * CC_pt;
90 bool include_bl = false;
91
92 switch (this->m_CoreID_pt->m_ID_Type )
93 {
94 case 001:
95 if(this->m_CoreID_pt == sub_ID_pt)
96 {
97 include_bl = true;
98 return include_bl;
99 }
100 break;
101 case 002:
102 CC_pt = (ConceptComposedUnit*)(this->m_CoreID_pt);
103 if(CC_pt->CheckWhetherThisConceptContainASubConceptByPt(sub_ID_pt) == true)
104 {
105 include_bl = true;
106 return include_bl;
107 }
108 break;
109 default:
110 break;
111 }
112 for(ID_itr = this->m_Spec_array.begin(); ID_itr != this->m_Spec_array.end(); ID_itr++)
113 {
114 switch ((*ID_itr)->m_ID_Type)
115 {
116 case 001:
117 if((*ID_itr) == sub_ID_pt)
118 {
119 include_bl = true;
120 return include_bl;
121 }
122 break;
123 case 002:
124 CC_pt = (ConceptComposedUnit*)(*ID_itr);
125 if(CC_pt->CheckWhetherThisConceptContainASubConceptByPt(sub_ID_pt) == true)
126 {
127 include_bl = true;
128 return include_bl;
129 }
130 break;
131 }
132 }
133 return include_bl;
134}
135
136//DEL void ConceptComposedUnit::Empty()
137//DEL {
138//DEL
139//DEL }
140
142{//this function only copies the basic information. The linkage among concept units is not established here
143 vector<IDElement *>::iterator ID_itr;
144 vector<string >::iterator str_itr;
145 string ID;
146 this->m_activation = _CC_pt->m_activation;
148 this->m_change_ratio = _CC_pt->m_change_ratio;
149 this->m_ID = _CC_pt->m_ID;
150 this->m_ID_Type = _CC_pt->m_ID_Type;
151 // linkage: core concept, specification concept, antonym ID, indefinite_ID, label_ID
152 this->m_ID_core = _CC_pt->m_ID_core; // core concept
153
154 if(_CC_pt->m_antonym_list.size() > 0)
155 {
156 for(ID_itr = _CC_pt->m_antonym_list.begin(); ID_itr != _CC_pt->m_antonym_list.end(); ID_itr++)
157 {
158 ID = (*ID_itr)->m_ID;
159 this->m_ID_antonym_list.push_back(ID);
160 }
161 }
162 else
163 {
164 for(str_itr = _CC_pt->m_ID_antonym_list.begin(); str_itr != _CC_pt->m_ID_antonym_list.end(); str_itr++)
165 {//antonym list
166 ID = *str_itr;
167 this->m_ID_antonym_list.push_back(ID);
168 }
169 }
170 for(str_itr = _CC_pt->m_ID_spec_list.begin(); str_itr != _CC_pt->m_ID_spec_list.end(); str_itr++)
171 {//specification concept
172 ID = *str_itr;
173 this->m_ID_spec_list.push_back(ID);
174 }
175
176 //indefinite concept
177 this->m_ID_indefinite = _CC_pt->m_ID_indefinite;
178
179 //label
180 this->m_ID_lable = _CC_pt->m_ID_lable;
181}
182
184{
185 vector<IDElement *>::iterator ID_itr;
186 string ID;
187 //Core ID
188 this->m_ID_core = this->m_CoreID_pt->m_ID;
189 //
190 if(this->m_Indefinite_Concept_ID_pt != NULL)
191 {
193 }
194 else
195 {
196 this->m_ID_indefinite = "";
197 }
198 //
199 if(this->m_label_ID_pt != NULL)
200 {
201 this->m_ID_lable = this->m_label_ID_pt->m_ID;
202 }
203 else
204 {
205 this->m_ID_lable = "";
206 }
207 //defining concept
208 if(this->m_ID_spec_list.size() == 0)
209 {
210 for(ID_itr = this->m_Spec_array.begin(); ID_itr != this->m_Spec_array.end(); ID_itr++)
211 {
212 ID = (*ID_itr)->m_ID;
213 this->m_ID_spec_list.push_back(ID);
214 }
215 }
216 //antonym concept
217 if(this->m_ID_antonym_list.size() == 0)
218 {
219 for(ID_itr = this->m_antonym_list.begin(); ID_itr != this->m_antonym_list.end(); ID_itr++)
220 {
221 ID = (*ID_itr)->m_ID;
222 this->m_ID_antonym_list.push_back(ID);
223 }
224 }
225}
double m_change_ratio
Definition: Activation.h:19
double m_activation_baseline
Definition: Activation.h:20
double m_activation
Definition: Activation.h:22
IDElement * m_Indefinite_Concept_ID_pt
std::vector< IDElement * > m_Spec_array
bool CheckWetherContainThisBasicConcept(ConceptBasicUnit *)
bool CheckWhetherContainThisConceptDirectly(IDElement *)
std::vector< std::string > m_ID_antonym_list
void ReadConceptComposedUnitInfoFromFile(std::string, std::ifstream &)
std::vector< IDElement * > m_antonym_list
std::vector< std::string > m_ID_spec_list
bool CheckWhetherThisConceptContainASubConceptByPt(IDElement *)
void CopyInfoFromAnotherConceptComposedUnit(ConceptComposedUnit *_CC_pt)
int m_ID_Type
Definition: IDElement.h:15
std::string m_ID
Definition: IDElement.h:16