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

fixed root dependency search and added a vocabulary check page

parent be5f5398
{
"name": "mcClient",
"version": "0.1.7",
"version": "0.1.8",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
......
......@@ -17,6 +17,7 @@ import {PreviewPageModule} from "../pages/preview/preview.module";
import {AuthorPageModule} from "../pages/author/author.module";
import {HelperProvider} from '../providers/helper/helper';
import {FeedbackPageModule} from "../pages/feedback/feedback.module";
import {VocabularyCheckPageModule} from "../pages/vocabulary-check/vocabulary-check.module";
// The translate loader needs to know where to load i18n files
// in Ionic's static asset pipeline.
......@@ -53,7 +54,8 @@ class CustomErrorHandler extends IonicErrorHandler {
CorpusDetailPageModule,
FeedbackPageModule,
PreviewPageModule,
ShowTextPageModule
ShowTextPageModule,
VocabularyCheckPageModule
],
bootstrap: [IonicApp],
entryComponents: [
......
......@@ -6,6 +6,7 @@ import {ExerciseProvider} from "../../providers/exercise/exercise";
import {TranslateService} from "@ngx-translate/core";
import {FeedbackPage} from "../feedback/feedback";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {VocabularyCheckPage} from "../vocabulary-check/vocabulary-check";
@Component({
selector: 'page-home',
......@@ -28,6 +29,6 @@ export class HomePage {
}
async test() {
let g = 0;
this.navCtrl.push(VocabularyCheckPage).then();
}
}
......@@ -47,7 +47,7 @@ export class PreviewPage {
let search_values: string[] = this.exerciseProvider.exercise.queryItems.map(query => query.phenomenon + "=" + query.values.join("|"));
// TODO: change the corpus title to something meaningful, e.g. concatenate user ID and wanted exercise title
formData.append("title", this.exerciseProvider.createGuid());
formData.append("text", this.corpusProvider.currentText);
formData.append("text", this.corpusProvider.currentUrn);
formData.append("type", MoodleExerciseType[this.exerciseProvider.exercise.type]);
formData.append("type_translation", this.exerciseProvider.exercise.typeTranslation);
formData.append("search_values", JSON.stringify(search_values));
......
......@@ -16,6 +16,7 @@ import {QueryMC} from "../../models/queryMC";
import {AnnisResponse} from "../../models/annisResponse";
import {NodeMC} from "../../models/nodeMC";
import {LinkMC} from "../../models/linkMC";
import {nonPageFileManipulation} from "@ionic/app-scripts/dist/generators/util";
/**
* Generated class for the ShowTextPage page.
......@@ -39,7 +40,6 @@ export class ShowTextPage {
public ObjectKeys = Object.keys;
public FeedbackPage = FeedbackPage;
public emptyQueryValueString: string;
public queryValues: { [index: number]: string | string[] };
constructor(public navCtrl: NavController, public navParams: NavParams,
public corpusProvider: CorpusProvider,
......@@ -121,13 +121,19 @@ export class ShowTextPage {
existingValue = this.exerciseProvider.phenomenonMap[Phenomenon.partOfSpeech][2][pos];
this.exerciseProvider.phenomenonMap[Phenomenon.partOfSpeech][2][pos] = (existingValue ? existingValue : 0) + 1;
});
ar.graph.links.filter(x => x.annis_component_type === "Pointing").forEach((link: LinkMC) => {
let pointingLinks: LinkMC[] = ar.graph.links.filter(x => x.annis_component_type === "Pointing");
pointingLinks.forEach((link: LinkMC) => {
let dep: DependencyValue = this.corpusProvider.dependencyMap[link.udep_deprel];
if (dep) {
let existingValue = this.exerciseProvider.phenomenonMap[Phenomenon.dependency][2][dep];
this.exerciseProvider.phenomenonMap[Phenomenon.dependency][2][dep] = (existingValue ? existingValue : 0) + 1;
}
});
// need to add root dependencies manually because they are tricky to handle
let nodeIds: string[] = ar.graph.nodes.map(x => x.id);
let nodesWithDependencySet: Set<string> = new Set<string>(pointingLinks.map(x => x.target));
let rootNodeIds: string[] = nodeIds.filter(x => !nodesWithDependencySet.has(x));
this.exerciseProvider.phenomenonMap[Phenomenon.dependency][2][DependencyValue.root] = rootNodeIds.length;
this.exerciseProvider.annisResponse = ar;
}
}
<!--
Generated template for the VocabularyCheckPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<ion-title>Vokabelabgleich</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content padding>
<h1>Anfragekorpus</h1>
<h6>Cicero: Letters to his brother Quintus</h6>
<h1>Referenzvokabular</h1>
<h6>PERSEUS-Korpus, 500 häufigste Wörter</h6>
<h1>gewünschte Übereinstimmung</h1>
<h6>80%</h6>
<h1>gewünschte Anzahl der Sätze</h1>
<h6>10</h6>
<h1>Ranking</h1>
<h5>1. Platz: 2.3.2-2.3.6</h5>
<h6>&nbsp;&nbsp;&nbsp;&nbsp;9 Sätze, 84% Übereinstimmung</h6>
<h5>2. Platz: 1.1.1-1.1.5</h5>
<h6>&nbsp;&nbsp;&nbsp;&nbsp;11 Sätze, 78% Übereinstimmung</h6>
<h5>3. Platz: 5.3.4-5.3.8</h5>
<h6>&nbsp;&nbsp;&nbsp;&nbsp;10 Sätze, 75% Übereinstimmung</h6>
</ion-content>
import {NgModule} from '@angular/core';
import {IonicPageModule} from 'ionic-angular';
import {VocabularyCheckPage} from './vocabulary-check';
import {TranslateModule} from "@ngx-translate/core";
@NgModule({
declarations: [
VocabularyCheckPage,
],
imports: [
IonicPageModule.forChild(VocabularyCheckPage),
TranslateModule.forChild()
],
})
export class VocabularyCheckPageModule {
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
/**
* Generated class for the VocabularyCheckPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-vocabulary-check',
templateUrl: 'vocabulary-check.html',
})
export class VocabularyCheckPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad VocabularyCheckPage');
}
}
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