Ejemplo n.º 1
0
void TWebPgFetchEvent::AddCookieKeyValDmPathQuV(const TStrQuV& KeyValDmPathQuV){
  for (int KeyN=0; KeyN<KeyValDmPathQuV.Len(); KeyN++){
    TStr KeyNm=KeyValDmPathQuV[KeyN].Val1;
    TStr ValStr=KeyValDmPathQuV[KeyN].Val2;
    TStr DmNm=KeyValDmPathQuV[KeyN].Val3;
    TStr PathStr=KeyValDmPathQuV[KeyN].Val4;
    bool IsUpdated=false;
    for (int CookieN=0; CookieN<CookieKeyValDmPathQuV.Len(); CookieN++){
      TStr CookieKeyNm=CookieKeyValDmPathQuV[CookieN].Val1;
      TStr CookieDmNm=CookieKeyValDmPathQuV[CookieN].Val3;
      if ((KeyNm==CookieKeyNm)&&(DmNm==CookieDmNm)){
        CookieKeyValDmPathQuV[CookieN].Val2=ValStr;
        IsUpdated=true; break;
      }
    }
    if (!IsUpdated){
      CookieKeyValDmPathQuV.Add(TStrQu(KeyNm, ValStr, DmNm, PathStr));
    }
  }
}
Ejemplo n.º 2
0
PNmObjBs TNmObjBs::GetFromStrQuV(
 const TStrQuV& IdTitleSrcHtmlQuV,
 const TSwSetType& SwSetType, const TStr& CustSwSetFNm,
 const TStr& NrWordBsFNm, const TStr& WordTypeBsFNm, const TStr& MteFNm,
 const int& MxDocs, const bool& DumpP){
  // custom-stop-words
  PSIn CustSwSetSIn;
  if (!CustSwSetFNm.Empty()&&(TFile::Exists(CustSwSetFNm))){
    CustSwSetSIn=TFIn::New(CustSwSetFNm);}
  // normalized-words
  PSIn NrWordBsSIn;
  if (!NrWordBsFNm.Empty()&&(TFile::Exists(NrWordBsFNm))){
    NrWordBsSIn=TFIn::New(NrWordBsFNm);}
  // word-types
  PSIn WordTypeBsSIn;
  if (!WordTypeBsFNm.Empty()&&(TFile::Exists(WordTypeBsFNm))){
    WordTypeBsSIn=TFIn::New(WordTypeBsFNm);}
  // create named-objects-base
  PNmObjBs NmObjBs=
   TNmObjBs::New(SwSetType, CustSwSetSIn, NrWordBsSIn, WordTypeBsSIn, MteFNm);
  // traverse compact-documents
  for (int DocN=0; DocN<IdTitleSrcHtmlQuV.Len(); DocN++){
    if ((MxDocs!=-1)&&(DocN>MxDocs)){break;}
    TStr DocNm=IdTitleSrcHtmlQuV[DocN].Val1;
    TStr TitleStr=IdTitleSrcHtmlQuV[DocN].Val2;
    TStr HtmlStr=IdTitleSrcHtmlQuV[DocN].Val4;
    //if (!DocNm.IsStrIn("1998-06-18-z1b9.")){continue;}
    if (DumpP){
      printf("===============================================\n");
      printf("%s\n", DocNm.CStr());
    }
    // extract candidate named-objects
    TStrV CandWordStrV; NmObjBs->ExtrCandWordStrV(HtmlStr, CandWordStrV, DumpP);
    // extract final named-objects from candidates
    TIntV NmObjIdV; NmObjBs->FilterCandToNmObjIdV(CandWordStrV, NmObjIdV, DumpP);
    // create document and add named-objects
    NmObjBs->AddDoc(DocNm, "", NmObjIdV);
  }
  // get merged named-objects
  TIntV NewNmObjIdV; NmObjBs->GetMergedNmObj(NewNmObjIdV);
  // apply merged named-objects
  NmObjBs->PutMergedNmObj(NewNmObjIdV);
  // return named-objects-base
  return NmObjBs;
}
Ejemplo n.º 3
0
 int GetCookies() const {return CookieKeyValDmPathQuV.Len();}