concordia search php

This commit is contained in:
rjawor 2017-02-21 12:39:22 +01:00
parent 5ae89e73f9
commit 370a95dd44

View File

@ -32,35 +32,29 @@ $data = json_decode($response);
<pre><?php print_r($data);?></pre>
<div id="result-score">Concordia score: <b><?= round($data->result->bestOverlayScore*100) ?>%</b></div>
<?php
/*
res += '<div id="phrase-selection">Phrase search mode:&nbsp;<img id="phrase-off-icon" src="../images/switchOff.png" alt="enter phrase search mode" onclick="togglePhraseSearchMode()" title="search for phrases"/><img class="hidden" id="phrase-on-icon" src="../images/switchOn.png" alt="cancel phrase search" onclick="togglePhraseSearchMode()" title="cancel phrase search"/><span id="phrase-prompt" class="hidden">Select continuous phrase: </span></div>';
var inputSentence = $('#search-input').val();
var markedSentence = '';
var fragments = '';
lastInsertedEnd = 0;
for(var i = 0; i < data['result']['bestOverlay'].length; i++) {
var fragment = data['result']['bestOverlay'][i];
$inputSentence = $_GET["pattern"];
$markedSentence = "";
$fragments = array();
$lastInsertedEnd = 0;
for($i=0; $i<length($data->result->bestOverlay);$i++) {
$fragment = data->result->bestOverlay[i];
//previous unmarked fragment
markedSentence += inputSentence.slice(lastInsertedEnd, fragment['matchedPatternStart']);
$markedSentence += substr($inputSentence,$lastInsertedEnd, $fragment->matchedPatternStart - $lastInsertedEnd);
//the marked fragment
markedSentence += '<span onclick="displayDetails(this, '+i+')" class="matchedFragment">'+inputSentence.slice(fragment['matchedPatternStart'], fragment['matchedPatternEnd'])+'</span>';
$markedSentence += '<span onclick="displayDetails(this, '+i+')" class="matchedFragment">'+substr($inputSentence,$fragment->matchedPatternStart, $fragment->matchedPatternEnd - $fragment->matchedPatternStart)+'</span>';
lastInsertedEnd = fragment['matchedPatternEnd'];
$lastInsertedEnd = $fragment->matchedPatternEnd;
//fragments += renderFragment(fragment, i);
fragments += renderFragment(fragment, i);
}
//remaining unmarked fragment
markedSentence += inputSentence.slice(lastInsertedEnd);
res += '<div id="result-sentence" onMouseUp="phraseSearch(this)">'+markedSentence+'</div>';
res += '<br/><br/><br/>'+fragments;
*/
$markedSentence += substr($inputSentence, $lastInsertedEnd);
?>
<div id="result-sentence" onMouseUp="phraseSearch(this)"><?=$markedSentence ?></div>
<br/><br/><br/>
</div>
</div>
</body>