Commit 14e5fd94 authored by Konstantin Schulz's avatar Konstantin Schulz

fixed caching for most recent setup when creating new exercises

parent b6a0c221
Pipeline #13138 passed with stages
in 3 minutes and 8 seconds
......@@ -73,7 +73,8 @@ class TextComplexityService:
"n_clause": TextComplexityService.how_many_main_clauses,
"n_subclause": TextComplexityService.how_many_sub_clauses,
"n_abl_abs": TextComplexityService.how_many_ablativi_absoluti,
"n_gerund": TextComplexityService.how_many_gerunds, "n_inf": TextComplexityService.how_many_infinitives,
"n_gerund": TextComplexityService.how_many_gerunds,
"n_inf": TextComplexityService.how_many_infinitive_constructions,
"n_part": TextComplexityService.how_many_participles}
@staticmethod
......@@ -93,14 +94,16 @@ class TextComplexityService:
""" Gives back the number of gerunds in the text. """
aql: str = "feats=/.*VerbForm=Ger.*/"
node_ids: List[str] = CorpusService.find_matches(urn, aql, is_csm=is_csm)
# TODO: gerundivo
# TODO: gerundivo (VerbForm=Gdv.*)
return len(node_ids)
@staticmethod
def how_many_infinitives(urn: str, is_csm: bool) -> int:
""" Gives back the number of infinitives in the text. """
def how_many_infinitive_constructions(urn: str, is_csm: bool) -> int:
""" Gives back the number of infinitive constructions (AcI, NcI) in the text. """
# get Nominativus cum Infinitivo
aql: str = 'feats=/.*Inf.*/ ->dep[deprel=/(nsubj|nsubj:pass|csubj|csubj:pass)/] feats=/.*Acc.*/'
node_ids: List[str] = CorpusService.find_matches(urn, aql, is_csm=is_csm)
# get Accusativus cum Infinitivo
aql = 'feats=/.*Acc.*/ ->dep[deprel=/(xcomp|ccomp)/] feats=/.*Inf.*/'
node_ids += CorpusService.find_matches(urn, aql, is_csm=is_csm)
return round(len(node_ids) / 2)
......
......@@ -431,8 +431,13 @@ export class CorpusService {
if (saveToCache) {
this.helperService.applicationState.pipe(take(1)).subscribe((as: ApplicationState) => {
as.currentSetup.annisResponse = null;
as.mostRecentSetup.currentUrn = this.currentUrn;
as.mostRecentSetup.annisResponse = ar;
as.mostRecentSetup = {
annisResponse: ar,
currentUrn: this.currentUrn,
currentAuthor: this.currentAuthor,
currentCorpus: this.currentCorpusCache,
currentTextRange: this.currentTextRangeCache
};
this.helperService.saveApplicationState(as).then(() => {
as.currentSetup.currentUrn = this.currentUrn;
as.currentSetup.annisResponse = ar;
......
......@@ -39,7 +39,7 @@ export class ShowTextPage implements OnInit {
n_punct: 'TEXT_COMPLEXITY_PUNCTUATION_COUNT',
n_clause: 'TEXT_COMPLEXITY_CLAUSE_COUNT',
n_subclause: 'TEXT_COMPLEXITY_SUBCLAUSE_COUNT',
n_inf: 'TEXT_COMPLEXITY_INFINITIVE_COUNT',
n_inf: 'TEXT_COMPLEXITY_INFINITIVE_CONSTRUCTION_COUNT',
n_part: 'TEXT_COMPLEXITY_PARTICIPLE_COUNT',
n_gerund: 'TEXT_COMPLEXITY_GERUND_COUNT',
n_abl_abs: 'TEXT_COMPLEXITY_ABLATIVI_ABSOLUTI_COUNT'
......
......@@ -322,7 +322,7 @@
"TEXT_COMPLEXITY_CLAUSE_COUNT": "Anzahl der Hauptsätze",
"TEXT_COMPLEXITY_DOCUMENTATION": "Das Gesamtmaß berücksichtigt alle hier gezeigten Einzelwerte gleichermaßen. Die lexikalische Dichte berechnet sich aus dem Verhältnis der Anzahl der differenten Inhaltswörter (z.B. rex) zur Gesamtlänge des Textes.",
"TEXT_COMPLEXITY_GERUND_COUNT": "Anzahl der Gerundien",
"TEXT_COMPLEXITY_INFINITIVE_COUNT": "Anzahl der Infinitive",
"TEXT_COMPLEXITY_INFINITIVE_CONSTRUCTION_COUNT": "Anzahl der Infinitivkonstruktionen",
"TEXT_COMPLEXITY_LEXICAL_DENSITY": "Lexikalische Dichte",
"TEXT_COMPLEXITY_PART_OF_SPEECH_COUNT": "Anzahl verschiedener Wortarten",
"TEXT_COMPLEXITY_PARTICIPLE_COUNT": "Anzahl der Partizipien",
......
......@@ -322,7 +322,7 @@
"TEXT_COMPLEXITY_CLAUSE_COUNT": "Main clause count",
"TEXT_COMPLEXITY_DOCUMENTATION": "The overall measure for text complexity takes into account all the single values presented here in equal proportions. Word and sentence counts are used with predefined ranges of 9 steps (0 to 10, 10 to 50 etc.). Lexical density is measured by comparing the number of unique content words to the overall length of the text.",
"TEXT_COMPLEXITY_GERUND_COUNT": "Gerund count",
"TEXT_COMPLEXITY_INFINITIVE_COUNT": "Infinitive count",
"TEXT_COMPLEXITY_INFINITIVE_CONSTRUCTION_COUNT": "Infinitive construction count",
"TEXT_COMPLEXITY_LEXICAL_DENSITY": "Lexical density",
"TEXT_COMPLEXITY_PART_OF_SPEECH_COUNT": "Number of different parts of speech",
"TEXT_COMPLEXITY_PARTICIPLE_COUNT": "Participle count",
......
......@@ -15,7 +15,7 @@ export default {
backendBaseUrl: '',
bambergCoreVocabularyUrl: 'https://www.ccbuchner.de/reihe-0-0/adeo-53/',
callidusProjectUrl: 'https://www.projekte.hu-berlin.de/de/callidus',
developerMailTo: 'mailto:sulzkons@hu-berlin.de',
developerMailTo: 'mailto:sulzkons@hu-berlin.de?subject=[CALLIDUS-Software]',
frontendBaseUrl: '',
frontendExercisePage: 'exercise',
intervalCorporaUpdate: 1209600000,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment