concordia search php
This commit is contained in:
parent
5ae89e73f9
commit
370a95dd44
@ -32,35 +32,29 @@ $data = json_decode($response);
|
|||||||
<pre><?php print_r($data);?></pre>
|
<pre><?php print_r($data);?></pre>
|
||||||
<div id="result-score">Concordia score: <b><?= round($data->result->bestOverlayScore*100) ?>%</b></div>
|
<div id="result-score">Concordia score: <b><?= round($data->result->bestOverlayScore*100) ?>%</b></div>
|
||||||
<?php
|
<?php
|
||||||
/*
|
$inputSentence = $_GET["pattern"];
|
||||||
res += '<div id="phrase-selection">Phrase search mode: <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>';
|
$markedSentence = "";
|
||||||
|
$fragments = array();
|
||||||
var inputSentence = $('#search-input').val();
|
$lastInsertedEnd = 0;
|
||||||
var markedSentence = '';
|
for($i=0; $i<length($data->result->bestOverlay);$i++) {
|
||||||
var fragments = '';
|
$fragment = data->result->bestOverlay[i];
|
||||||
lastInsertedEnd = 0;
|
|
||||||
for(var i = 0; i < data['result']['bestOverlay'].length; i++) {
|
|
||||||
var fragment = data['result']['bestOverlay'][i];
|
|
||||||
//previous unmarked fragment
|
//previous unmarked fragment
|
||||||
markedSentence += inputSentence.slice(lastInsertedEnd, fragment['matchedPatternStart']);
|
$markedSentence += substr($inputSentence,$lastInsertedEnd, $fragment->matchedPatternStart - $lastInsertedEnd);
|
||||||
|
|
||||||
//the marked fragment
|
//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
|
//remaining unmarked fragment
|
||||||
markedSentence += inputSentence.slice(lastInsertedEnd);
|
$markedSentence += substr($inputSentence, $lastInsertedEnd);
|
||||||
|
|
||||||
res += '<div id="result-sentence" onMouseUp="phraseSearch(this)">'+markedSentence+'</div>';
|
|
||||||
|
|
||||||
res += '<br/><br/><br/>'+fragments;
|
|
||||||
*/
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<div id="result-sentence" onMouseUp="phraseSearch(this)"><?=$markedSentence ?></div>
|
||||||
|
<br/><br/><br/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user