-
Notifications
You must be signed in to change notification settings - Fork 0
/
grammar.component.ts
103 lines (69 loc) · 3.74 KB
/
grammar.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { Component } from '@angular/core';
import { faVolumeHigh, faArrowRight, faHeart } from '@fortawesome/free-solid-svg-icons';
@Component({
selector: 'app-grammar',
templateUrl: './grammar.component.html',
styleUrls: ['./grammar.component.scss']
})
export class GrammarComponent {
faVolumeHigh = faVolumeHigh;
faArrowRight = faArrowRight;
faHeart = faHeart;
currentIndex = 0;
questions: any = [
{ question: "___ average, Tim drinks three cups of tea a day.", right: "On", wrong: "In" },
{ question: "It’s ___ likely that Sam will be the last to get here; he usually is!", right: "highly", wrong: "hardly" },
{ question: "Why do I have to go to bed so early? I’m not tired ___ all.", right: "at", wrong: "in" },
{ question: "I’m not sure Jack’s very eager ___ Claudia this evening!", right: "to see", wrong: "on seeing" },
{ question: "Ken is a very ___ man; he seems to love danger.", right: "incovenient", wrong: "daring" },
{ question: "For heavens’ ___ stop whistling, it’s driving me round the bend!", right: "sake", wrong: "fake" },
{ question: "I miss ___ to the beach every weekend; it used to be great fun.", right: "going", wrong: "to go" },
{ question: "I’m not afraid ___ your dog, I’m only shaking because it’s cold.", right: "of", wrong: "from" },
{ question: "She ___ me to go there again.", right: "forbade", wrong: "prevented" },
{ question: "I usually ___ asleep about ten minutes after turning off the lights.", right: "fall", wrong: "go" }
];
speak(word: string) {
var synth = window.speechSynthesis;
var utter = new SpeechSynthesisUtterance(word.replaceAll("_", ""))
// this.questions[i].timesHeard = (this.questions[i].timesHeard ?? 0) + 1;
var voice = synth.getVoices().filter(_ => _.lang.indexOf('en-') > -1)[2];
utter.voice = voice;
// utter.rate = 0.75;
synth.speak(utter)
}
continue() {
this.currentIndex++;
}
answer(i: number, answered: any) {
this.questions[i].answered = answered;
}
}
// import { Component } from '@angular/core';
// @Component({
// selector: 'app-grammar',
// templateUrl: './grammar.component.html',
// styleUrls: ['./grammar.component.scss']
// })
// export class GrammarComponent {
// questions = [
// { question: "___ average, Tim drinks three cups of tea a day.", right: "On", wrong: "In" },
// { question: "It’s ___ likely that Sam will be the last to get here; he usually is!", right: "highly", wrong: "hardly" },
// { question: "Why do I have to go to bed so early? I’m not tired ___ all.", right: "at", wrong: "in" },
// { question: "I’m not sure Jack’s very eager ___ Claudia this evening!", right: "to see", wrong: "on seeing" },
// { question: "Ken is a very ___ man; he seems to love danger.", right: "incovenient", wrong: "daring" },
// { question: "For heavens’ ___ stop whistling, it’s driving me round the bend!", right: "sake", wrong: "fake" },
// { question: "I miss ___ to the beach every weekend; it used to be great fun.", right: "going", wrong: "to go" },
// { question: "I’m not afraid ___ your dog, I’m only shaking because it’s cold.", right: "of", wrong: "from" },
// { question: "She ___ me to go there again.", right: "forbade", wrong: "prevented" },
// { question: "I usually ___ asleep about ten minutes after turning off the lights.", right: "fall", wrong: "go" }
// ]
// speak(speech: string) {
// speech = speech.replaceAll("_", "");
// var synth = window.speechSynthesis;
// var utter = new SpeechSynthesisUtterance(speech)
// var voice = synth.getVoices().filter(_ => _.lang.indexOf('en-') > -1)[2];
// utter.voice = voice;
// // utter.rate = 0.75;
// synth.speak(utter)
// }
// }