コード例 #1
0
function handleNewConceptFromRelation(&$finalConcepts, $subjectOrObject, $conceptLocationInRelation, &$notInCounceptsCounter, &$statsUniqueSubjects)
{
    global $WORDS_TRANSLATIONS_AR_EN;
    $subjectOrObjectFlag = null;
    // SUBJECT NOT IN MASTER CONCEPTS LIST
    if (!isset($finalConcepts[$subject])) {
        if ($conceptLocationInRelation == "SUBJECT") {
            echoN("NOT IN CONCEPTS:S:{$subjectOrObject}");
        } else {
            echoN("NOT IN CONCEPTS:O:{$subjectOrObject}");
        }
        $notInCounceptsCounter++;
        $statsUniqueSubjects[$subjectOrObject] = 1;
    }
    $termsArr = getTermArrBySimpleWord($finalTerms, $subjectOrObject);
    $freq = $termsArr['FREQ'];
    $isQuranaPhraseConcept = false;
    //echoN("^&&*:".(strpos($subjectOrObject," ")!==false));
    if (isMultiWordStr($subjectOrObject)) {
        $quranaConceptArr = getQuranaConceptEntryByARWord($subjectOrObject);
        $engTranslation = ucfirst($quranaConceptArr['EN']);
        echoN("^^{$subjectOrObject}");
        $isQuranaPhraseConcept = true;
    } else {
        $uthmaniWord = getItemFromUthmaniToSimpleMappingTable($subjectOrObject);
        $engTranslation = ucfirst(cleanEnglishTranslation($WORDS_TRANSLATIONS_AR_EN[$uthmaniWord]));
    }
    addNewConcept($finalConcepts, $subjectOrObject, "A-BOX", "POPULATION_FROM_RELATIONS", $freq, $engTranslation);
    $finalConcepts[$subjectOrObject]['EXTRA']['POS'] = $subjectOrObjectFlag;
    $finalConcepts[$subjectOrObject]['EXTRA']['WEIGHT'] = $termsArr['WEIGHT'];
    if ($isQuranaPhraseConcept) {
        echoN($isQuranaPhraseConcept . "||||{$subjectOrObject}");
        $finalConcepts[$subjectOrObject]['EXTRA']['IS_QURANA_NGRAM_CONCEPT'] = true;
    }
}
コード例 #2
0
						<th>
							Transliteration
						</th>
						<td>
							<?php 
echo $WORDS_TRANSLITERATION[$wordUthmani];
?>
						</td>
					</tr>
					<tr>	
						<th>
							English Translation
						</th>
						<td>
							<?php 
echo cleanEnglishTranslation($WORDS_TRANSLATIONS_AR_EN[$wordUthmani]);
?>
						</td>
						<th>
							Word Root
						</th>
						<td>
							<?php 
echo $wordInfoArr['ROOT'];
?>
						</td>
					</tr>	
					<tr>	
						<th>
							PoS Tags (<a target="_new" href="http://corpus.quran.com/documentation/tagset.jsp">QAC</a>)
						</th>
コード例 #3
0
                		$engTranslationB4Cleaning = $WORDS_TRANSLATIONS_AR_EN[$uthmaniWordForTranslation];
                		echoN($engTranslationB4Cleaning);
                		*/
                if (!isFoundInTranslationTable($concept)) {
                    //echoN("|$parentConceptEN|");
                    $tentitaveTranslation = translateText($concept, "ar", "en");
                    addTranslationEntry($tentitaveTranslation, "CONCEPT", $concept, "AR");
                    $finalTranslation = $tentitaveTranslation;
                } else {
                    $customTranslationEntry = getTranlationEntryByEntryKeyword($concept);
                    $finalTranslation = $customTranslationEntry['EN_TEXT'];
                }
            }
            //echoN($finalTranslation);
            // REPLACE BRACKETS AND SPECIAL CHARS WITH SPACES
            $englishTranslation = cleanEnglishTranslation($finalTranslation);
            //SET IT IN CONCEPT METADATA
            $finalConcepts[$concept]['EXTRA']['TRANSLATION_EN'] = $englishTranslation;
            //echoN("$uthmaniWord|$englishTranslation|$engTranslationB4Cleaning");
            preprint_r($finalConcepts[$concept]);
        }
        // TODO: may need to do the same as above for transliteration
        $englishTransliteration = $WORDS_TRANSLITERATION[$uthmaniWord];
        $finalConcepts[$concept]['EXTRA']['TRANSLITERATION_EN'] = $englishTransliteration;
    }
    //preprint_r($finalConcepts);exit;
    //echoN(count($finalConcepts));
    //exit;
    file_put_contents("{$ONTOLOGY_EXTRACTION_FOLDER}/temp.final.concepts.stage4", serialize($finalConcepts));
}
if ($ENRICH_CONCEPTS_METADATA_DBPEDIA) {