-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment5.py
More file actions
714 lines (559 loc) · 25 KB
/
Copy pathassignment5.py
File metadata and controls
714 lines (559 loc) · 25 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
"""
Constituency and Dependency Parsing
====================================
This project covers parsing techniques in NLP:
- Constituency Tree Visualization
- CKY Parsing Algorithm Implementation
- Dependency Parsing with Stanford CoreNLP
- Ambiguous Sentence Analysis
"""
import nltk
from nltk import Tree
from nltk.grammar import CFG, Nonterminal
import warnings
warnings.filterwarnings('ignore')
def downloadNltkData():
"""Grab all the NLTK data packages we need for this to work."""
# these are the packages we'll be using throughout
requiredPackages = ['punkt', 'averaged_perceptron_tagger', 'large_grammars']
# loop through and download anything that's missing
for packageName in requiredPackages:
try:
# nltk stores different types of data in different folders
if packageName == 'punkt':
nltk.data.find(f'tokenizers/{packageName}')
elif packageName == 'averaged_perceptron_tagger':
nltk.data.find(f'taggers/{packageName}')
else:
nltk.data.find(f'grammars/{packageName}')
except LookupError:
# couldn't find it, so let's download it
print(f"Downloading {packageName}...")
nltk.download(packageName, quiet=True)
# ============================================================================
# TASK 1: Constituency Tree Visualization
# ============================================================================
def createConstituencyTree():
"""
Build a constituency tree for "Cat sat on the mat" using production rules.
Here's what we're working with:
S -> VP
VP -> NP V PP
NP -> DET ADJ N | DET N | N
PP -> P NP
Returns the completed parse tree as an nltk.Tree object.
"""
# alright, let's break down the sentence piece by piece
# Cat = noun, sat = verb, on = preposition, the = determiner, mat = noun
# we're building this tree from the bottom up
# first the leaves, then the branches, then the trunk
# "Cat" is just a noun by itself, so NP -> N
catNounPhrase = Tree('NP', [Tree('N', ['Cat'])])
# "the mat" uses the rule NP -> DET N
matNounPhrase = Tree('NP', [
Tree('DET', ['the']),
Tree('N', ['mat'])
])
# "on the mat" is a prepositional phrase: PP -> P NP
prepPhrase = Tree('PP', [
Tree('P', ['on']),
matNounPhrase
])
# now we put together the verb phrase: VP -> NP V PP
verbPhrase = Tree('VP', [
catNounPhrase,
Tree('V', ['sat']),
prepPhrase
])
# finally, the whole sentence: S -> VP
fullTree = Tree('S', [verbPhrase])
return fullTree
def visualizeConstituencyTree(parseTree, saveToFile=True):
"""
Display the constituency tree in a nice readable format.
Shows both text and pretty-printed versions.
"""
print("=" * 60)
print("TASK 1: Constituency Tree for 'Cat sat on the mat'")
print("=" * 60)
# let's show which production rules we actually used
print("\nProduction Rules Used:")
print(" S -> VP")
print(" VP -> NP V PP")
print(" NP -> N (for 'Cat')")
print(" PP -> P NP")
print(" NP -> DET N (for 'the mat')")
# show the raw tree structure first
print("\nTree Structure (text format):")
print(parseTree)
# now the pretty version that's easier to read
print("\nPretty Print:")
parseTree.pretty_print()
# give instructions for graphical display
# we skip the actual draw() call since it blocks the script
print("\nTo display graphical tree, run in Python shell:")
print(" >>> from assignment5 import createConstituencyTree")
print(" >>> tree = createConstituencyTree()")
print(" >>> tree.draw()")
print("\n(Skipping tree.draw() in script mode to avoid blocking)")
return parseTree
# ============================================================================
# TASK 2: CKY Parsing Algorithm Implementation
# ============================================================================
class CkyParser:
"""
CKY (Cocke-Kasami-Younger) Parsing Algorithm.
This is based on the algorithm from Jurafsky & Martin, Section 13.4.
It uses dynamic programming to efficiently parse sentences and
keeps track of back-pointers so we can reconstruct the parse trees.
"""
def __init__(self, inputGrammar):
"""Set up the parser with a grammar, converting it to CNF first."""
# keep the original around just in case we need it
self.originalGrammar = inputGrammar
# convert to Chomsky Normal Form - CKY only works with CNF
self.grammar = self._convertToChomskyNormalForm(inputGrammar)
# build lookup tables for faster parsing
self._buildGrammarIndices()
def _convertToChomskyNormalForm(self, inputGrammar):
"""
Convert the grammar to Chomsky Normal Form.
In CNF, every rule is either:
- A -> B C (two non-terminals)
- A -> a (one terminal)
This makes the CKY algorithm work properly.
"""
from nltk import CFG
from nltk.grammar import Production
# grab all the existing productions
allProductions = list(inputGrammar.productions())
startSymbol = inputGrammar.start()
newProductions = []
# we'll need to create new non-terminals for binarization
helperCounter = 0
def createHelperNonterminal():
"""Make a new unique non-terminal symbol."""
nonlocal helperCounter
helperCounter += 1
return Nonterminal(f'_X{helperCounter}')
# process each production rule
for prod in allProductions:
leftSide = prod.lhs()
rightSide = prod.rhs()
# skip empty productions - they mess things up
if len(rightSide) == 0:
continue
# single symbol on right side - already good
elif len(rightSide) == 1:
newProductions.append(prod)
# two symbols - might need to wrap terminals
elif len(rightSide) == 2:
processedRight = []
for symbol in rightSide:
if isinstance(symbol, str):
# terminals in binary rules need their own non-terminal
helperNt = createHelperNonterminal()
newProductions.append(Production(helperNt, (symbol,)))
processedRight.append(helperNt)
else:
processedRight.append(symbol)
newProductions.append(Production(leftSide, tuple(processedRight)))
# more than two symbols - need to binarize
else:
# first, handle any terminals
processedRight = []
for symbol in rightSide:
if isinstance(symbol, str):
helperNt = createHelperNonterminal()
newProductions.append(Production(helperNt, (symbol,)))
processedRight.append(helperNt)
else:
processedRight.append(symbol)
# now chain them together two at a time
# A -> B C D E becomes A -> B X1, X1 -> C X2, X2 -> D E
currentLeft = leftSide
for idx in range(len(processedRight) - 2):
helperNt = createHelperNonterminal()
newProductions.append(Production(currentLeft, (processedRight[idx], helperNt)))
currentLeft = helperNt
# don't forget the last pair
newProductions.append(Production(currentLeft, (processedRight[-2], processedRight[-1])))
return CFG(startSymbol, newProductions)
def _buildGrammarIndices(self):
"""
Create lookup tables for quick grammar access.
We make two dictionaries:
- terminalRules: maps terminals to their possible non-terminals
- binaryRules: maps (B, C) pairs to possible A where A -> B C
"""
self.terminalRules = {}
self.binaryRules = {}
# go through every production and index it
for production in self.grammar.productions():
rightSide = production.rhs()
leftSide = production.lhs()
# terminal rule: A -> 'word'
if len(rightSide) == 1 and isinstance(rightSide[0], str):
terminalWord = rightSide[0].lower()
if terminalWord not in self.terminalRules:
self.terminalRules[terminalWord] = []
self.terminalRules[terminalWord].append((leftSide, production))
# binary rule: A -> B C
elif len(rightSide) == 2 and all(isinstance(s, Nonterminal) for s in rightSide):
pairKey = (rightSide[0], rightSide[1])
if pairKey not in self.binaryRules:
self.binaryRules[pairKey] = []
self.binaryRules[pairKey].append((leftSide, production))
def parse(self, sentence):
"""
Parse a sentence using the CKY algorithm.
This is the main parsing function. It fills in a chart bottom-up
and then extracts all valid parse trees from it.
Returns a list of nltk.Tree objects (could be empty if no parse).
"""
# handle both string input and word lists
if isinstance(sentence, str):
wordList = sentence.lower().split()
else:
wordList = [w.lower() for w in sentence]
numWords = len(wordList)
# empty sentence = nothing to do
if numWords == 0:
return []
# set up the CKY chart
# chart[i][j] maps non-terminals to their back-pointers
chart = [[{} for _ in range(numWords + 1)] for _ in range(numWords + 1)]
# fill in the diagonal first - these are single words
for wordIdx in range(1, numWords + 1):
currentWord = wordList[wordIdx - 1]
# look up what non-terminals can produce this word
if currentWord in self.terminalRules:
for nonTerminal, prod in self.terminalRules[currentWord]:
if nonTerminal not in chart[wordIdx-1][wordIdx]:
chart[wordIdx-1][wordIdx][nonTerminal] = []
chart[wordIdx-1][wordIdx][nonTerminal].append(('terminal', currentWord))
# handle any unary rules that apply
self._processUnaryRules(chart[wordIdx-1][wordIdx])
# now fill in the rest of the chart, bottom-up
for spanLength in range(2, numWords + 1):
for startPos in range(numWords - spanLength + 1):
endPos = startPos + spanLength
# try all possible split points
for splitPoint in range(startPos + 1, endPos):
leftCell = chart[startPos][splitPoint]
rightCell = chart[splitPoint][endPos]
# check every combination of left and right non-terminals
for leftNt in leftCell:
for rightNt in rightCell:
pairKey = (leftNt, rightNt)
if pairKey in self.binaryRules:
for parentNt, prod in self.binaryRules[pairKey]:
if parentNt not in chart[startPos][endPos]:
chart[startPos][endPos][parentNt] = []
chart[startPos][endPos][parentNt].append(
('binary', splitPoint, leftNt, rightNt)
)
# handle unary rules for this cell too
self._processUnaryRules(chart[startPos][endPos])
# check if we got a complete parse
startSymbol = self.grammar.start()
if startSymbol not in chart[0][numWords]:
return []
# extract the actual trees from the back-pointers
resultTrees = self._reconstructTrees(chart, 0, numWords, startSymbol, wordList)
return resultTrees
def _processUnaryRules(self, chartCell):
"""
Add any non-terminals reachable through unary rules.
We keep going until nothing new is added (fixed point).
"""
madeChanges = True
while madeChanges:
madeChanges = False
newEntries = {}
for existingNt in list(chartCell.keys()):
# look for rules A -> B where B is what we have
for prod in self.grammar.productions():
rightSide = prod.rhs()
leftSide = prod.lhs()
if len(rightSide) == 1 and rightSide[0] == existingNt:
if leftSide not in chartCell and leftSide not in newEntries:
newEntries[leftSide] = [('unary', existingNt)]
madeChanges = True
chartCell.update(newEntries)
def _reconstructTrees(self, chart, startIdx, endIdx, nonTerminal, wordList, maxTrees=10):
"""
Build actual parse trees from the back-pointers in the chart.
This is recursive - we follow the pointers all the way down.
We limit to maxTrees to avoid explosion with ambiguous grammars.
"""
if nonTerminal not in chart[startIdx][endIdx]:
return []
resultTrees = []
for backPointer in chart[startIdx][endIdx][nonTerminal]:
# stop if we've got enough trees
if len(resultTrees) >= maxTrees:
break
pointerType = backPointer[0]
if pointerType == 'terminal':
# leaf node - just the word
word = backPointer[1]
newTree = Tree(str(nonTerminal), [word])
resultTrees.append(newTree)
elif pointerType == 'binary':
# binary rule - recursively build both children
splitAt, leftNt, rightNt = backPointer[1], backPointer[2], backPointer[3]
leftSubtrees = self._reconstructTrees(chart, startIdx, splitAt, leftNt, wordList, maxTrees)
rightSubtrees = self._reconstructTrees(chart, splitAt, endIdx, rightNt, wordList, maxTrees)
# combine all possibilities
for leftTree in leftSubtrees:
for rightTree in rightSubtrees:
if len(resultTrees) >= maxTrees:
break
newTree = Tree(str(nonTerminal), [leftTree, rightTree])
resultTrees.append(newTree)
elif pointerType == 'unary':
# unary rule - just one child
childNt = backPointer[1]
childTrees = self._reconstructTrees(chart, startIdx, endIdx, childNt, wordList, maxTrees)
for childTree in childTrees:
if len(resultTrees) >= maxTrees:
break
newTree = Tree(str(nonTerminal), [childTree])
resultTrees.append(newTree)
return resultTrees
def parseAndPrint(self, sentence):
"""Parse a sentence and display the results nicely."""
print(f"\nParsing: \"{sentence}\"")
print("-" * 50)
resultTrees = self.parse(sentence)
if not resultTrees:
print("No valid parse found.")
return None
# show what we found
print(f"Found {len(resultTrees)} parse tree(s):")
# only show first few to avoid spam
for idx, tree in enumerate(resultTrees[:3]):
print(f"\nParse Tree {idx + 1}:")
print(tree)
tree.pretty_print()
if len(resultTrees) > 3:
print(f"\n... and {len(resultTrees) - 3} more parse(s)")
return resultTrees
def runCkyParsing():
"""Load the ATIS grammar and test CKY parsing on some sentences."""
print("\n" + "=" * 60)
print("TASK 2: CKY Parsing Algorithm")
print("=" * 60)
# try to load the ATIS grammar from NLTK
print("\nLoading ATIS CFG grammar...")
try:
atisGrammar = nltk.data.load("grammars/large_grammars/atis.cfg")
print(f"Grammar loaded with {len(atisGrammar.productions())} productions")
print(f"Start symbol: {atisGrammar.start()}")
except Exception as e:
print(f"Error loading ATIS grammar: {e}")
print("Please run: nltk.download('large_grammars')")
return
# create our parser
print("\nConverting grammar to Chomsky Normal Form...")
ckyParser = CkyParser(atisGrammar)
print(f"CNF grammar has {len(ckyParser.grammar.productions())} productions")
# these are the test sentences from the assignment
testSentences = [
"What is the cheapest one way flight from columbus to indianapolis",
"Is there a flight from memphis to los angeles",
"What aircraft is this",
"Show american flights after twelve p.m. from miami to chicago"
]
print("\n" + "=" * 60)
print("Parsing Test Sentences")
print("=" * 60)
# run each one through the parser
for sentence in testSentences:
ckyParser.parseAndPrint(sentence)
# ============================================================================
# TASK 3a: Dependency Parsing with Stanford CoreNLP
# ============================================================================
def getDependencyParse(sentence):
"""
Get a dependency parse using Stanford CoreNLP.
Takes a sentence string and returns CoNLL-formatted output with:
word, POS tag, head index, dependency relation
Note: CoreNLP server must be running on port 9000!
"""
from nltk.parse.corenlp import CoreNLPDependencyParser
# try to connect to the CoreNLP server
try:
depParser = CoreNLPDependencyParser(url='http://localhost:9000')
except Exception as connectionError:
errorMessage = f"Error connecting to CoreNLP server: {connectionError}\n"
errorMessage += "Please ensure CoreNLP server is running on port 9000.\n"
errorMessage += 'Run: java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000'
return errorMessage
# now try to actually parse the sentence
try:
parseResult = next(depParser.raw_parse(sentence))
# convert to CoNLL format - 4 columns
conllOutput = parseResult.to_conll(4)
return conllOutput
except StopIteration:
return "No parse found for the sentence."
except Exception as parseError:
return f"Error parsing sentence: {parseError}"
def runDependencyParsing():
"""Demo the dependency parser with some example sentences."""
print("\n" + "=" * 60)
print("TASK 3a: Dependency Parsing with Stanford CoreNLP")
print("=" * 60)
# give clear setup instructions
print("\n*** IMPORTANT: CoreNLP Server Setup Required ***")
print("""
To use this dependency parser, you must:
1. Navigate to the Stanford CoreNLP folder:
cd ASN5/stanford-corenlp-4.5.10
2. Start the CoreNLP server:
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000
3. Then run this script again
""")
# test sentences including ambiguous ones
testSentences = [
"The cat sat on the mat.",
"Flying planes can be dangerous.",
"Amid the chaos I saw her duck."
]
print("\nTest Sentences for Dependency Parsing:")
for idx, sentence in enumerate(testSentences, 1):
print(f"{idx}. {sentence}")
print("\nAttempting to parse (requires CoreNLP server)...")
# try each one
for sentence in testSentences:
print(f"\nSentence: {sentence}")
print("-" * 40)
parseOutput = getDependencyParse(sentence)
print(parseOutput)
# ============================================================================
# TASK 3b: Ambiguous Sentence Analysis
# ============================================================================
def analyzeAmbiguousSentences():
"""
Analyze some famously ambiguous sentences.
This is more of a written analysis showing how parsers
can get confused by ambiguous structures.
"""
print("\n" + "=" * 60)
print("TASK 3b: Ambiguous Sentence Analysis")
print("=" * 60)
# this is the detailed analysis - pretty long but thorough
analysisText = """
=== ANALYSIS OF AMBIGUOUS SENTENCES ===
1. "Flying planes can be dangerous"
--------------------------------
STRUCTURAL AMBIGUITY:
This sentence has two possible interpretations:
a) Reading 1 - "Flying planes" as a gerund phrase (action of flying):
- "Flying" is a gerund (VBG) acting as the head of the subject
- "planes" is the direct object of "flying"
- Meaning: The act of piloting planes can be dangerous
- Dependency: planes --(dobj)--> flying
b) Reading 2 - "Flying planes" as noun phrase with adjective:
- "Flying" is a participial adjective (JJ) modifying "planes"
- "planes" is the head noun
- Meaning: Planes that are currently flying can be dangerous
- Dependency: flying --(amod)--> planes
POTENTIAL PARSER ERRORS:
- The parser may incorrectly assign "flying" as VBG when it should be JJ
- The head-dependent relationship between "flying" and "planes" may be wrong
- The parser typically chooses one interpretation, missing the ambiguity
2. "Amid the chaos I saw her duck"
--------------------------------
STRUCTURAL AMBIGUITY:
This sentence has two possible interpretations:
a) Reading 1 - "duck" as a noun (the bird):
- "her" is a possessive determiner
- "duck" is a noun (NN) being possessed
- "saw" takes "duck" as direct object
- Meaning: I saw the duck that belongs to her
- Dependencies:
* her --(poss)--> duck
* duck --(dobj)--> saw
b) Reading 2 - "duck" as a verb:
- "her" is a direct object of "saw"
- "duck" is a verb (VB) in a small clause construction
- Meaning: I saw her perform the action of ducking
- Dependencies:
* her --(dobj)--> saw
* duck --(xcomp)--> saw
POTENTIAL PARSER ERRORS:
- POS tag for "duck" may be incorrect (NN vs VB)
- The relationship between "saw", "her", and "duck" depends on interpretation
- "her" may be incorrectly labeled as poss instead of dobj or vice versa
3. ADDITIONAL AMBIGUOUS SENTENCE: "I made her duck orange sauce"
--------------------------------------------------------------
STRUCTURAL AMBIGUITY:
Multiple interpretations exist:
a) Reading 1 - Double object construction:
- "her" is indirect object
- "duck orange sauce" is direct object (a type of sauce)
- Meaning: I prepared duck orange sauce for her
b) Reading 2 - Causative construction with adjective:
- "her duck" is object (her pet duck)
- "orange sauce" describes the result
- Meaning: I covered her duck with orange sauce
c) Reading 3 - Complex causative:
- "her" is object of "made"
- "duck" is the verb she was made to do
- "orange sauce" is an additional object/modifier
- Very unusual interpretation
POTENTIAL PARSER ERRORS:
- POS ambiguity: "duck" (NN vs VB), "orange" (NN vs JJ)
- Head assignment between "duck", "orange", and "sauce" is ambiguous
- The parser will likely pick the most common structure, missing alternatives
=== KEY INSIGHTS ===
1. Syntactic ambiguity often arises from:
- POS ambiguity (noun vs verb, adjective vs participle)
- Attachment ambiguity (prepositional phrase, adjective attachment)
- Structural ambiguity (complement vs adjunct)
2. Dependency parsers are typically trained on treebanks with single "gold" parses,
so they cannot represent ambiguity - they must choose one interpretation.
3. Common error patterns:
- Gerund/participle ambiguity (VBG vs JJ)
- Noun/verb homographs (duck, fly, run, etc.)
- Possessive vs objective case pronouns in certain contexts
"""
print(analysisText)
return analysisText
# ============================================================================
# Main Execution
# ============================================================================
def main():
"""Run all the parsing tasks in sequence."""
print("=" * 60)
print("Constituency and Dependency Parsing")
print("=" * 60)
# make sure we have the data we need
print("\nChecking NLTK data...")
downloadNltkData()
# Task 1: build and show the constituency tree
print("\n" + "=" * 60)
print("Running Task 1: Constituency Tree Visualization")
print("=" * 60)
constituencyTree = createConstituencyTree()
visualizeConstituencyTree(constituencyTree)
# Task 2: CKY parsing with ATIS grammar
print("\n" + "=" * 60)
print("Running Task 2: CKY Parsing Algorithm")
print("=" * 60)
runCkyParsing()
# Task 3a: dependency parsing (needs CoreNLP server)
print("\n" + "=" * 60)
print("Running Task 3a: Dependency Parsing")
print("=" * 60)
runDependencyParsing()
# Task 3b: analysis of ambiguous sentences
analyzeAmbiguousSentences()
print("\n" + "=" * 60)
print("All Tasks Complete!")
print("=" * 60)
if __name__ == "__main__":
main()