if (isset($_GET['lang'])) {
    $lang = $_GET['lang'];
}
$word = $_GET['word'];
$word = html_entity_decode($word);
if (empty($word)) {
    exit;
}
if (isArabicString($word)) {
    loadModels("core", "AR");
    $lang = "AR";
} else {
    loadModels("core", "EN");
    $lang = "EN";
}
$similarWordsArr = getSimilarWords($lang, array($word));
?>

<br>
<b>Similar Words (Character Similarity)</b>
<ul>
<?php 
$i = 0;
foreach ($similarWordsArr as $similarWord => $score) {
    if ($i++ > 20) {
        break;
    }
    ?>
<li><?php 
    echo $similarWord;
    ?>
#    back to www.qurananalysis.com and sufficient credits are given.
#
#  ====================================================================
require_once "../global.settings.php";
require_once "../libs/search.lib.php";
//only arabic is supported here, english $lang spoils the functions
$lang = "AR";
loadModels("core,search,qac", $lang);
$WORDS_TRANSLATIONS_EN_AR = apc_fetch("WORDS_TRANSLATIONS_EN_AR");
$WORDS_TRANSLATIONS_AR_EN = apc_fetch("WORDS_TRANSLATIONS_AR_EN");
$WORDS_TRANSLITERATION = apc_fetch("WORDS_TRANSLITERATION");
$word = $_GET['word'];
$wordInfoArr = getWordInfo($word, $MODEL_CORE, $MODEL_SEARCH, $MODEL_QAC);
if (empty($wordInfoArr)) {
    showTechnicalError("Word not found");
    $suggestionsArr = getSimilarWords($lang, array($word));
    if (!empty($suggestionsArr)) {
        $suggestionsArr = array_slice($suggestionsArr, 0, 10);
        echoN("<b>Do you mean</b>:<br>" . join(", ", array_keys($suggestionsArr)));
    }
    exit;
}
//preprint_r($wordInfoArr);
/*
echoN("Buckwalter Transliteration:".$buckwalterTransliteration);
echoN("Translation:"."");
echoN("English Translation:"."");

echoN("Word Root:".$wordRoot);
echoN("PoS Tags:".join(",", array_keys($posTagsArr)));
echoN("Lemmas:".join(",", array_keys($lemmasArr)));
<ul class="compact">
<?php 
$start = getmicrotime();
$matches = array();
$trans_table = array();
$queryterm = trim($_GET['word']);
if ($queryterm != "") {
    $matches = getSimilarWords($db, $queryterm, 1);
}
if (sizeof($matches) > 0) {
    asort($matches);
    $max = 5;
    $i = 0;
    ?>
	<?php 
    while ($i < $max && (list($w, $diff) = each($matches))) {
        ?>
 
		<li><a href="<?php 
        print DEFAULT_SEARCH;
        ?>
?word=<?php 
        print urlencode($w);
        ?>
"><?php 
        print $w;
        ?>
</a></li>
		<?php 
        $i++;
Ejemplo n.º 4
0
function handleEmptyResults($scoringTable, $extendedQueryWordsArr, $query, $originalQuery, $isColumnSearch, $searchType, $lang)
{
    // NOT RESULTS FOUND
    if (empty($scoringTable)) {
        // GET SIMILAR WORDS BY MIN-EDIT-DISTANCE
        $suggestionsArr = getSimilarWords($lang, array_keys($extendedQueryWordsArr));
        $searchedForText = $query;
        if ($isColumnSearch) {
            $searchedForText = " this verse \"{$originalQuery}\" ";
        } else {
            $searchedForText = "\"{$searchedForText}\"";
        }
        ?>
		
			<div class='search-error-message'>
				No results found for <?php 
        echo $searchedForText;
        ?>
				
				<script>
				trackEvent('SEARCH',$searchType,'FAILED','');
				</script>
			</div>
			
		<?php 
        showSuggestions($suggestionsArr);
        exit;
    }
}