本文整理汇总了C++中GMap::getHKey方法的典型用法代码示例。如果您正苦于以下问题:C++ GMap::getHKey方法的具体用法?C++ GMap::getHKey怎么用?C++ GMap::getHKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMap
的用法示例。
在下文中一共展示了GMap::getHKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lineTextTranslation
//.........这里部分代码省略.........
str=str_replace("མ་མོ་།","མ་(¶)་",str);
str=str_replace("ར་རོ་།","ར་(¶)་",str);
str=str_replace("ལ་ལོ་།","ལ་(¶)་",str);
str=str_replace("ས་སོ་།","ས་(¶)་",str);
str=str_replace("་ཏོ་།","་(¶)་",str);
//str=str_replace("་པའང་","་པ་[འང=уступ.]་",str);
//str=str_replace("་བའང་","་བ་[འང=уступ.]་",str);
vector<string>l=explode("་",str);
res="";
resD="";
lng=(int)l.size();
start=0;
end=lng-1;
i=lng;
while(start<lng){
//make query string decrease end
end=lng;
while(end>-1){
j=start;
line="";
//increase start
while (j < end){
line+=l[j]+"་";
j++;
}
//count+=1
//cout<<line<<" "<<start<<" "<<end<<endl;
//if (count >120):
//return
index=d->getHKey(line,0);
if(index!=-1){
TString st;
dk->getTStr(index, &st);
c="="+st[1];
res+="["+linkDict(line,&id)+linkEdit(c,&id)+"]་";
if(c.find("__")!=-1){
end-=1;
res+="<br>\n";
continue;
}
if(mode==FULL_REPORT && start==0 && end==lng-1){
end-=1;
continue;
}
start=end-1;
break;
}
//next check big dictionary report
index=dictKey->getHKey(line,0);
if(line.size()>3 && index!=-1){
resD+="["+linkDict(line,&id)+linkEdit("=",&id)+"] ";
}
ln=line+"@";
l1=str_replace("འི་@","་",ln);
index=d->getHKey(l1,0);
if(index!=-1){
TString st;
dk->getTStr(index, &st);
c="="+st[1];
res+="["+linkDict(l1,&id)+linkEdit(c,&id)+"]་["+linkDict("-འི་",&id)+linkEdit("=g.p",&id)+"]་";
start=end-1;
示例2: saveToTranslationDictionary
void GLogicProcessor::saveToTranslationDictionary(string &srcStr){
vector<string>text=explode("[",srcStr);
int index;
string key,value;
GMemory *longMemory=(GMemory*)inputData.longMemory;
int translationMode=((GStr<int>*)inputData.pref)->get(22);
GVector *dv;
GMap *d;
if(translationMode==TRANSLATE_ENG){
dv=longMemory->translationDictEng;
d=longMemory->translationDictGMapEng;
}else{
dv=longMemory->translationDictRus;
d=longMemory->translationDictGMapRus;
}
//GMap *dictKey=longMemory->dictionaryGMap;
for(int i=0;i<text.size();i++){
string line=text[i];
string reStr="<[^>]*>";
std::regex key_regex(reStr);
line = std::regex_replace(line, key_regex, "");
reStr=".*=.*";
std::regex key_regex_(reStr);
line = std::regex_replace(line, key_regex_, "");
if(line.size()<3)continue;
index=(int)line.find("/");
if(index<3)continue;
index=(int)line.find("]");
if(index<3)continue;
line=substr(0, index, line);
line=str_replace("/_", "/", line);
vector<string>data=explode("/",line);
if(data.size()<2)continue;
key=data[0];
value=data[1];
key=key+"་";
key=str_replace(" ","",key);
key=str_replace("་་","་",key);
value=str_replace("__","#",value);
value=str_replace("[email protected]","@",value);
value=str_replace("#","__",value);
value+="@";
value=str_replace("@@","@",value);
value=str_replace("{","༼",value);
value=str_replace("«","༼",value);
value=str_replace("}","༽",value);
value=str_replace("»","༽",value);
value=str_replace("༼༼","༼",value);
value=str_replace("༽༽","༽",value);
if(value.size()<3)continue;
//cout<<"key="<<key<<" value="<<value<<endl;
index=d->getHKey(key,0);
//cout<<"index="<<index;
TString st;
if(value!="---"){
st+=key;
st+=value;
}else{
st+="";
st+="";
}
if(index>-1){
dv->putTStr(index, &st);
}else{
d->addRecord(&st);
}
}
}
示例3: writeDictReportLocal
void GLogicProcessor::writeDictReportLocal(string &srcStr){
int id=1;
//int print=1;
string str,dL,line;
vector<dictKey> keyArray;
ostringstream out;
GMemory *longMemory=(GMemory*)inputData.longMemory;
GMap *dict;
GVector *dt;
int translationMode=((GStr<int>*)inputData.pref)->get(22);
GVector *dk;
GMap *d;
if(translationMode==TRANSLATE_ENG){
str="translationDictEng";
}else{
str="translationDictRus";
}
longMemory->loadTable(str);
dk=longMemory->table[str].data;
indexRecord indexRec=longMemory->createIndex(longMemory->table[str], 0, HASH_SEARCH);
d=indexRec.mIndex;
str="mainDict";
longMemory->loadTable(str);
indexRec=longMemory->createIndex(longMemory->table[str], 0, HASH_SEARCH);
dt=longMemory->table[str].data;
GMap *dictKey=indexRec.mIndex;
vector<uint>searchResult;
//d->getKey(srcStr, searchResult,HASH_FIND);
searchResult.push_back(d->getHKey(srcStr,0));
for(int m=0;m<searchResult.size();m++) {
TString st;
dk->getTStr(searchResult[m], &st);
str="="+st[1];
out<<"["<<linkDict(st[0].c_str(),&id)<<linkEdit(str,&id)<<"]<hr>\n"<<endl;
}
searchResult.resize(0);
//d->getKey(srcStr, searchResult,HASH_FIND);
searchResult.push_back(d->getHKey(srcStr,0));
for(int m=0;m<searchResult.size();m++) {
TString st;
dk->getTStr(searchResult[m], &st);
str="="+st[1];
str=str_replace(":|:YP", "", str);
out<<"["<<linkDict(st[0].c_str(),&id)<<linkEdit(str,&id)<<"]<hr>\n"<<endl;
}
searchResult.resize(0);
inputData.start=1;
dict->getHKey(searchResult,srcStr,0);
//dict->getKey(srcStr, searchResult,HASH_FIND);
//cout<<"searchResult="<<searchResult.size()<<endl;
vector<string>report;
report.resize(25);
for(int m=0;m<searchResult.size();m++) {
TString st;
dt->getTStr(searchResult[m], &st);
str=st[2];
line=st[1];
if(str.find("[MG]")!=-1){
report[0]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[HP]")!=-1){
report[1]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[TD]")!=-1){
report[2]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[MV]")!=-1){
report[3]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[VD]")!=-1){
report[4]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[EP]")!=-1){
report[5]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[RE]")!=-1){
report[6]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[SD]")!=-1){
report[7]=line+"<br>\n"+st[2];
continue;
}
if(str.find("[IW]")!=-1){
report[8]=line+"<br>\n"+st[2];
continue;
}
//.........这里部分代码省略.........