// CacheBasedLanguageModel::CacheBasedLanguageModel(const std::vector<std::string>& files, const size_t q_type, const size_t s_type): CacheBasedLanguageModel::CacheBasedLanguageModel(const std::vector<std::string>& files, const size_t q_type, const size_t s_type, const unsigned int age): StatelessFeatureFunction("CacheBasedLanguageModel",1){ SetQueryType(q_type); SetScoreType(s_type); SetMaxAge(age); SetPreComputedScores(); Load(files); }
void CacheBasedLanguageModel::Execute(std::string command) { if (command == "clear") { VERBOSE(1,"CacheBasedLanguageModel Execute command:|"<< command << "|. Cache cleared." << std::endl); Clear(); } else if (command == "settype_wholestring") { VERBOSE(1,"CacheBasedLanguageModel Execute command:|"<< command << "|." << std::endl); SetQueryType(CBLM_QUERY_TYPE_WHOLESTRING); } else if (command == "settype_allsubstrings") { VERBOSE(1,"CacheBasedLanguageModel Execute command:|"<< command << "|." << std::endl); SetQueryType(CBLM_QUERY_TYPE_ALLSUBSTRINGS); } else { VERBOSE(1,"CacheBasedLanguageModel Execute command:|"<< command << "| is unknown. Skipped." << std::endl); } }
int DecodeQuery(Message *message, BNode *dict) { assert(message != NULL && "NULL Message pointer"); assert(dict != NULL && "NULL BNode pointer"); assert(dict->type == BDictionary && "Not a dictionary"); SetQueryType(message, dict); SetQueryId(message, dict); int rc = SetTransactionId(message, dict); check(rc == 0, "SetTransactionId failed"); rc = SetQueryData(message, dict); check(rc == 0, "SetQueryData failed"); return 0; error: return -1; }
void COnlineSearch::OnSelchangeComboProfiles() { int sel = m_cboProfiles.GetCurSel(); if (sel == -1) return; CSearchProfile* profile = (CSearchProfile*)m_cboProfiles.GetItemDataPtr(sel); if (profile == NULL) return; m_editHost.SetWindowText(profile->m_Host); CString s; s.Format(_T("%d"), profile->m_Port); m_editPort.SetWindowText(s); m_editProxy.SetWindowText(profile->m_Proxy); m_editUser.SetWindowText(profile->m_User); m_editGroup.SetWindowText(profile->m_Group); m_editPass.SetWindowText(profile->m_Password); m_chkSavePass.SetCheck(profile->m_SavePass); m_editDatabase.SetWindowText(profile->m_Database); SetQueryType(profile->m_QueryType); }
BOOL COnlineSearch::OnInitDialog() { CDialog::OnInitDialog(); HICON icon = AfxGetApp()->LoadIcon(IDI_ICON_ONLINESEARCH); SetIcon(icon, FALSE); InitAnchors(ANIF_SIZEGRIP); // SHRT_MAX = 32767 also maximum number of ports m_spinPort.SetRange(1, SHRT_MAX); m_spinRecStart.SetRange(1, SHRT_MAX); m_spinRecEnd.SetRange(0, SHRT_MAX); SetQueryType(QT_PREFIX); DWORD extst = m_lstResults.GetExtendedStyle(); m_lstResults.SetExtendedStyle(extst | LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP); m_lstResults.InsertColumn(0, _T("Author/Editor"), LVCFMT_LEFT, AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("OnlineSearch.lv.col1"), 200)); m_lstResults.InsertColumn(1, _T("Title"), LVCFMT_LEFT, AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("OnlineSearch.lv.col2"), 300)); m_lstResults.InsertColumn(2, _T("Year"), LVCFMT_LEFT, AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("OnlineSearch.lv.col3"), 50)); m_editRecEnd.SetWindowText(_T("10")); m_editRecStart.SetWindowText(_T("1")); #ifdef _DEBUG // Set some default values m_editHost.SetWindowText(_T("z3950.loc.gov")); m_editPort.SetWindowText(_T("7090")); m_editDatabase.SetWindowText(_T("Voyager")); // The ISBN number, isn't it? m_editSearchFor.SetWindowText(_T("@attr 1=7 0253333490")); #endif // Add profiles UpdateProfileList(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben }
static DWORD ParseArguments( int argc, char** ppszArgv ) { DWORD dwError = 0; int i = 0; for (i = 1; i < argc; i++) { if (!strcmp(ppszArgv[i], "--user")) { gState.ObjectType = LSA_OBJECT_TYPE_USER; } else if (!strcmp(ppszArgv[i], "--group")) { gState.ObjectType = LSA_OBJECT_TYPE_GROUP; } else if (!strcmp(ppszArgv[i], "--by-dn")) { dwError = SetQueryType(LSA_QUERY_TYPE_BY_DN); BAIL_ON_LSA_ERROR(dwError); } else if (!strcmp(ppszArgv[i], "--by-sid")) { dwError = SetQueryType(LSA_QUERY_TYPE_BY_SID); BAIL_ON_LSA_ERROR(dwError); } else if (!strcmp(ppszArgv[i], "--by-nt4")) { dwError = SetQueryType(LSA_QUERY_TYPE_BY_NT4); BAIL_ON_LSA_ERROR(dwError); } else if (!strcmp(ppszArgv[i], "--by-alias")) { dwError = SetQueryType(LSA_QUERY_TYPE_BY_ALIAS); BAIL_ON_LSA_ERROR(dwError); } else if (!strcmp(ppszArgv[i], "--by-upn")) { dwError = SetQueryType(LSA_QUERY_TYPE_BY_UPN); BAIL_ON_LSA_ERROR(dwError); } else if (!strcmp(ppszArgv[i], "--by-unix-id")) { dwError = SetQueryType(LSA_QUERY_TYPE_BY_UNIX_ID); BAIL_ON_LSA_ERROR(dwError); } else if (!strcmp(ppszArgv[i], "--by-name")) { dwError = SetQueryType(LSA_QUERY_TYPE_BY_NAME); BAIL_ON_LSA_ERROR(dwError); } else if (!strcmp(ppszArgv[i], "--nss")) { gState.FindFlags |= LSA_FIND_FLAGS_NSS; } else if (!strcmp(ppszArgv[i], "--pb-out")) { gState.bPBOutputMode = TRUE; } else if (!strcmp(ppszArgv[i], "--provider")) { i++; if (i >= argc) { dwError = LW_ERROR_INVALID_PARAMETER; BAIL_ON_LSA_ERROR(dwError); } gState.pszTargetProvider = ppszArgv[i]; } else if (!strcmp(ppszArgv[i], "--help") || !strcmp(ppszArgv[i], "-h")) { gState.bShowUsage = TRUE; } else { dwError = ParseQueryItem(ppszArgv[i]); BAIL_ON_LSA_ERROR(dwError); } } error: return dwError; }