diff --git a/cat/concordia_search.php_pattern b/cat/concordia_search.php_pattern index 19c90bd..e2758cf 100644 --- a/cat/concordia_search.php_pattern +++ b/cat/concordia_search.php_pattern @@ -12,8 +12,9 @@ $options = array( ), ); $context = stream_context_create($options); -$result = file_get_contents($url, false, $context); +$response = file_get_contents($url, false, $context); +$data = json_decode($response); ?> @@ -23,6 +24,44 @@ $result = file_get_contents($url, false, $context); - + + +
Concordia score: '+%
+ Phrase search mode: enter phrase search mode'; + + 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 += ''+inputSentence.slice(fragment['matchedPatternStart'], fragment['matchedPatternEnd'])+''; + + lastInsertedEnd = fragment['matchedPatternEnd']; + + fragments += renderFragment(fragment, i); + } + + //remaining unmarked fragment + markedSentence += inputSentence.slice(lastInsertedEnd); + + res += '
'+markedSentence+'
'; + + res += '


'+fragments; + */ + + ?> +