Skip to content

Commit 2de7ecd

Browse files
committed
Added solution examples
1 parent b03aeea commit 2de7ecd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

labs/03-nl-with-compromise/src/solutions.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,42 @@ var doc = helper.getDoc();
44
let result;
55

66
// solution 1: Wieviele Sätze hat der Text?
7+
// --> 417
78
result = doc.sentences().length;
89
helper.outputResult(1, result);
910

1011
// solution 2: Wieviele Verben?
12+
// --> 572
1113
result = doc.verbs().length;
1214
helper.outputResult(2, result);
1315

1416
// solution 3: Verwandle den dritten Satz in die Vergangenheit.
17+
// --> Hey, what were you doing?
1518
result = doc.sentences(2).toPastTense().out('text');
1619
helper.outputResult(3, result);
1720

1821
// solution 4: Liste die Top 50 Verben dieses Textes auf.
22+
// --> is: 50; are: 26; am: 16; know: 14; ...
1923
result = doc.verbs().out('frequency').slice(0,50);
2024
helper.outputFrequencyResult(4, result);
2125

2226
// 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?
2332
result = doc.questions().slice(0,5).out('text');
2433
helper.outputResult(5, result);
2534

2635
// 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
2744
result = doc.people().sort('frequency').out('frequency').filter((m,i) => m.count >= 2);
2845
helper.outputFrequencyResult(6, result);

0 commit comments

Comments
 (0)