concordia search php
This commit is contained in:
parent
4e4941b143
commit
6a7671e2db
@ -12,8 +12,9 @@ $options = array(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
$context = stream_context_create($options);
|
$context = stream_context_create($options);
|
||||||
$result = file_get_contents($url, false, $context);
|
$response = file_get_contents($url, false, $context);
|
||||||
|
|
||||||
|
$data = json_decode($response);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
@ -23,6 +24,44 @@ $result = file_get_contents($url, false, $context);
|
|||||||
<link rel="stylesheet" href="css/iatagger.css" />
|
<link rel="stylesheet" href="css/iatagger.css" />
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
</head>
|
</head>
|
||||||
<body onLoad="renderResult(JSON.parse('<?= $result ?>'))">
|
<body>
|
||||||
|
<?php
|
||||||
|
if (!empty($data['result']['bestOverlayScore'])) {
|
||||||
|
$score = $data['result']['bestOverlayScore']*100;
|
||||||
|
?>
|
||||||
|
<div id="result-score">Concordia score: <b>'+<?= $score ?>%</b></div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
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>';
|
||||||
|
|
||||||
|
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];
|
||||||
|
//previous unmarked fragment
|
||||||
|
markedSentence += inputSentence.slice(lastInsertedEnd, fragment['matchedPatternStart']);
|
||||||
|
|
||||||
|
//the marked fragment
|
||||||
|
markedSentence += '<span onclick="displayDetails(this, '+i+')" class="matchedFragment">'+inputSentence.slice(fragment['matchedPatternStart'], fragment['matchedPatternEnd'])+'</span>';
|
||||||
|
|
||||||
|
lastInsertedEnd = fragment['matchedPatternEnd'];
|
||||||
|
|
||||||
|
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;
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user