Пример #1
0
 $scoreDecr = 0.0008;
 $scoreIncr = 0.001;
 $correct = boolean;
 //Variables for answer comparison
 $questionFromBank = $_POST['questionFromBank'];
 $answerFromBank = $_POST['answerFromBank'];
 $answerID = getAnswerIDVocab($_POST['questionID'], $questionFromBank);
 $wordIDGuess = getGuessID($_POST['guess'], $answerID, $answerFromBank);
 $cvset = getSkill('cvset', $userID);
 $vstyle = getSkill('vstyle', $userID);
 //Stats Variables
 $deck_id = getDeckInfo($cvset, 'id');
 $word_id = $_POST['questionID'];
 $user_id = $userID;
 $correct = '';
 $word_lv = getWordInfo($cvset, $word_id, $questionFromBank);
 $vstyle_id = getVstyleId($vstyle);
 $time_taken = (int) $_POST['minutesTaken'] * 60 + (int) $_POST['secondsTaken'];
 /*$changeLog[] = '<div class="dropdown small">
 		<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-bar-chart"></i><span class="sr-only">Results</span><span class="hidden-xs caret"></span></span></a>
 			<ul class="dropdown-menu">';*/
 //Get and compare the answer ID of the question word with the input word to see if matching
 //----------------ASSIGN VARIABLES BASED ON VSTYLE
 if (substr($vstyle, 0, 5) == 'audio') {
     $skills[] = 'listening';
 }
 if ($vstyle == 'kanjiRE') {
     $gcRw = getDeckInfo($cvset, 'gc_per_kanjiRE');
 } elseif ($vstyle == 'kanjiE') {
     $gcRw = getDeckInfo($cvset, 'gc_per_kanjiE');
 } elseif ($vstyle == 'kanjiH') {
Пример #2
0
<meta charset="utf-8">
<?php 
include "../model/api.php";
$word = trim($_REQUEST['w']);
$block = $_REQUEST['block'];
$order = $_REQUEST['ord'];
$pid = $_REQUEST['c'];
$ord = $pid . "_" . $order;
$textID = "stem" . $block;
$punctuations = array("", " ", ":", ";", ".", ",", "؛", "-", "(", ")", "|", "[", "]", "");
echo "<center><h3>{$word}</h3>";
if (!in_array($word, $punctuations) && !is_numeric($word) && strlen(trim($word)) / 2 > 1) {
    $freq = getFreq($word);
    $info = getWordInfo($pid, $order);
    ?>
<div >
<div><div>
<input type="hidden" id="id<?php 
    echo $block;
    ?>
" value="<?php 
    echo $ord;
    ?>
">
Frequency: <?php 
    echo $freq;
    ?>
<br/>
							<span class="chkGrp"> <input type="radio" value="Common" name="ent<?php 
    echo $block;
    ?>
#
#    You can use Quran Analysis code, framework or corpora in your website
#	 or application (commercial/non-commercial) provided that you link
#    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:"."");
Пример #4
0
    //Get Question and Answers for MC Via Id's
    $questionFromBank = 'jtest';
    $answerFromBank = 'jtest';
    $questionID = getQuizWordID($userID, $vstyle);
    $answerID = $questionID;
    $element = 'reading';
    $answerChoices = getRandomWords($choiceQ, $answerFromBank, $answerID, $userID, $element);
    //get random words in HIRAGANA; need to get hiragana, not kanji
    //Prepare for Display in kanjiRE.php
    $rand = rand(0, $choiceQ - 1);
    $answer = $vstyle == 'audioR' || $vstyle == 'kanjiH' ? getReading($answerID, $answerFromBank) : getWord($answerID, $answerFromBank);
    $answerChoices[$rand]['id'] = $answerID;
    $answerChoices[$rand][$element] = $answer;
    //print_r($answerChoices);
    //Finalized Variables Used in kanjiRE.php
    $question = $vstyle == 'audioR' || $vstyle == 'audioK' ? getWordInfo('audio_filename', $questionID, $questionFromBank) : getWord($questionID, $questionFromBank);
    if (isSentencesDeck(getVocStat('cvset', $userID)) == '1') {
        $sentences = getSentences($questionID);
    } else {
        $sentences = False;
    }
} elseif (getSkill('vStyle', $userID) == 'engK' || getSkill('vStyle', $userID) == 'engKR') {
    //***************************************************************************************************
    //*************************************English<-->Kanji+Hiragana; Hiragana***************************
    //***************************************************************************************************
    //$choiceQ = 5;
    $questionFromBank = 'etest';
    $answerFromBank = 'jtest';
    //get word
    $questionID = getQuizWordID($userID, getSkill('vStyle', $userID));
    //echo "newQuesID is: $questionID <br />";
$GENERATE_FINAL_CONCEPTS = $GENERATE_CONCEPTS_SWITCH;
$GENERATE_NONTAXONOMIC_RELATIONS = TRUE;
$EXTRACT_NEWCONCEPTS_FROM_RELATIONS = TRUE;
$GENERATE_TAXONOMIC_RELATIONS = TRUE;
$ENRICH_CONCEPTS_METADATA_TRANSLATION_TRANSLITERATION = TRUE;
$ENRICH_CONCEPTS_METADATA_DBPEDIA = TRUE;
$ENRICH_CONCEPTS_METADATA_WORDNET = TRUE;
$EXCLUDE_CONCEPTS_AND_RELATIONS = TRUE;
$FINAL_POSTPROCESSING = TRUE;
$GENERATE_OWL_FILE = TRUE;
$WORDS_FREQUENCY = getModelEntryFromMemory($lang, "MODEL_CORE", "WORDS_FREQUENCY", "");
$wordsInfoArr = unserialize(file_get_contents("../data/cache/words.info.all"));
// not cahed yet
if (empty($wordsInfoArr)) {
    foreach ($WORDS_FREQUENCY['WORDS_TFIDF'] as $wordLabel => $wordFreqArr) {
        $wordsInfoArr[$wordLabel] = getWordInfo($wordLabel, $MODEL_CORE, $MODEL_SEARCH, $MODEL_QAC, true);
    }
    file_put_contents("../data/cache/words.info.all", serialize($wordsInfoArr));
}
$finalConcepts = array();
$relationsArr = array();
if ($GENERATE_TERMS == true) {
    $finalTerms = array();
    getWordsByPos($finalTerms, "PN");
    echoN("PN:<b>" . count($finalTerms) . "</b>");
    $last = count($finalTerms);
    getWordsByPos($finalTerms, "ADJ");
    echoN("ADJ:<b>" . (count($finalTerms) - $last) . "</b>");
    $last = count($finalTerms);
    getWordsByPos($finalTerms, "N");
    echoN("N:<b>" . (count($finalTerms) - $last) . "</b>");