本文整理匯總了PHP中Definition::loadForLexems方法的典型用法代碼示例。如果您正苦於以下問題:PHP Definition::loadForLexems方法的具體用法?PHP Definition::loadForLexems怎麽用?PHP Definition::loadForLexems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Definition
的用法示例。
在下文中一共展示了Definition::loadForLexems方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: session_setVariable
if (!count($lexems)) {
FlashMessage::add("Niciun rezultat relevant pentru „{$cuv}”.");
}
}
}
if (count($lexems) == 1 && $cuv != $lexems[0]->formNoAccent) {
// Convenience redirect when there is only one correct form. We want all pages to be canonical
$sourcePart = $source ? "-{$source->urlName}" : '';
session_setVariable('redirect', true);
session_setVariable('init_word', $cuv);
util_redirect(util_getWwwRoot() . "definitie{$sourcePart}/{$lexems[0]->formNoAccent}" . ($xml ? '/xml' : ''));
}
smarty_assign('lexems', $lexems);
if ($searchType == SEARCH_INFLECTED) {
// For successful searches, load the definitions, inflections and linguistic articles
$definitions = Definition::loadForLexems($lexems, $sourceId, $cuv, $exclude_unofficial);
smarty_assign('wikiArticles', WikiArticle::loadForLexems($lexems));
}
if (isset($definitions)) {
$searchResults = SearchResult::mapDefinitionArray($definitions);
}
}
$conjugations = NULL;
$declensions = NULL;
if ($searchType == SEARCH_INFLECTED || $searchType == SEARCH_LEXEM_ID || $searchType == SEARCH_FULL_TEXT || $searchType == SEARCH_MULTIWORD) {
smarty_assign('results', $searchResults);
// Maps lexems to arrays of inflected forms (some lexems may lack inflections)
// Also compute the text of the link to the paradigm div,
// which can be 'conjugări', 'declinări' or both
if (!empty($lexems)) {
$ifMaps = array();
示例2: lookup
function lookup($sourceId, $cuv, $fd)
{
if (!source_exists($sourceId)) {
socket_write($fd, "550 invalid database, use SHOW DB for a list\r\n");
return;
}
if ($sourceId == '*' || $sourceId == '!') {
$sourceId = 0;
}
$cuv = StringUtil::cleanupQuery($cuv);
$arr = StringUtil::analyzeQuery($cuv);
$field = $arr[0] ? 'formNoAccent' : 'formUtf8General';
$lexems = db_find(new Lexem(), "{$field} = '{$cuv}' order by formNoAccent");
$definitions = Definition::loadForLexems($lexems, $sourceId, $cuv);
$searchResults = SearchResult::mapDefinitionArray($definitions);
if (!count($definitions)) {
socket_write($fd, "552 no match\r\n");
return;
}
socket_write($fd, "150 " . count($definitions) . " definition(s) found\r\n");
foreach ($searchResults as $sr) {
$def = pretty_print($sr->definition->internalRep);
socket_write($fd, "151 \"" . $cuv . "\" " . $sr->source->id . " \"" . $sr->source->name . "\"\r\n");
socket_write($fd, "{$cuv}\r\n{$def}");
socket_write($fd, ".\r\n");
}
socket_write($fd, "250 ok\r\n");
}