Ejemplo n.º 1
0
) - Chapters (<?php 
echo count($uniqueChapters);
?>
) 
			  				</th>
			  			</tr>
					</thead>
						<?php 
foreach ($initialsVersesArr as $location => $verseText) {
    $segment = $initialsSegmentsArr[$location];
    ?>
				  			<tr>
				  				<td style="text-align: right;">
				  					<?php 
    $verseText = markWordWithoutWordIndex($verseText, $segment, "marked");
    $verseText = markSpecificWordInText($verseText, 1, ".*", "marked_for_initials");
    echoN($verseText);
    ?>
				  				</td>
				  			</tr>
				  			
				  		<?php 
}
?>
		  	
			</table>
		</div>
			  	
			  	
   </div>
   
									<?php 
$levelArr = $contextArr[$levelName];
arsort($levelArr);
foreach ($fullSentences as $concordanceIndex => $concSentence) {
    ?>
											<tr>	
													<?php 
    //$concSentence = markWordWithoutWordIndex($concSentence, $targetPOSorWord, "marked_for_concordance");
    //echoN($concSentence);
    $afterPart = mb_substr($concSentence, mb_strpos($concSentence, $targetPOSorWord) + mb_strlen($targetPOSorWord));
    $beforePart = mb_substr($concSentence, 0, mb_strpos($concSentence, $targetPOSorWord));
    // to pre-clean for marking code
    $beforePart = trim($beforePart);
    $afterPart = trim($afterPart);
    $afterPart = markSpecificWordInText($afterPart, 0, ".*", "marked_for_concordance_right_left");
    $beforePart = markSpecificWordInText($beforePart, preg_match_all("/ /", $beforePart), ".*", "marked_for_concordance_right_left");
    ?>
												<td <?php 
    if ($targetType == "POS") {
        echo 'align="right"';
    } else {
        echo 'align="left"';
    }
    ?>
 >
													<?php 
    echo $beforePart;
    ?>
												</td>
												<td align="center">
													<span class='marked_for_concordance'><?php 
Ejemplo n.º 3
0
function printResultVerses($scoringTable, $lang, $direction, $query, $isPhraseSearch, $isQuestion, $script, $significantCollocationWords = null, $isTransliterationSearch = false)
{
    global $script, $TRANSLITERATION_VERSES_MAP;
    $QURAN_TEXT = getModelEntryFromMemory($lang, "MODEL_CORE", "QURAN_TEXT", "");
    $QURAN_TEXT_UTH = getModelEntryFromMemory("AR_UTH", "MODEL_CORE", "QURAN_TEXT", "");
    $META_DATA = getModelEntryFromMemory($lang, "MODEL_CORE", "META_DATA", "");
    $TOTALS = getModelEntryFromMemory($lang, "MODEL_CORE", "TOTALS", "");
    if ($lang == "EN") {
        if ($script == "simple") {
            $QURAN_TEXT_OTHER_LANG = getModelEntryFromMemory("AR", "MODEL_CORE", "QURAN_TEXT", "");
        } else {
            $QURAN_TEXT_OTHER_LANG = $QURAN_TEXT_UTH;
        }
    } else {
        $QURAN_TEXT_OTHER_LANG = getModelEntryFromMemory("EN", "MODEL_CORE", "QURAN_TEXT", "");
    }
    //preprint_r($scoringTable);exit;
    $searchResultsTextArr = array();
    //preprint_r($scoringTable);exit;
    $relevanceReverseOrderIndex = count($documentScoreArr);
    foreach ($scoringTable as $documentID => $documentScoreArr) {
        //preprint_r($documentScoreArr);
        $relevanceReverseOrderIndex--;
        $SURA = $documentScoreArr['SURA'];
        $AYA = $documentScoreArr['AYA'];
        $TEXT = $QURAN_TEXT[$SURA][$AYA];
        $TEXT_UTH = $QURAN_TEXT_UTH[$SURA][$AYA];
        $TEXT_TRANSLITERATED = cleanTransliteratedText($TRANSLITERATION_VERSES_MAP[$SURA + 1 . ":" . ($AYA + 1)]);
        $WORD_TYPE = $documentScoreArr['WORD_TYPE'];
        $EXTRA_INFO = $documentScoreArr['EXTRA_INFO'];
        $INDEX_IN_AYA_EMLA2Y = $documentScoreArr['INDEX_IN_AYA_EMLA2Y'];
        $WORDS_IN_AYA = $documentScoreArr['POSSIBLE_HIGHLIGHTABLE_WORDS'];
        $PRONOUNS = $documentScoreArr['PRONOUNS'];
        $score = $documentScoreArr['SCORE'];
        $searchResultsTextArr[] = $TEXT;
        $TEXT_TRANSLATED = $QURAN_TEXT_OTHER_LANG[$SURA][$AYA];
        $SURA_NAME = $META_DATA['SURAS'][$SURA]['name_' . strtolower($lang)];
        $SURA_NAME_LATIN = $META_DATA['SURAS'][$SURA]['name_trans'];
        // وكذلك جلناكم امة وسطا 143/256
        $TOTAL_VERSES_OF_SURA = $TOTALS['TOTAL_PER_SURA'][$SURA]['VERSES'];
        //preprint_r($MODEL['QURAN_TEXT']);
        $MATCH_TYPE = "";
        if ($WORD_TYPE == "PRONOUN_ANTECEDENT") {
            $MATCH_TYPE = "ضمير";
            if ($lang == "EN") {
                $MATCH_TYPE = "pronoun";
            }
        } else {
            if ($WORD_TYPE == "ROOT" || $WORD_TYPE == "LEM") {
                $MATCH_TYPE = "تصريف / إشتقاق";
            }
        }
        // empty in case of only pronouns
        if (!empty($WORDS_IN_AYA)) {
            if ($isPhraseSearch) {
                // mark all POSSIBLE_HIGHLIGHTABLE_WORDS
                $TEXT = preg_replace("/(" . $query . ")/mui", "<marked>\\1</marked>", $TEXT);
            } else {
                // mark all POSSIBLE_HIGHLIGHTABLE_WORDS
                $TEXT = preg_replace("/(" . join("|", array_keys($WORDS_IN_AYA)) . ")/mui", "<marked>\\1</marked>", $TEXT);
                if ($isTransliterationSearch) {
                    $TEXT_TRANSLITERATED = preg_replace("/(" . join("|", array_keys($WORDS_IN_AYA)) . ")/mui", "<marked>\\1</marked>", $TEXT_TRANSLITERATED);
                }
            }
        }
        //preprint_r($PRONOUNS);
        // mark PRONOUNS
        //if ( $WORD_TYPE=="PRONOUN_ANTECEDENT") {} // COMMENTED SINCE WORD MAY HAVE BOTH PRON AND NORMAKL WORDS
        foreach ($PRONOUNS as $pronounText => $PRONOUN_INDEX_IN_AYA_EMLA2Y) {
            $pronounText = removeTashkeel($pronounText);
            $TEXT = markSpecificWordInText($TEXT, $PRONOUN_INDEX_IN_AYA_EMLA2Y - 1, $pronounText, "marked");
            //$TEXT = preg_replace("/(".$EXTRA_INFO.")/mui", "<marked>\\1</marked>", $TEXT);
            //echoN("|".$TEXT);
        }
        if ($isQuestion) {
            //preprint_r($significantCollocationWords);
            foreach ($significantCollocationWords as $word => $freq) {
                $TEXT = markWordWithoutWordIndex($TEXT, $word, "marked_prospect_answer");
                //$TEXT = preg_replace("/(".$EXTRA_INFO.")/mui", "<marked>\\1</marked>", $TEXT);
                //echoN("|".$TEXT);
            }
        }
        $documentID = preg_replace("/\\:/", "-", $documentID);
        //preprint_r($documentScoreArr);
        ?>
	
		<div class='result-aya-container'  order='<?php 
        echo $SURA + 1;
        ?>
' relevance='<?php 
        echo $relevanceReverseOrderIndex;
        ?>
' >
		
			<div class='result-aya'  style="direction:<?php 
        echo $direction;
        ?>
" id="<?php 
        echo $documentID;
        ?>
" >
				
				 
				 
				<?php 
        if ($script == "uthmani" && $lang == "AR") {
            echo $TEXT_UTH;
        } else {
            echo $TEXT;
            if ($isTransliterationSearch) {
                echo "<hr class='transliteration-separator'/>";
                echo "<div class='transliteration-verse-text-area'>{$TEXT_TRANSLITERATED}</div>";
            }
        }
        ?>
				
		
				
				<div id="<?php 
        echo $documentID;
        ?>
-translation" class='result-translated-text' style="direction:<?php 
        echo $lang == "AR" ? "ltr" : "rtl";
        ?>
" >
					
					<?php 
        echo $TEXT_TRANSLATED;
        ?>
				</div>
		
			</div>
			<div class='result-aya-info'  >
			
				<span class='result-sura-info' style="direction:<?php 
        echo $direction;
        ?>
">
						<?php 
        echo $SURA_NAME;
        ?>
						<?php 
        if ($lang == "EN") {
            echo " ({$SURA_NAME_LATIN})";
        }
        ?>
 
					[<?php 
        echo $SURA + 1 . ":" . ($AYA + 1);
        ?>
]
						 <?php 
        php;
        ?>
 
				</span>
		
				<span class='result-aya-showtranslation' >
				<?php 
        $showTransText = "Show Translation";
        if ($lang == "EN") {
            $showTransText = "Show Arabic";
        }
        ?>
					<a href="javascript:showTranslationFor('<?php 
        echo $documentID;
        ?>
')"><?php 
        echo $showTransText;
        ?>
</a>
				</span>
			
			<span class='result-more-about-aya'>
				<a target='_new' href='http://quran.com/<?php 
        echo $SURA + 1 . "/" . ($AYA + 1);
        ?>
'>
				More
				</a>
			</span>
				
				<span class='result-match-type'>
					<?php 
        echo $MATCH_TYPE;
        ?>
				</span>
			</div>
		</div>
	
	<?php 
    }
    return $searchResultsTextArr;
}
            $isFeatureFound = isset($qacMasterTableEntry[$segmentId - 1]['FEATURES'][$features]);
        }
        if ($isFeatureFound == false) {
            continue;
        }
    }
    if (!isset($unrepeatedWords[$segmentWord])) {
        $unrepeatedWords[$segmentWord] = 1;
    }
    if (!isset($markedVerses[$verseLocation])) {
        $verseText = getVerseByQACLocation($QURAN_TEXT, $location);
    } else {
        $verseText = $markedVerses[$verseLocation];
    }
    $wordId = getWordIndexFromQACLocation($location) - 1;
    $verseText = markSpecificWordInText($verseText, $wordId, $segmentWord, "marked_fg");
    $markedVerses[$verseLocation] = $verseText;
}
?>
					<div id='pos-words-verses-statistics'> 
					
					
					<b><?php 
echo addCommasToNumber($allOccurencesCount);
?>
</b> All Segments - 
					<b><?php 
echo addCommasToNumber(count($unrepeatedWords));
?>
</b> Distinct Words - 
					<b><?php