Commit 230c5921 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

some minor improvements; users can now choose smaller parts of texts, based on sentence boundaries

parent 023c59f0
{
"name": "mcClient",
"version": "0.2.6",
"version": "0.2.9",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
......
......@@ -9,6 +9,9 @@
<ion-navbar>
<ion-title>{{corpusProvider.currentAuthor.name}}</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(HomePage)">
<ion-icon name="home"></ion-icon>
</button>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
......
......@@ -6,6 +6,7 @@ import {TranslateService} from "@ngx-translate/core";
import {HttpClient} from "@angular/common/http";
import {TextRangePage} from "../text-range/text-range";
import {FeedbackPage} from "../feedback/feedback";
import {HomePage} from "../home/home";
/**
* Generated class for the AuthorDetailPage page.
......@@ -22,6 +23,7 @@ import {FeedbackPage} from "../feedback/feedback";
export class AuthorDetailPage {
FeedbackPage = FeedbackPage;
HomePage = HomePage;
constructor(public navCtrl: NavController, public navParams: NavParams,
public corpusProvider: CorpusProvider,
......
......@@ -4,6 +4,9 @@
{{ 'AUTHOR_SELECT' | translate }}
</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(HomePage)">
<ion-icon name="home"></ion-icon>
</button>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
......
......@@ -6,7 +6,7 @@ import {Author} from "../../models/author";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {AuthorDetailPage} from "../author-detail/author-detail";
import {FeedbackPage} from "../feedback/feedback";
import {VocabularyCheckPage} from "../vocabulary-check/vocabulary-check";
import {HomePage} from "../home/home";
/**
* Generated class for the AuthorPage page.
......@@ -23,6 +23,7 @@ import {VocabularyCheckPage} from "../vocabulary-check/vocabulary-check";
export class AuthorPage {
public authorsDisplayed: Author[];
FeedbackPage = FeedbackPage;
HomePage = HomePage;
constructor(public navCtrl: NavController,
public translate: TranslateService,
......
......@@ -9,6 +9,9 @@
<ion-navbar>
<ion-title>{{ 'PREVIEW' | translate }}</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(HomePage)">
<ion-icon name="home"></ion-icon>
</button>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
......@@ -30,7 +33,9 @@
<br>
<br>
<!-- Do not use non-breaking whitespaces (&nbsp;). If you do, some browsers will start breaking lines on a character basis (after a resize occurred), which results in single words being cut into pieces at the end of a line. Use &#32; instead. -->
<div *ngFor="let node of exerciseProvider.annisResponse?.graph.nodes">{{node.annis_tok}}&#32;</div>
<div *ngFor="let node of exerciseProvider.annisResponse?.graph.nodes">{{ nodeIdSet.has(node.id) ?
"_".repeat(maxGapLength) : node.annis_tok }}&#32;
</div>
</div>
<ng-template #matching>
<ion-grid>
......
......@@ -10,6 +10,8 @@ import {FeedbackPage} from "../feedback/feedback";
import {HelperProvider} from "../../providers/helper/helper";
import {SolutionElement} from "../../models/solutionElement";
import {Solution} from "../../models/solution";
import {HomePage} from "../home/home";
import {NodeMC} from "../../models/nodeMC";
/**
* Generated class for the PreviewPage page.
......@@ -24,6 +26,7 @@ import {Solution} from "../../models/solution";
templateUrl: 'preview.html',
})
export class PreviewPage {
HomePage = HomePage;
public ExerciseType = ExerciseType;
public FileType = FileType;
public FeedBackPage = FeedbackPage;
......@@ -31,6 +34,9 @@ export class PreviewPage {
public ObjectKeys = Object.keys;
public solutionsShuffled: Solution[];
public areSolutionsShuffled: boolean = false;
public currentNodes: NodeMC[] = [];
public maxGapLength: number = 0;
public nodeIdSet: Set<string> = new Set<string>();
constructor(public navCtrl: NavController, public navParams: NavParams,
public http: HttpClient,
......@@ -38,6 +44,7 @@ export class PreviewPage {
public translateService: TranslateService,
public corpusProvider: CorpusProvider) {
this.solutionsShuffled = [];
this.currentNodes = [];
if (!this.exerciseProvider.annisResponse.solutions) {
this.getExerciseData();
}
......@@ -75,10 +82,8 @@ export class PreviewPage {
private processAnnisResponse(ar: AnnisResponse) {
if (this.exerciseProvider.exercise.type === ExerciseType.cloze) {
let maxGapLength: number = Math.max.apply(Math, ar.solutions.map(x => x.target.content.length));
Array.from(new Set(ar.solutions.map(value => value.target.salt_id))).forEach((saltID: string) => {
this.exerciseProvider.annisResponse.graph.nodes.find(node => node.id === saltID).annis_tok = "_".repeat(maxGapLength);
});
this.maxGapLength = Math.max.apply(Math, ar.solutions.map(x => x.target.content.length));
this.nodeIdSet = new Set(ar.solutions.map(x => x.target.salt_id));
}
let targets: SolutionElement[] = ar.solutions.map(x => x.target).sort(() => {
// TODO: for really random shuffling, implement the Fisher-Yates Shuffle algorithm
......
......@@ -8,9 +8,12 @@
<ion-navbar>
<ion-title>{{corpusProvider.currentCorpus.author}}: {{corpusProvider.currentCorpus.title}}
{{corpusProvider.currentTextRange.start + "-" + corpusProvider.currentTextRange.end}}
{{corpusProvider.currentUrn.split(":")[corpusProvider.currentUrn.split(":").length - 1]}}
</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(HomePage)">
<ion-icon name="home"></ion-icon>
</button>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
......
......@@ -17,6 +17,7 @@ import {QueryMC} from "../../models/queryMC";
import {AnnisResponse} from "../../models/annisResponse";
import {NodeMC} from "../../models/nodeMC";
import {LinkMC} from "../../models/linkMC";
import {HomePage} from "../home/home";
/**
* Generated class for the ShowTextPage page.
......@@ -31,6 +32,7 @@ import {LinkMC} from "../../models/linkMC";
templateUrl: 'show-text.html',
})
export class ShowTextPage {
HomePage = HomePage;
public ExerciseType = ExerciseType;
public ExerciseTypeTranslation = ExerciseTypeTranslation;
public Phenomenon = Phenomenon;
......@@ -75,6 +77,7 @@ export class ShowTextPage {
}
else {
this.exerciseProvider.annisResponse.solutions = null;
// TODO: DISABLE HELPERPROVIDER ISVOCABULARYCHECK
this.navCtrl.push(PreviewPage).then();
}
}
......
......@@ -9,6 +9,9 @@
<ion-navbar>
<ion-title>{{corpusProvider.currentAuthor.name}}: {{corpusProvider.currentCorpus.title}}</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(HomePage)">
<ion-icon name="home"></ion-icon>
</button>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
......
......@@ -10,6 +10,7 @@ import {FeedbackPage} from "../feedback/feedback";
import {BaseInput} from "ionic-angular/es2015/util/base-input";
import {VocabularyCheckPage} from "../vocabulary-check/vocabulary-check";
import {HelperProvider} from "../../providers/helper/helper";
import {HomePage} from "../home/home";
/**
* Generated class for the CorpusDetailPage page.
......@@ -36,6 +37,7 @@ export class TextRangePage {
public isTextRangeCheckRunning: boolean = false;
public showStartList = false;
public showEndList = false;
HomePage = HomePage;
constructor(public navCtrl: NavController, public navParams: NavParams,
public corpusProvider: CorpusProvider,
......
......@@ -8,6 +8,9 @@
<ion-navbar>
<ion-title>{{ 'VOCABULARY_CHECK' | translate }}</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(HomePage).then()">
<ion-icon name="home"></ion-icon>
</button>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
......@@ -32,7 +35,8 @@
<ion-row>
<ion-col>
<ion-label>{{ 'VOCABULARY_REFERENCE_CORPUS' | translate }}</ion-label>
<ion-select [(ngModel)]="vocProvider.currentReferenceVocabulary" name="currentReferenceVocabulary" (ionChange)="updateReferenceRange()">
<ion-select [(ngModel)]="vocProvider.currentReferenceVocabulary" name="currentReferenceVocabulary"
(ionChange)="updateReferenceRange()">
<ion-option *ngFor="let key of ObjectKeys(vocProvider.refVocMap)" [value]=VocabularyCorpus[key]>{{
VocabularyCorpusTranslation[key] | translate}} ({{vocProvider.refVocMap[key].totalCount}}
{{'VOCABULARY_ITEMS' | translate}})
......@@ -91,7 +95,11 @@
</ion-row>
<div *ngIf="vocProvider.ranking && vocProvider.ranking.length > 0">
<ion-row *ngFor="let rank of vocProvider.ranking">
<ion-col>{{rank[0].id + "-" + rank[rank.length - 1].id}}</ion-col>
<ion-col>
<div class="link" (click)="showText(rank)">
{{rank[0].id + "-" + rank[rank.length - 1].id}}
</div>
</ion-col>
<ion-col>{{Math.round(getMean(rank)) + "%"}}</ion-col>
</ion-row>
</div>
......
page-vocabulary-check {
.link {
color: blue;
text-decoration: underline;
cursor: pointer;
}
}
......@@ -8,6 +8,9 @@ import {AuthorPage} from "../author/author";
import {HelperProvider} from "../../providers/helper/helper";
import {HttpClient} from "@angular/common/http";
import {Sentence} from "../../models/sentence";
import {FeedbackPage} from "../feedback/feedback";
import {HomePage} from "../home/home";
import {ShowTextPage} from "../show-text/show-text";
/**
* Generated class for the VocabularyCheckPage page.
......@@ -22,6 +25,8 @@ import {Sentence} from "../../models/sentence";
templateUrl: 'vocabulary-check.html',
})
export class VocabularyCheckPage {
FeedbackPage = FeedbackPage;
HomePage = HomePage;
invalidSentenceCountString: string;
ObjectKeys = Object.keys;
VocabularyCorpus = VocabularyCorpus;
......@@ -87,10 +92,6 @@ export class VocabularyCheckPage {
return sentences.map(x => x.matching_degree).reduce((a, b) => a + b) / sentences.length;
}
updateReferenceRange() {
this.vocProvider.frequencyUpperBound = this.vocProvider.refVocMap[this.vocProvider.currentReferenceVocabulary].hasFrequencyOrder ? 500 : this.vocProvider.refVocMap[this.vocProvider.currentReferenceVocabulary].possibleSubcounts[0];
}
private processSentences(sentences: Sentence[]) {
if (sentences.length > this.vocProvider.desiredSentenceCount) {
this.currentRankingUnits.push([]);
......@@ -120,4 +121,13 @@ export class VocabularyCheckPage {
this.vocProvider.currentSentences = sentences;
this.vocProvider.ranking = this.currentRankingUnits;
}
showText(rank: Sentence[]) {
this.corpusProvider.currentUrn += `@${rank[0].id}-${rank[rank.length - 1].id}`;
this.navCtrl.push(ShowTextPage).then();
}
updateReferenceRange() {
this.vocProvider.frequencyUpperBound = this.vocProvider.refVocMap[this.vocProvider.currentReferenceVocabulary].hasFrequencyOrder ? 500 : this.vocProvider.refVocMap[this.vocProvider.currentReferenceVocabulary].possibleSubcounts[0];
}
}
Supports Markdown
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