Clarin full example
This commit is contained in:
parent
63599cb833
commit
e1251236ff
|
@ -29,10 +29,10 @@ export class ConfigurationComponent implements OnInit, AfterViewInit {
|
|||
localStorage.setItem('negwords', '{}');
|
||||
}
|
||||
if (!localStorage.getItem('contextprev') || localStorage.getItem('contextprev') === 'undefined') {
|
||||
localStorage.setItem('contextprev', '10');
|
||||
localStorage.setItem('contextprev', '20');
|
||||
}
|
||||
if (!localStorage.getItem('contextnext') || localStorage.getItem('contextnext') === 'undefined') {
|
||||
localStorage.setItem('contextnext', '20');
|
||||
localStorage.setItem('contextnext', '10');
|
||||
}
|
||||
if (!localStorage.getItem('wordssplitnum') || localStorage.getItem('wordssplitnum') === 'undefined') {
|
||||
localStorage.setItem('wordssplitnum', '1');
|
||||
|
|
|
@ -170,7 +170,9 @@ export class ResultspreviewComponent implements OnInit {
|
|||
// hightlight positive words
|
||||
for (let posword in JSON.parse(localStorage.getItem('poswords'))) {
|
||||
const search_regexp = new RegExp(posword, 'g');
|
||||
context = context.replace(search_regexp, '<span class="positive">' + posword + '</span>');
|
||||
context = context.replace(search_regexp, function (x) {
|
||||
return '<span class="positive">' + x + '</span>';
|
||||
});
|
||||
}
|
||||
// hightlight acknowledgment keywords
|
||||
for (let ackn of values.acknmatch) {
|
||||
|
@ -180,7 +182,9 @@ export class ResultspreviewComponent implements OnInit {
|
|||
// hightlight negative words
|
||||
for (let negword in JSON.parse(localStorage.getItem('negwords'))) {
|
||||
const search_regexp = new RegExp(negword, 'g');
|
||||
context = context.replace(search_regexp, '<span class="negative">' + negword + '</span>');
|
||||
context = context.replace(search_regexp, function (x) {
|
||||
return '<span class="negative">' + x + '</span>';
|
||||
});
|
||||
}
|
||||
context = this.highlightInElement(context, values.match);
|
||||
match.context = context;
|
||||
|
|
|
@ -138,8 +138,8 @@
|
|||
<li>
|
||||
<div class="uk-accordion-title">
|
||||
<span class="uk-text-bold uk-text-uppercase">Mining area size</span>
|
||||
<span *ngIf="settings.contextprev !== 10" class="uk-text-small uk-margin-small-left">before: {{settings.contextprev}}</span>
|
||||
<span *ngIf="settings.contextnext !== 20" class="uk-text-small uk-margin-small-left">after: {{settings.contextnext}}</span>
|
||||
<span *ngIf="settings.contextprev !== 20" class="uk-text-small uk-margin-small-left">before: {{settings.contextprev}}</span>
|
||||
<span *ngIf="settings.contextnext !== 10" class="uk-text-small uk-margin-small-left">after: {{settings.contextnext}}</span>
|
||||
</div>
|
||||
<div class="uk-accordion-content">
|
||||
<p class="uk-text-small">You may edit the length of the text area that the algorithm uses to decide if a match is a true positive.<br><span class="uk-text-danger">For advanced users only</span></p>
|
||||
|
@ -147,13 +147,13 @@
|
|||
<div class="cm-match-area left">
|
||||
<label class="uk-form-label" for="context-prev-words">Number of words before the match</label>
|
||||
<div class="uk-form-controls">
|
||||
<input class="uk-input" type="number" name="context-prev-words" min="0" max="20" id="context-prev-words" placeholder="Before match, words" value="10" [value]="settings.contextprev" (change)="contextprevChange($event.target.value)"/>
|
||||
<input class="uk-input" type="number" name="context-prev-words" min="0" max="50" id="context-prev-words" placeholder="Before match, words" value="20" [value]="settings.contextprev" (change)="contextprevChange($event.target.value)"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cm-match-area right cm-margin-medium-bottom">
|
||||
<label class="uk-form-label" for="context-next-words">Number of words after the match</label>
|
||||
<div class="uk-form-controls">
|
||||
<input class="uk-input" type="number" name="context-next-words" min="0" max="20" id="context-next-words" placeholder="After match, words" value="5" [value]="settings.contextnext" (change)="contextnextChange($event.target.value)"/>
|
||||
<input class="uk-input" type="number" name="context-next-words" min="0" max="50" id="context-next-words" placeholder="After match, words" value="10" [value]="settings.contextnext" (change)="contextnextChange($event.target.value)"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -592,7 +592,7 @@ class GetExampleProfilesHandler(BaseHandler):
|
|||
try:
|
||||
data = {}
|
||||
example_profiles = []
|
||||
example_profiles.append({'name': 'Clarin', 'contents': 11, 'documents': 7})
|
||||
example_profiles.append({'name': 'Clarin', 'contents': 4, 'documents': 9})
|
||||
example_profiles.append({'name': 'Communities', 'contents': 25, 'documents': 104})
|
||||
example_profiles.append({'name': 'AOF', 'contents': 66, 'documents': 1023})
|
||||
example_profiles.append({'name': 'RCUK', 'contents': 263, 'documents': 140})
|
||||
|
@ -912,8 +912,8 @@ class GetDocSamplesHandler(BaseHandler):
|
|||
data = {}
|
||||
doc_samples = []
|
||||
doc_samples.append({'name': 'Egi', 'documents': 104})
|
||||
doc_samples.append({'name': 'Clarin', 'documents': 1023})
|
||||
doc_samples.append({'name': 'SNSF', 'documents': 140})
|
||||
doc_samples.append({'name': 'Clarin', 'documents': 7})
|
||||
doc_samples.append({'name': 'Wellcome Trust', 'documents': 250})
|
||||
doc_samples.append({'name': 'ARIADNE', 'documents': 502})
|
||||
doc_samples.append({'name': 'RCUK', 'documents': 104})
|
||||
doc_samples.append({'name': 'TARA', 'documents': 1023})
|
||||
|
@ -1043,11 +1043,9 @@ class ChooseDocSampleHandler(BaseHandler):
|
|||
if doc_sample == "Egi":
|
||||
sample_file_name = "static/egi_sample.tsv"
|
||||
elif doc_sample == "Clarin":
|
||||
sample_file_name = "static/clarin_docs.json"
|
||||
elif doc_sample == "Rcuk":
|
||||
sample_file_name = "static/rcuk_sample.tsv"
|
||||
elif doc_sample == "Arxiv":
|
||||
sample_file_name = "static/arxiv_sample.tsv"
|
||||
sample_file_name = "static/exampleClarinDocs.json"
|
||||
elif doc_sample == "Wellcome Trust":
|
||||
sample_file_name = "static/exampleWTDocs.json"
|
||||
else:
|
||||
self.set_status(400)
|
||||
self.write("No Doc sample with this name")
|
||||
|
@ -1158,13 +1156,13 @@ class RunMiningHandler(BaseHandler):
|
|||
contextmiddle = [r for r in cursor.execute(querygrantsize)][0][0]+1
|
||||
if 'contextprev' in mining_parameters and mining_parameters['contextprev'] != '':
|
||||
contextprev = int(mining_parameters['contextprev'])
|
||||
if contextprev < 0 or contextprev > 20:
|
||||
if contextprev < 0 or contextprev > 50:
|
||||
self.set_status(400)
|
||||
self.write("Context size must be in its limits...")
|
||||
return
|
||||
if 'contextnext' in mining_parameters and mining_parameters['contextnext'] != '':
|
||||
contextnext = int(mining_parameters['contextnext'])
|
||||
if contextnext < 0 or contextnext > 20:
|
||||
if contextnext < 0 or contextnext > 50:
|
||||
self.set_status(400)
|
||||
self.write("Context size must be in its limits...")
|
||||
return
|
||||
|
@ -1231,11 +1229,11 @@ class RunMiningHandler(BaseHandler):
|
|||
data['negwords'].append(key)
|
||||
neg_set += "0"
|
||||
if pos_set != '' and neg_set != '':
|
||||
conf = ", ({0} - {1})".format(pos_set, neg_set)
|
||||
conf = ", ({0} - ({1}))".format(pos_set, neg_set)
|
||||
elif pos_set != '':
|
||||
conf = ", {0}".format(pos_set)
|
||||
elif neg_set != '':
|
||||
conf = ", -{0}".format(neg_set)
|
||||
conf = ", -({0})".format(neg_set)
|
||||
if conf != '':
|
||||
conf += ' as conf'
|
||||
whr_conf = 'and conf>=0'
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue