@@ -4,25 +4,42 @@ var doc = helper.getDoc();
4
4
let result ;
5
5
6
6
// solution 1: Wieviele Sätze hat der Text?
7
+ // --> 417
7
8
result = doc . sentences ( ) . length ;
8
9
helper . outputResult ( 1 , result ) ;
9
10
10
11
// solution 2: Wieviele Verben?
12
+ // --> 572
11
13
result = doc . verbs ( ) . length ;
12
14
helper . outputResult ( 2 , result ) ;
13
15
14
16
// solution 3: Verwandle den dritten Satz in die Vergangenheit.
17
+ // --> Hey, what were you doing?
15
18
result = doc . sentences ( 2 ) . toPastTense ( ) . out ( 'text' ) ;
16
19
helper . outputResult ( 3 , result ) ;
17
20
18
21
// solution 4: Liste die Top 50 Verben dieses Textes auf.
22
+ // --> is: 50; are: 26; am: 16; know: 14; ...
19
23
result = doc . verbs ( ) . out ( 'frequency' ) . slice ( 0 , 50 ) ;
20
24
helper . outputFrequencyResult ( 4 , result ) ;
21
25
22
26
// solution 5: Welches sind die ersten fünf Fragen des Textes?
27
+ // --> Hey, what are you doing?
28
+ // --> So what did you two do about it?
29
+ // --> But really, it does seem like this money could be put to better use?
30
+ // --> Are you serious?
31
+ // --> Now, how would you feel if we gave all the wedding money to charity and we just got married at City Hall?
23
32
result = doc . questions ( ) . slice ( 0 , 5 ) . out ( 'text' ) ;
24
33
helper . outputResult ( 5 , result ) ;
25
34
26
35
// solution 6: Liste alle Personen des Textes auf, die mindestens 2 mal vorkommen.
36
+ // --> bert: 10
37
+ // --> emma: 8
38
+ // --> ross: 6
39
+ // --> guy: 6
40
+ // --> joey: 4
41
+ // --> laura: 3
42
+ // --> monica: 2
43
+ // --> ernie: 2
27
44
result = doc . people ( ) . sort ( 'frequency' ) . out ( 'frequency' ) . filter ( ( m , i ) => m . count >= 2 ) ;
28
45
helper . outputFrequencyResult ( 6 , result ) ;
0 commit comments