Commit e9037ab6 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

added text complexity information in the showTextPage

parent 54b8d43d
{
"name": "mc_frontend",
"version": "1.1.4",
"version": "1.1.5",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
......
......@@ -401,7 +401,9 @@ export class CorpusService {
if (this.currentText) {
return resolve();
}
this.getText(!HelperService.mostRecentSetup.annisResponse).then(() => {
const saveToCache: boolean = !HelperService.mostRecentSetup.annisResponse ||
!HelperService.mostRecentSetup.annisResponse.nodes.length;
this.getText(saveToCache).then(() => {
return resolve();
}, () => {
return reject();
......
......@@ -100,7 +100,7 @@
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-col class="toggle-menu">
<button *ngIf="showFeedback; else dropright" (click)="showFeedback = !showFeedback">
<ion-icon name="arrow-dropdown"></ion-icon>
</button>
......@@ -109,7 +109,7 @@
<ion-icon name="arrow-dropright"></ion-icon>
</button>
</ng-template>
<h2>{{ 'EXERCISE_FEEDBACK' | translate }}</h2>
<h2 (click)="showFeedback = !showFeedback">{{ 'EXERCISE_FEEDBACK' | translate }}</h2>
</ion-col>
</ion-row>
<div *ngIf="showFeedback">
......
h2 {
margin-top: 0;
display: inline-block;
}
.matching {
border: 2px solid lightgray;
box-sizing: content-box;
......
......@@ -3,6 +3,7 @@ import {Solution} from 'src/app/models/solution';
import {LinkMC} from 'src/app/models/linkMC';
import {NodeMC} from 'src/app/models/nodeMC';
import {FrequencyItem} from 'src/app/models/frequencyItem';
import {TextComplexity} from 'src/app/models/textComplexity';
export class AnnisResponse {
public directed: boolean;
......@@ -12,6 +13,7 @@ export class AnnisResponse {
public multigraph: boolean;
public nodes: NodeMC[];
public solutions: Solution[];
public text_complexity: TextComplexity;
public uri: string;
constructor(init?: Partial<AnnisResponse>) {
......
/* tslint:disable:variable-name */
export class TextComplexity {
public avg_w_len: number;
public avg_w_per_sent: number;
public lex_den: number;
public n_abl_abs: number;
public n_clause: number;
public n_gerund: number;
public n_inf: number;
public n_part: number;
public n_punct: number;
public n_sent: number;
public n_subclause: number;
public n_types: number;
public n_w: number;
public pos: number;
constructor(init?: Partial<TextComplexity>) {
Object.assign(this, init);
}
}
......@@ -61,12 +61,35 @@
<a style="display: none" id="download" href="" download>Download</a>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="toggle-menu">
<button *ngIf="showTextComplexity; else dropright" (click)="showTextComplexity = !showTextComplexity">
<ion-icon name="arrow-dropdown"></ion-icon>
</button>
<ng-template #dropright>
<button (click)="showTextComplexity = !showTextComplexity">
<ion-icon name="arrow-dropright"></ion-icon>
</button>
</ng-template>
<h2 (click)="showTextComplexity = !showTextComplexity">{{ 'TEXT_COMPLEXITY' | translate }}</h2>
</ion-col>
</ion-row>
<div *ngIf="showTextComplexity">
<ion-row>
<ion-col *ngFor="let key of ObjectKeys(textComplexityMap)">
<label>
<span>{{ textComplexityMap[key] | translate }}</span>
<span>{{corpusService.annisResponse.text_complexity[key]}}</span>
</label>
</ion-col>
</ion-row>
</div>
<ion-row>
<ion-col class="text">
<div *ngIf="highlightOOV; else noOOV">
<!-- do not add whitespace/newline etc. between the span elements! -->
<span *ngFor="let node of corpusService.annisResponse.nodes; index as i"><span class="tok"
[class.oov]="node.is_oov">{{node.annis_tok}}</span>{{ getWhiteSpace(i) }}</span>
[class.oov]="node.is_oov">{{node.annis_tok}}</span>{{ getWhiteSpace(i) }}</span>
</div>
<ng-template #noOOV>
<span class="tok">{{corpusService.currentText}}</span>
......
......@@ -22,6 +22,23 @@ export class ShowTextPage {
public text: string;
public urlBase: string;
public isDownloading = false;
public showTextComplexity = false;
public textComplexityMap = {
n_w: 'TEXT_COMPLEXITY_WORD_COUNT',
n_sent: 'TEXT_COMPLEXITY_SENTENCE_COUNT',
avg_w_per_sent: 'TEXT_COMPLEXITY_AVERAGE_SENTENCE_LENGTH',
avg_w_len: 'TEXT_COMPLEXITY_AVERAGE_WORD_LENGTH',
n_types: 'TEXT_COMPLEXITY_TYPE_COUNT',
pos: 'TEXT_COMPLEXITY_PART_OF_SPEECH_COUNT',
lex_den: 'TEXT_COMPLEXITY_LEXICAL_DENSITY',
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_part: 'TEXT_COMPLEXITY_PARTICIPLE_COUNT',
n_gerund: 'TEXT_COMPLEXITY_GERUND_COUNT',
n_abl_abs: 'TEXT_COMPLEXITY_ABLATIVI_ABSOLUTI_COUNT'
};
constructor(public navCtrl: NavController,
public corpusService: CorpusService,
......
......@@ -153,6 +153,21 @@
"TEST_MODULE_PROGRESS_PART": "Fortschritt: Teil",
"TEST_MODULE_SEND_DATA": "Daten senden",
"TEST_REPEAT": "Einheit wiederholen",
"TEXT_COMPLEXITY": "Textkomplexität",
"TEXT_COMPLEXITY_ABLATIVI_ABSOLUTI_COUNT": "Anzahl der Ablativi Absoluti",
"TEXT_COMPLEXITY_AVERAGE_SENTENCE_LENGTH": "Wörter pro Satz (Ø)",
"TEXT_COMPLEXITY_AVERAGE_WORD_LENGTH": "Wortlänge (Ø)",
"TEXT_COMPLEXITY_CLAUSE_COUNT": "Anzahl der Hauptsätze",
"TEXT_COMPLEXITY_GERUND_COUNT": "Anzahl der Gerundien",
"TEXT_COMPLEXITY_INFINITIVE_COUNT": "Anzahl der Infinitive",
"TEXT_COMPLEXITY_LEXICAL_DENSITY": "Vokabeldichte",
"TEXT_COMPLEXITY_PART_OF_SPEECH_COUNT": "Anzahl verschiedener Wortarten",
"TEXT_COMPLEXITY_PARTICIPLE_COUNT": "Anzahl der Partizipien",
"TEXT_COMPLEXITY_PUNCTUATION_COUNT": "Anzahl der Satzzeichen",
"TEXT_COMPLEXITY_SENTENCE_COUNT": "Anzahl der Sätze",
"TEXT_COMPLEXITY_SUBCLAUSE_COUNT": "Anzahl der Nebensätze",
"TEXT_COMPLEXITY_TYPE_COUNT": "Anzahl verschiedener Wortformen",
"TEXT_COMPLEXITY_WORD_COUNT": "Anzahl der Wörter",
"TEXT_SHOW_OOV": "Unbekannte Vokabeln markieren",
"TEXT_TOO_LONG": "Text zu lang, max. Wortzahl: ",
"TYPE": "Typ",
......
......@@ -153,6 +153,21 @@
"TEST_MODULE_PROGRESS_PART": "Progress: Part",
"TEST_MODULE_SEND_DATA": "Send data",
"TEST_REPEAT": "Repeat test",
"TEXT_COMPLEXITY": "Text complexity",
"TEXT_COMPLEXITY_ABLATIVI_ABSOLUTI_COUNT": "Number of Ablativi Absoluti",
"TEXT_COMPLEXITY_AVERAGE_SENTENCE_LENGTH": "Words per sentence (Ø)",
"TEXT_COMPLEXITY_AVERAGE_WORD_LENGTH": "Word length (Ø)",
"TEXT_COMPLEXITY_CLAUSE_COUNT": "Main clause count",
"TEXT_COMPLEXITY_GERUND_COUNT": "Gerund count",
"TEXT_COMPLEXITY_INFINITIVE_COUNT": "Infinitive count",
"TEXT_COMPLEXITY_LEXICAL_DENSITY": "Vocabulary density",
"TEXT_COMPLEXITY_PART_OF_SPEECH_COUNT": "Number of different parts of speech",
"TEXT_COMPLEXITY_PARTICIPLE_COUNT": "Participle count",
"TEXT_COMPLEXITY_PUNCTUATION_COUNT": "Punctuation mark count",
"TEXT_COMPLEXITY_SENTENCE_COUNT": "Sentence count",
"TEXT_COMPLEXITY_SUBCLAUSE_COUNT": "Subclause count",
"TEXT_COMPLEXITY_TYPE_COUNT": "Number of different word forms",
"TEXT_COMPLEXITY_WORD_COUNT": "Word count",
"TEXT_SHOW_OOV": "Highlight unknown vocabulary",
"TEXT_TOO_LONG": "Text too long, max. word count: ",
"TYPE": "Type",
......
......@@ -143,6 +143,12 @@
text-align: left;
}
.toggle-menu h2 {
margin-top: 0;
display: inline-block;
cursor: pointer;
}
.toolbar-left {
float: left;
max-width: 80%;
......
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