Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Application::Table::DoImportSimilarityTableSet (  ) 

Definition at line 980 of file mainTable.cpp.

References Impala::atof(), Impala::atol(), Impala::Util::DatabaseReadString(), Impala::FileNameTail(), Impala::CmdOptions::GetArg(), Impala::Util::Database::GetInstance(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetNrArg(), ILOG_ERROR, ILOG_INFO, and ILOG_VAR.

Referenced by mainTable().

00981 {
00982     typedef Core::Table::SimilarityTableSet SimilarityTableSet;
00983     typedef Core::Table::SimilarityTableSet::SimTableType SimTableType;
00984 
00985     ILOG_VAR(Impala.Application.Table.DoImportSimilarityTableSet);
00986     ILOG_ERROR("Will fail because doesn't have Quids (yet)");
00987     CmdOptions& options = CmdOptions::GetInstance();
00988     if (options.GetNrArg() < 5)
00989     {
00990         ILOG_ERROR("Need more arguments");
00991         return;
00992     }
00993     String outDir = options.GetArg(1);
00994     String conceptFile = options.GetArg(2);
00995     String inDir = options.GetArg(3);
00996     int nrIds = atol(options.GetArg(4));
00997     String fileExt("");
00998     if (options.GetNrArg() > 5)
00999         fileExt = options.GetArg(5);
01000     Util::Database* db = &Util::Database::GetInstance();
01001 
01002     std::vector<String> concepts;
01003     Util::DatabaseReadString(std::back_inserter(concepts), conceptFile, db, true);
01004     ILOG_INFO("nrConcepts = " << concepts.size());
01005     SimilarityTableSet simSet(concepts, nrIds);
01006     String outPath = outDir + "/" + FileNameTail(conceptFile) + "/";
01007     simSet.SaveNames(outPath, db);
01008     for (int c=0 ; c<concepts.size() ; c++)
01009     {
01010         String fName = inDir + "/" + concepts[c] + fileExt;
01011         ILOG_INFO("importing " << concepts[c] << " from " << fName);
01012         std::vector<String> lines;
01013         Util::DatabaseReadString(std::back_inserter(lines), fName, db, true);
01014         if (lines.size() != nrIds)
01015         {
01016             ILOG_ERROR("wrong number of lines : " << lines.size() <<
01017                        " instead of " << nrIds);
01018             continue;
01019         }
01020         SimTableType* simTable = simSet.GetSimTable(c);
01021         simTable->SetSize(0);
01022         for (int i=0 ; i<lines.size() ; i++)
01023             simTable->Add(atof(lines[i]));
01024         simSet.ComputeRank(c, true);
01025         simSet.Save(c, outPath, db, true);
01026     }
01027 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:51:07 2010 for ImpalaSrc by  doxygen 1.5.1