<commit_before>/**
 * Created by <NAME> (rfbaumgartner) on 24.07.17.
 */
import { Component, EventEmitter, Input, Output } from '@angular/core';

@Component({
  moduleId: module.id,
  selector: 'rae-fassung-diplomatisch',
  templateUrl: 'fassung-diplomatisch.component.html'
})
export class FassungDiplomatischComponent {

  @Input() pageIRIs: any;

  @Output() pictureReduced = new EventEmitter();
  @Output() pictureIncreased = new EventEmitter();

  gewaehlteSchicht: string = 'schicht0';

  oneTranscription = 'http://rdfh.ch/kuno-raeber/fURAeQjIQnuUI2j3yeQh2A';

  // TODO: sort pages by seqnum, find picture id and transcription id per page.

}<commit_msg>start binding pages to transcriptions<commit_after>/**
 * Created by <NAME> (rfbaumgartner) on 24.07.17.
 */
import { Component, EventEmitter, Input, Output, OnChanges } from '@angular/core';
import { Http } from '@angular/http';

@Component({
  moduleId: module.id,
  selector: 'rae-fassung-diplomatisch',
  templateUrl: 'fassung-diplomatisch.component.html'
})
export class FassungDiplomatischComponent implements OnChanges {

  @Input() pageIRIs: any;

  @Output() pictureReduced = new EventEmitter();
  @Output() pictureIncreased = new EventEmitter();

  pages: Array<any>;
  gewaehlteSchicht: string = 'schicht0';


  oneTranscription = 'http://rdfh.ch/kuno-raeber/fURAeQjIQnuUI2j3yeQh2A';

  private sub: any;

  constructor(private http: Http) {}

  ngOnChanges(){
    if (this.pageIRIs) {

      for (let i = 0; i < this.pageIRIs.length; i++) {
        this.pages.push({'diplIRI': '', 'pagenumber': '', 'picIRI': ''});

        this.sub = this.http.get('http://knora.nie-ine.ch/v1/resources/' + this.pageIRIs[ i ])
          .map(results => results.json())
          .subscribe(res =>{
            this.pages[ i ][ 'pagenumber' ] = res.props[ 'http://www.knora.org/ontology/work#hasPageNumber' ].values[ 0 ].utf8str;
            for (let j = 0; j < res.incoming.length; j++) {
              if (res.incoming[ j ].ext_res_id.pid === 'http://www.knora.org/ontology/text#isDiplomaticTranscriptionOfTextOnPage') {
                this.pages[ i ][ 'diplIRI' ] = res.incoming[ j ].ext_res_id.pid;
              }
            }
          });
      }
    }
  }

  // TODO: sort pages by seqnum, find picture id and transcription id per page.

}
{'fraction_non_alphanumeric': 0.15221162185602774, 'fraction_numerical': 0.010841283607979185, 'mean_word_length': 3.352830188679245, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1222108', 'n_tokens_mistral': 835, 'n_tokens_neox': 801, 'n_words': 171}