本文整理汇总了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");
}