new cat, db index

This commit is contained in:
Rafał Jaworski 2016-01-02 15:58:28 +01:00
parent 883aebe919
commit a76594ebf4
3 changed files with 16 additions and 1 deletions

View File

@ -53,6 +53,7 @@ function renderResult(data) {
function renderFragment(fragment, number) {
var result = '<div style="display:none" id="fragment'+number+'" class="fragmentDetails"><table><tr><td>';
// source segment
var sourceSegment = fragment['sourceSegment'];
result += sourceSegment.slice(0, fragment['matchedExampleStart']);
result += '<span class="matchedFragment">';
@ -60,7 +61,19 @@ function renderFragment(fragment, number) {
result += '</span>';
result += sourceSegment.slice(fragment['matchedExampleEnd']);
result += '</td></tr><tr><td>'+fragment['targetSegment']+'</td></tr></table></div>';
// target segment
result += '</td></tr><tr><td>';
var targetSegment = fragment['targetSegment'];
var currStart = 0;
for (i=0;i<fragment['targetFragments'].length;i++) {
result += targetSegment.slice(currStart, fragment['targetFragments'][i][0]);
result += '<span class="matchedFragment">';
result += targetSegment.slice(fragment['targetFragments'][i][0], fragment['targetFragments'][i][1]);
result += '</span>';
currStart = fragment['targetFragments'][i][1];
}
result += targetSegment.slice(currStart);
result += '</td></tr></table></div>';
return result;
}

View File

@ -7,3 +7,4 @@ enjoy@#@Enjoy your work with the system!
prompt@#@Enter search pattern (Croatian sentence):
suggestion@#@Kazna medijskom mogulu obnovila raspravu u Makedoniji
suggestion@#@Član Predsjedništva BiH Komšić podnio ostavku u svojoj stranci
suggestion@#@ozbiljno analizira proces

View File

@ -31,3 +31,4 @@ CREATE TABLE alignment (
target_token_pos integer
);
CREATE INDEX ON alignment(unit_id, source_token_pos);