-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvocabCLI.modules.html
2445 lines (2264 loc) · 243 KB
/
vocabCLI.modules.html
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
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html class="no-js" lang="en">
<head><meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" />
<!-- Generated with Sphinx 5.3.0 and Furo 2022.12.07 -->
<title>vocabCLI.modules package - vocabCLI 0.0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="static/pygments.css" />
<link rel="stylesheet" type="text/css" href="static/styles/furo.css?digest=91d0f0d1c444bdcb17a68e833c7a53903343c195" />
<link rel="stylesheet" type="text/css" href="static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" />
<style>
body {
--color-code-background: #f8f8f8;
--color-code-foreground: black;
}
@media not print {
body[data-theme="dark"] {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
}
}
</style></head>
<body>
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-toc" viewBox="0 0 24 24">
<title>Contents</title>
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
</svg>
</symbol>
<symbol id="svg-menu" viewBox="0 0 24 24">
<title>Menu</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 24 24">
<title>Expand</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24">
<title>Light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</symbol>
<symbol id="svg-moon" viewBox="0 0 24 24">
<title>Dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
</svg>
</symbol>
<symbol id="svg-sun-half" viewBox="0 0 24 24">
<title>Auto light/dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<circle cx="12" cy="12" r="9" />
<path d="M13 12h5" />
<path d="M13 15h4" />
<path d="M13 18h1" />
<path d="M13 9h4" />
<path d="M13 6h1" />
</svg>
</symbol>
</svg>
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
<label class="overlay sidebar-overlay" for="__navigation">
<div class="visually-hidden">Hide navigation sidebar</div>
</label>
<label class="overlay toc-overlay" for="__toc">
<div class="visually-hidden">Hide table of contents sidebar</div>
</label>
<div class="page">
<header class="mobile-header">
<div class="header-left">
<label class="nav-overlay-icon" for="__navigation">
<div class="visually-hidden">Toggle site navigation sidebar</div>
<i class="icon"><svg><use href="#svg-menu"></use></svg></i>
</label>
</div>
<div class="header-center">
<a href="index.html"><div class="brand">vocabCLI 0.0.1 documentation</div></a>
</div>
<div class="header-right">
<div class="theme-toggle-container theme-toggle-header">
<button class="theme-toggle">
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-header-icon" for="__toc">
<div class="visually-hidden">Toggle table of contents sidebar</div>
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
</label>
</div>
</header>
<aside class="sidebar-drawer">
<div class="sidebar-container">
<div class="sidebar-sticky"><a class="sidebar-brand" href="index.html">
<span class="sidebar-brand-text">vocabCLI 0.0.1 documentation</span>
</a><form class="sidebar-search-container" method="get" action="search.html" role="search">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
</div>
</div>
</div>
</div>
</aside>
<div class="main">
<div class="content">
<div class="article-container">
<a href="#" class="back-to-top muted-link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
</svg>
<span>Back to top</span>
</a>
<div class="content-icon-container">
<div class="theme-toggle-container theme-toggle-content">
<button class="theme-toggle">
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-content-icon" for="__toc">
<div class="visually-hidden">Toggle table of contents sidebar</div>
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
</label>
</div>
<article role="main">
<section id="vocabcli-modules-package">
<h1>vocabCLI.modules package<a class="headerlink" href="#vocabcli-modules-package" title="Permalink to this heading">#</a></h1>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this heading">#</a></h2>
</section>
<section id="module-vocabCLI.modules.About">
<span id="vocabcli-modules-about-module"></span><h2>vocabCLI.modules.About module<a class="headerlink" href="#module-vocabCLI.modules.About" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.About.print_about_app">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.About.</span></span><span class="sig-name descname"><span class="pre">print_about_app</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/About.html#print_about_app"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.About.print_about_app" title="Permalink to this definition">#</a></dt>
<dd><p>Prints the about app page</p>
<ol class="arabic simple">
<li><p>Create a layout object</p></li>
<li><p>Create a header content object with the help of the Panel class</p></li>
<li><p>Create a footer content object with the help of the Panel class</p></li>
<li><p>Create a main content object with the help of the Panel class</p></li>
<li><p>Divide the “screen” into three parts</p></li>
<li><p>Update the header, main and footer with their respective content objects</p></li>
<li><p>Print the layout which contains details about the app</p></li>
</ol>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.Banner">
<span id="vocabcli-modules-banner-module"></span><h2>vocabCLI.modules.Banner module<a class="headerlink" href="#module-vocabCLI.modules.Banner" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Banner.get_terminal_width">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Banner.</span></span><span class="sig-name descname"><span class="pre">get_terminal_width</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Banner.html#get_terminal_width"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Banner.get_terminal_width" title="Permalink to this definition">#</a></dt>
<dd><p>Gets the width of the terminal.</p>
<dl class="simple">
<dt>Returns:</dt><dd><p>int: width of the terminal.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Banner.print_banner">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Banner.</span></span><span class="sig-name descname"><span class="pre">print_banner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">console</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Banner.html#print_banner"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Banner.print_banner" title="Permalink to this definition">#</a></dt>
<dd><p>Prints the banner of the application.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>console (Console): Rich console object.</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.Carousel">
<span id="vocabcli-modules-carousel-module"></span><h2>vocabCLI.modules.Carousel module<a class="headerlink" href="#module-vocabCLI.modules.Carousel" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Carousel.show_slider">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Carousel.</span></span><span class="sig-name descname"><span class="pre">show_slider</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Carousel.html#show_slider"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Carousel.show_slider" title="Permalink to this definition">#</a></dt>
<dd><ol class="arabic simple">
<li><p>Sets up the GUI window</p></li>
<li><p>Dumps the images to the folder</p></li>
<li><p>Deletes the images if already existing</p></li>
<li><p>Sets up the images</p></li>
<li><p>Creates a global counter variable</p></li>
</ol>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.Database">
<span id="vocabcli-modules-database-module"></span><h2>vocabCLI.modules.Database module<a class="headerlink" href="#module-vocabCLI.modules.Database" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Database.createConnection">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Database.</span></span><span class="sig-name descname"><span class="pre">createConnection</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Database.html#createConnection"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Database.createConnection" title="Permalink to this definition">#</a></dt>
<dd><p>Creates a database connection to a SQLite database VocabularyBuilder.db</p>
<dl class="simple">
<dt>Returns:</dt><dd><p>Connection object or None.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Database.createTables">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Database.</span></span><span class="sig-name descname"><span class="pre">createTables</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">conn</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Connection</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Database.html#createTables"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Database.createTables" title="Permalink to this definition">#</a></dt>
<dd><ol class="arabic simple">
<li><p>Creates the tables in the database if they do not exist</p></li>
<li><p>Tables created are words, cache_words, collections, quiz_history, quotes, rss</p></li>
<li><p>The tables are created using the SQL statements in the docstring with respective column names and data types</p></li>
<li><p>The tables are created using the execute method of the connection object</p></li>
<li><p>The connection object is passed as an argument to the function</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>conn (sqlite3.Connection): Connection object</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Database.initializeDB">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Database.</span></span><span class="sig-name descname"><span class="pre">initializeDB</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Database.html#initializeDB"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Database.initializeDB" title="Permalink to this definition">#</a></dt>
<dd><p>Initializes the database</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Database.refresh_cache">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Database.</span></span><span class="sig-name descname"><span class="pre">refresh_cache</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Database.html#refresh_cache"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Database.refresh_cache" title="Permalink to this definition">#</a></dt>
<dd><p>Refreshes the cache of the words in the database.</p>
<ol class="arabic simple">
<li><p>Connect to the database</p></li>
<li><p>Check if the cache is empty, if yes, then do nothing.</p></li>
<li><p>If the cache is not empty, then we need to refresh it.</p></li>
<li><p>Get all the words from the cache.</p></li>
<li><p>For each word, get the response from the API and update the cache.</p></li>
<li><p>If there’s an error, then show a error message and exit.</p></li>
<li><p>If there’s no error, then update the cache.</p></li>
<li><p>If the cache is updated, then show a success message.</p></li>
</ol>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.Dictionary">
<span id="vocabcli-modules-dictionary-module"></span><h2>vocabCLI.modules.Dictionary module<a class="headerlink" href="#module-vocabCLI.modules.Dictionary" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.connect_to_api">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">connect_to_api</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'hello'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#connect_to_api"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.connect_to_api" title="Permalink to this definition">#</a></dt>
<dd><p>Connects to the API and returns the response in JSON format.</p>
<ol class="arabic simple">
<li><p>Connect to the internet to check if the word is a valid word.</p></li>
<li><p>If the word is a valid word, then check if the word is already in the cache_word table. If the word is in the cache_word table, then return the response from the cache_word table.</p></li>
<li><p>If the word is not in the cache_word table, then connect to the API, get the response and then insert the word and its response into the cache_word table.</p></li>
<li><p>If the word is not a valid word, then print an error message.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str, optional): Word to lookup to test the API. Defaults to “hello”.</p>
</dd>
<dt>Returns:</dt><dd><p>dict: Response in JSON format.</p>
</dd>
<dt>Raises:</dt><dd><p>ConnectionError: If the user is not connected to the internet.
HTTPError: If the word is not a valid word.
Timeout: If the request times out.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.definition">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">definition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">short</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#definition"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.definition" title="Permalink to this definition">#</a></dt>
<dd><p>Prints the definition of the word.</p>
<ol class="arabic simple">
<li><p>The function definition first calls the function connect_to_api which takes query (str) as argument and returns the response (dict) if successful or None if unsuccessful.</p></li>
<li><p>The function definition then calls the function phonetic which takes query (str) as argument and returns the phonetic (str) of the word.</p></li>
<li><p>The function definition then calls the function insert_word_to_db which takes query (str) as argument and inserts the word into the database.</p></li>
<li><p>If the short is set to True, the function definition then iterates over the meanings (dict) and prints the first definition (str) of the word.</p></li>
<li><p>If the short is set to False, the function definition then calls the function display_theme which takes query (str) as argument and displays the theme (str) associated with the word.</p></li>
<li><p>The function definition then calls the function show_commonly_confused which takes query (str) as argument and displays the commonly confused words (str) of the word.</p></li>
<li><p>The function definition then iterates over the meanings (dict) and prints the definition (str) and example (str) of the word.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): Word which is meant to be defined.
short (Optional[bool], optional): If True, it will print just the short definition. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.display_theme">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">display_theme</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#display_theme"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.display_theme" title="Permalink to this definition">#</a></dt>
<dd><p>Display the theme of the word if it exists in the collections table</p>
<ol class="arabic simple">
<li><p>Create a connection to the database</p></li>
<li><p>Create a cursor to execute SQL queries on the database</p></li>
<li><p>Execute an SQL query that returns the collection name for a given word</p></li>
<li><p>If the query returns a result, print it</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): Word to check if it has a theme</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.get_word_of_the_day">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">get_word_of_the_day</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#get_word_of_the_day"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.get_word_of_the_day" title="Permalink to this definition">#</a></dt>
<dd><p>Get a word of the day from a public API and print its definition.</p>
<ol class="arabic simple">
<li><p>Get the API key from the environment variables</p></li>
<li><p>Send a GET request to the Wordnik API to get the word of the day</p></li>
<li><p>Get the word from the response</p></li>
<li><p>Print the word & definition of the word of the day</p></li>
</ol>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.insert_to_db_util">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">insert_to_db_util</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">conn</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#insert_to_db_util"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.insert_to_db_util" title="Permalink to this definition">#</a></dt>
<dd><p>Inserts the word into the database.</p>
<ol class="arabic simple">
<li><p>If the word exists in the database, with a tag, then insert it with that tag.</p></li>
<li><p>If the word exists in the database, without a tag, then insert it without a tag.</p></li>
<li><p>If the word exists in the database, with favorite 1, then insert it with favorite 1.</p></li>
<li><p>If the word exists in the database, with learning 1, then insert it with learning 1.</p></li>
<li><p>If the word exists in the database, with mastered 1, then insert it with mastered 1.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>conn (sqlite3.Connection): Connection to the database.
query (str): Word to be inserted into the database.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.insert_word_to_db">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">insert_word_to_db</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#insert_word_to_db"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.insert_word_to_db" title="Permalink to this definition">#</a></dt>
<dd><p>Add the word in the vocabulary builder list.</p>
<p>The code above does the following, explained in English:
1. Check if the word exists in the cache_word table
2. If the word exists, then insert the word to the database
3. If the word does not exist, then query the API to check if the word exists
4. If the word exists, then insert the word to the database and also insert the word and its response to the cache_word table</p>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): Word which is to be tagged.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.one_line_definition">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">one_line_definition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#one_line_definition"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.one_line_definition" title="Permalink to this definition">#</a></dt>
<dd><p>Prints the one line definition of the word.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): Word which is meant to be defined.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.phonetic">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">phonetic</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#phonetic"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.phonetic" title="Permalink to this definition">#</a></dt>
<dd><p>Prints the phonetic of the word.</p>
<ol class="arabic simple">
<li><p>It takes the query as an argument.</p></li>
<li><p>It connects to the API and retrieves the response.</p></li>
<li><p>If the word is not found in the dictionary, it prints the message.</p></li>
<li><p>If the word is found, it loops through the phonetics.</p></li>
<li><p>If the phonetic is available, it returns it.</p></li>
<li><p>If the phonetic is not available, it prints ‘Phonetic Unavailable’.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): Word for which phonetic is to be printed.</p>
</dd>
<dt>Returns:</dt><dd><p>string: Phonetic of the word.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.say_aloud">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">say_aloud</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#say_aloud"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.say_aloud" title="Permalink to this definition">#</a></dt>
<dd><p>Pronounces the word. Downloads the audio file, plays it and deletes it.</p>
<ol class="arabic simple">
<li><p>The function say_aloud first calls the function connect_to_api which takes query (str) as argument and returns the response (dict) if successful or None if unsuccessful.</p></li>
<li><p>The function say_aloud then checks if the audio is available or not.</p></li>
<li><p>If the audio is available, the function say_aloud then downloads the audio file and plays it.</p></li>
<li><p>If the audio is not available, the function say_aloud then raises the AudioUnavailableException.</p></li>
<li><p>The function say_aloud then deletes the audio file.</p></li>
<li><p>The function say_aloud then prints the phonetic (str) of the word.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): Word to be pronounced.</p>
</dd>
<dt>Raises:</dt><dd><p>AudioUnavailableException: Raised when the audio is not available.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Dictionary.show_commonly_confused">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Dictionary.</span></span><span class="sig-name descname"><span class="pre">show_commonly_confused</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">word</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Dictionary.html#show_commonly_confused"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Dictionary.show_commonly_confused" title="Permalink to this definition">#</a></dt>
<dd><p>Check if the word is commonly confused with other words, if yes, show them</p>
<ol class="arabic simple">
<li><p>Open the commonly_confused.csv file</p></li>
<li><p>Read the file</p></li>
<li><p>If the word is in the row, then print the words in the row as commonly confused words</p></li>
<li><p>If the word is not in the row, then do nothing</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>word (str): Word to check if it is commonly confused with other words</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.Exceptions">
<span id="vocabcli-modules-exceptions-module"></span><h2>vocabCLI.modules.Exceptions module<a class="headerlink" href="#module-vocabCLI.modules.Exceptions" title="Permalink to this heading">#</a></h2>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.AudioUnavailableException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">AudioUnavailableException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#AudioUnavailableException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.AudioUnavailableException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the audio is not available for the word.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoDataFoundException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoDataFoundException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoDataFoundException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoDataFoundException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to export data but there is no data to export.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoQuotesException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoQuotesException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoQuotesException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoQuotesException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to perform some operation on a quote which is not present in the list.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoRSSFeedsException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoRSSFeedsException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoRSSFeedsException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoRSSFeedsException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to perform some operation on a RSS feed which is not present in the list.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoSuchCollectionException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoSuchCollectionException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">collection</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoSuchCollectionException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoSuchCollectionException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to perform some operation on a collection which is not present in the list.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoSuchCollectionException.collection">
<span class="sig-name descname"><span class="pre">collection</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoSuchCollectionException.collection" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoSuchTagException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoSuchTagException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tag</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoSuchTagException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoSuchTagException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to perform some operation on a tag which is not present in the list.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoSuchTagException.tag">
<span class="sig-name descname"><span class="pre">tag</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoSuchTagException.tag" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoWordsInDBException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoWordsInDBException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoWordsInDBException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoWordsInDBException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to perform some operation on a word which is not present in the database.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoWordsInFavoriteListException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoWordsInFavoriteListException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoWordsInFavoriteListException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoWordsInFavoriteListException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to start a learning session but there are no words in the list.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoWordsInLearningListException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoWordsInLearningListException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoWordsInLearningListException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoWordsInLearningListException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to start a learning session but there are no words in the list.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NoWordsInMasteredListException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NoWordsInMasteredListException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NoWordsInMasteredListException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NoWordsInMasteredListException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to start a learning session but there are no words in the list.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.NotEnoughWordsForQuizException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">NotEnoughWordsForQuizException</span></span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#NotEnoughWordsForQuizException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.NotEnoughWordsForQuizException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when the user attempts to start a quiz but there are not enough words in the list.</p>
</dd></dl>
<dl class="py exception">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.WordNeverSearchedException">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Exceptions.</span></span><span class="sig-name descname"><span class="pre">WordNeverSearchedException</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">word</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Exceptions.html#WordNeverSearchedException"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Exceptions.WordNeverSearchedException" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
<p>raised when a word is never searched but user attempts to perform some operation on it.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="vocabCLI.modules.Exceptions.WordNeverSearchedException.word">
<span class="sig-name descname"><span class="pre">word</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#vocabCLI.modules.Exceptions.WordNeverSearchedException.word" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.Flashcard">
<span id="vocabcli-modules-flashcard-module"></span><h2>vocabCLI.modules.Flashcard module<a class="headerlink" href="#module-vocabCLI.modules.Flashcard" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.export_util">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">export_util</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">c</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">type</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#export_util"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.export_util" title="Permalink to this definition">#</a></dt>
<dd><p>Exports the words from the database to a flashcard image</p>
<dl class="simple">
<dt>Args:</dt><dd><p>c (sqlite3.Cursor): The cursor object
type (str): The type of words to be exported</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.flashcard_definition">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">flashcard_definition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#flashcard_definition"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.flashcard_definition" title="Permalink to this definition">#</a></dt>
<dd><p>Returns the definition of the word from the cache.</p>
<ol class="arabic simple">
<li><p>Execute a query that selects the api_response column from the cache_words table where the word column is equal to the query</p></li>
<li><p>Load the api_response column as a JSON object</p></li>
<li><p>Create an empty dictionary</p></li>
<li><p>Loop through each meaning in the meanings array</p></li>
<li><p>For each meaning, loop through the first 3 definitions</p></li>
<li><p>For each definition, add it to the dictionary with the key being the definition and the value being the example if it exists</p></li>
<li><p>Return the first 3 definitions and examples</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): The word to be searched</p>
</dd>
<dt>Returns:</dt><dd><p>str: The definition of the word</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.generate_all_flashcards">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">generate_all_flashcards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#generate_all_flashcards"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.generate_all_flashcards" title="Permalink to this definition">#</a></dt>
<dd><p>Generate flashcards for all words in the database</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.generate_favorite_flashcards">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">generate_favorite_flashcards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#generate_favorite_flashcards"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.generate_favorite_flashcards" title="Permalink to this definition">#</a></dt>
<dd><p>Generate flashcards for all favorite words in the database</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.generate_learning_flashcards">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">generate_learning_flashcards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#generate_learning_flashcards"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.generate_learning_flashcards" title="Permalink to this definition">#</a></dt>
<dd><p>Generate flashcards for all learning words in the database</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.generate_mastered_flashcards">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">generate_mastered_flashcards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#generate_mastered_flashcards"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.generate_mastered_flashcards" title="Permalink to this definition">#</a></dt>
<dd><p>Generate flashcards for all mastered words in the database</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.generate_tag_flashcards">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">generate_tag_flashcards</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#generate_tag_flashcards"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.generate_tag_flashcards" title="Permalink to this definition">#</a></dt>
<dd><p>Generate flashcards for all words with a specific tag in the database</p>
<dl class="simple">
<dt>Args:</dt><dd><p>query (str): the tag to search for</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Flashcard.interpolate">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Flashcard.</span></span><span class="sig-name descname"><span class="pre">interpolate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">black</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">random_color</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interval</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Flashcard.html#interpolate"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Flashcard.interpolate" title="Permalink to this definition">#</a></dt>
<dd><p>Interpolate between two colors.</p>
<ol class="arabic simple">
<li><p>It calculates the difference between the two colors</p></li>
<li><p>It divides the difference by the number of steps</p></li>
<li><p>It adds the difference to the black color each time it moves one step</p></li>
<li><p>It returns the new color, rounded to the nearest integer</p></li>
<li><p>It does this for each step</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>black (tuple): The first color
random_color (tuple): The second color
interval (int): The number of steps to take between the two colors</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.Graph">
<span id="vocabcli-modules-graph-module"></span><h2>vocabCLI.modules.Graph module<a class="headerlink" href="#module-vocabCLI.modules.Graph" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_learning_vs_mastered">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_learning_vs_mastered</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_learning_vs_mastered"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_learning_vs_mastered" title="Permalink to this definition">#</a></dt>
<dd><p>Visualizes the distribution of words by learning and mastered.</p>
<ol class="arabic simple">
<li><p>Count number of words in learning and mastered.</p></li>
<li><p>Set the style of the graph.</p></li>
<li><p>Plot a pie chart.</p></li>
<li><p>Export the graph as png.</p></li>
<li><p>Show the graph in a popup window if popup=True.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>popup (bool, optional): Whether to show the graph in a popup window. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_top_tags_bar">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_top_tags_bar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">N</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_top_tags_bar"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_top_tags_bar" title="Permalink to this definition">#</a></dt>
<dd><p>Visualizes the top N tags with the most words.</p>
<ol class="arabic simple">
<li><p>Get the top N tags and their word count from the database and store them in a list</p></li>
<li><p>If no words are found, print an error message and return</p></li>
<li><p>If there are less words than the number we want to display, print a warning message</p></li>
<li><p>Create a dataframe from the list</p></li>
<li><p>Set the style of the graph</p></li>
<li><p>Plot the graph</p></li>
<li><p>Export the graph to a png file</p></li>
<li><p>If popup is True, show the graph in a popup window</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>N (int, optional): Number of top tags to visualize . Defaults to 10.
popup (bool, optional): Whether to show the graph in a popup window. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_top_tags_pie">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_top_tags_pie</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">N</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_top_tags_pie"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_top_tags_pie" title="Permalink to this definition">#</a></dt>
<dd><p>Visualizes the top N tags with the most words.</p>
<ol class="arabic simple">
<li><p>Execute a SQL query to get the count of each tag. The query returns a list of tuples, where the first element is the tag and the second is the count.</p></li>
<li><p>If no words are found, print an error message and return</p></li>
<li><p>If there are less words than the number we want to display, print a warning message</p></li>
<li><p>Create a dataframe from the list of tags and the list of counts.</p></li>
<li><p>Set the theme of the plot.</p></li>
<li><p>Create a pie chart using the dataframe.</p></li>
<li><p>Save the plot in a file.</p></li>
<li><p>Check if the directory exists, if not create it.</p></li>
<li><p>Show the plot on screen if the popup argument is true.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>N (int, optional): Number of top tags to visualize . Defaults to 10.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_top_words_bar">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_top_words_bar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">N</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_top_words_bar"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_top_words_bar" title="Permalink to this definition">#</a></dt>
<dd><p>Visualize the top N words looked up by the user</p>
<ol class="arabic simple">
<li><p>Get the top N words and their word count from the database and store them in a list</p></li>
<li><p>If no words are found, print an error message and return</p></li>
<li><p>If there are less words than the number we want to display, print a warning message</p></li>
<li><p>Create a dataframe from the list</p></li>
<li><p>Set the style of the graph</p></li>
<li><p>Plot the graph</p></li>
<li><p>Export the graph to a png file</p></li>
<li><p>If popup is True, show the graph in a popup window</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>N (int, optional): Number of words to visualize. Defaults to 10.
popup (bool, optional): Whether to show the graph in a popup window. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_top_words_pie">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_top_words_pie</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">N</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_top_words_pie"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_top_words_pie" title="Permalink to this definition">#</a></dt>
<dd><p>Visualizes the top N words with the most lookups.</p>
<ol class="arabic simple">
<li><p>Create a cursor and execute a query to fetch the word and the count of the word from the database</p></li>
<li><p>If no words are found, print an error message and return</p></li>
<li><p>If there are less words than the number we want to display, print a warning message</p></li>
<li><p>Create a dataframe using the top words and their counts</p></li>
<li><p>Create a pie chart using matplotlib and seaborn and save it to a file</p></li>
<li><p>If the popup parameter is True, display the pie chart using matplotlib</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>N (int, optional): Number of top words to visualize . Defaults to 10.
popup (bool, optional): Whether to show the graph in a popup window. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_word_distribution_category">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_word_distribution_category</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_word_distribution_category"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_word_distribution_category" title="Permalink to this definition">#</a></dt>
<dd><p>Visualizes the distribution of words by category.</p>
<ol class="arabic simple">
<li><p>Selects the collection column and the word count from the words and collections table.</p></li>
<li><p>Creates a dataframe from the data obtained.</p></li>
<li><p>Sets the style of the graph.</p></li>
<li><p>Creates a bar graph based on the dataframe.</p></li>
<li><p>Saves the graph to the exports folder.</p></li>
<li><p>Displays graph if popup is True.</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>popup (bool, optional): Whether to show the graph in a popup window. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_word_distribution_month">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_word_distribution_month</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_word_distribution_month"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_word_distribution_month" title="Permalink to this definition">#</a></dt>
<dd><p>Visualizes the distribution of words by dates of month.</p>
<ol class="arabic simple">
<li><dl class="simple">
<dt>Get the data from the function word_distribution_month_util() which is a list of:</dt><dd><ol class="loweralpha simple">
<li><p>Dates</p></li>
<li><p>Word count</p></li>
</ol>
</dd>
</dl>
</li>
<li><p>Create a dataframe from the list</p></li>
<li><p>Set the style of the graph</p></li>
<li><p>Plot the graph</p></li>
<li><p>Set the graph title, x and y axis labels, and x axis tick labels</p></li>
<li><p>Save the graph to the folder ‘exports’</p></li>
<li><p>If popup is True, show the graph in a popup window</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>popup (bool, optional): Whether to show the graph in a popup window. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_word_distribution_week">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_word_distribution_week</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_word_distribution_week"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_word_distribution_week" title="Permalink to this definition">#</a></dt>
<dd><p>Visualizes the distribution of words by day of the week.</p>
<ol class="arabic simple">
<li><p>Create a dataframe from a list of tuples (day, count).</p></li>
<li><p>Set the style of the graph.</p></li>
<li><p>Plot the graph with the dataframe.</p></li>
<li><p>Set the title, x and y labels, x and y ticks.</p></li>
</ol>
<p>5. Save the graph.
5. Show the graph in a popup window if popup is True.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>popup (bool, optional): Whether to show the graph in a popup window. Defaults to False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.viz_word_distribution_year">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">viz_word_distribution_year</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">popup</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#viz_word_distribution_year"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.viz_word_distribution_year" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.word_distribution_month_util">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">word_distribution_month_util</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">list</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#word_distribution_month_util"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.word_distribution_month_util" title="Permalink to this definition">#</a></dt>
<dd><p>Returns the distribution of word by dates of month.</p>
<ol class="arabic simple">
<li><p>Determine current year, current month and next month.</p></li>
<li><p>Determine total number of days in current month.</p></li>
<li><p>Get unformatted datestrings for each day in current month.</p></li>
<li><p>Get word count for each day in current month.</p></li>
</ol>
<dl class="simple">
<dt>Returns:</dt><dd><p>list: List of dates of month.
list: List of word counts.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.word_distribution_year_util">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">word_distribution_year_util</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#word_distribution_year_util"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.word_distribution_year_util" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.Graph.words_distribution_week_util">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.Graph.</span></span><span class="sig-name descname"><span class="pre">words_distribution_week_util</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">list</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="modules/vocabCLI/modules/Graph.html#words_distribution_week_util"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.Graph.words_distribution_week_util" title="Permalink to this definition">#</a></dt>
<dd><p>Returns the distribution of words by day of the week.</p>
<ol class="arabic simple">
<li><p>Create a dictionary with numbers as keys and weekdays as values.</p></li>
<li><p>Create two lists, one for weekdays and one for word count.</p></li>
<li><p>Query the database for word count for each day in the current week.</p></li>
<li><p>Loop through the results and assign the weekday to the list.</p></li>
<li><p>Assign the word count to the list.</p></li>
<li><p>Return the two lists.</p></li>
</ol>
<dl class="simple">
<dt>Returns:</dt><dd><p>list: list of days of the week.
list: list of days of the word counts.</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.ImportExport">
<span id="vocabcli-modules-importexport-module"></span><h2>vocabCLI.modules.ImportExport module<a class="headerlink" href="#module-vocabCLI.modules.ImportExport" title="Permalink to this heading">#</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="vocabCLI.modules.ImportExport.PDF">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.ImportExport.</span></span><span class="sig-name descname"><span class="pre">PDF</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">orientation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'P'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">unit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'mm'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">format</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'A4'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/ImportExport.html#PDF"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.ImportExport.PDF" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">FPDF</span></code></p>
<dl class="py method">
<dt class="sig sig-object py" id="vocabCLI.modules.ImportExport.PDF.footer">
<span class="sig-name descname"><span class="pre">footer</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/ImportExport.html#PDF.footer"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.ImportExport.PDF.footer" title="Permalink to this definition">#</a></dt>
<dd><p>Page footer.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="vocabCLI.modules.ImportExport.PDF.header">
<span class="sig-name descname"><span class="pre">header</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="modules/vocabCLI/modules/ImportExport.html#PDF.header"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.ImportExport.PDF.header" title="Permalink to this definition">#</a></dt>
<dd><p>Header to be implemented in your own inherited class</p>
</dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.ImportExport.export_to_csv">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.ImportExport.</span></span><span class="sig-name descname"><span class="pre">export_to_csv</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/ImportExport.html#export_to_csv"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.ImportExport.export_to_csv" title="Permalink to this definition">#</a></dt>
<dd><p>Export words to csv file.</p>
<ol class="arabic simple">
<li><p>Create a connection to the database.</p></li>
<li><p>Create a cursor object.</p></li>
<li><p>Execute a SELECT query to fetch all the words from the database.</p></li>
<li><p>Write the words to a csv file.</p></li>
<li><p>Execute a SELECT query to fetch all the quotes from the database.</p></li>
<li><p>Write the quotes to a csv file.</p></li>
<li><p>Execute a SELECT query to fetch all the rss feeds from the database.</p></li>
<li><p>Write the rss feeds to a csv file.</p></li>
<li><p>Execute a SELECT query to fetch all the quiz history from the database.</p></li>
<li><p>Write the quiz history to a csv file.</p></li>
<li><p>Close the connection.</p></li>
</ol>
<dl class="simple">
<dt>Raises:</dt><dd><p>NoDataFoundException: If no words are found in the database.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.ImportExport.export_to_pdf">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.ImportExport.</span></span><span class="sig-name descname"><span class="pre">export_to_pdf</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/ImportExport.html#export_to_pdf"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.ImportExport.export_to_pdf" title="Permalink to this definition">#</a></dt>
<dd><p>Export words to pdf file.</p>
<ol class="arabic simple">
<li><p>Create a pdf file</p></li>
<li><p>Sets all the attributes (colour, font, size, etc.)</p></li>
<li><p>Execute a query to select all words from the database</p></li>
<li><p>If there are no rows, raise NoDataFoundException</p></li>
<li><p>Create a cell for respective column and fill it with the data</p></li>
</ol>
<dl class="simple">
<dt>Raises:</dt><dd><p>NoDataFoundException: If no words are found in the database.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.ImportExport.import_from_csv">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.ImportExport.</span></span><span class="sig-name descname"><span class="pre">import_from_csv</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/ImportExport.html#import_from_csv"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.ImportExport.import_from_csv" title="Permalink to this definition">#</a></dt>
<dd><p>Import words from csv file.</p>
<ol class="arabic simple">
<li><p>Open the csv file</p></li>
<li><p>Get the csv reader</p></li>
<li><p>Skip the header</p></li>
<li><p>For each row in the csv file</p></li>
<li><p>Try to add the word to the database</p></li>
<li><p>If the word already exists in the database with the same timestamp, increment the word_already_exists counter</p></li>
<li><p>If the word does not exist in the database, increment the added_words counter</p></li>
<li><p>If the csv file is not found, print an error message</p></li>
</ol>
<dl class="simple">
<dt>Raises:</dt><dd><p>NoDataFoundException: If no words are found in the csv file.</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-vocabCLI.modules.NLP">
<span id="vocabcli-modules-nlp-module"></span><h2>vocabCLI.modules.NLP module<a class="headerlink" href="#module-vocabCLI.modules.NLP" title="Permalink to this heading">#</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.NLP.censor_bad_words_not_strict">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.NLP.</span></span><span class="sig-name descname"><span class="pre">censor_bad_words_not_strict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/NLP.html#censor_bad_words_not_strict"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.NLP.censor_bad_words_not_strict" title="Permalink to this definition">#</a></dt>
<dd><p>Removes the bad words from the text and replaces them with asterisks partially and prints the censor text</p>
<ol class="arabic simple">
<li><p>First we check if the text is a URL, if yes, then we parse the text from it and then use the model</p></li>
<li><p>If the text is not a URL, then we directly use the model</p></li>
<li><p>Remove the punctuations and convert text to lowercase</p></li>
<li><p>Read the bad words from the file and store them in a list</p></li>
<li><p>Split the text into words and for each word, we check if it is a bad word, if yes, then we partially replace it with asterisks</p></li>
<li><p>Print the censored text and the number of bad words censored</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>text (str): text that needs to be censored</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.NLP.censor_bad_words_strict">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.NLP.</span></span><span class="sig-name descname"><span class="pre">censor_bad_words_strict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/NLP.html#censor_bad_words_strict"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.NLP.censor_bad_words_strict" title="Permalink to this definition">#</a></dt>
<dd><p>Removes the bad words from the text and replaces them with asterisks completely and prints the censor text</p>
<ol class="arabic simple">
<li><p>First we check if the text is a URL, if yes, then we parse the text from it and then use the model</p></li>
<li><p>If the text is not a URL, then we directly use the model</p></li>
<li><p>Remove the punctuations and convert text to lowercase</p></li>
<li><p>Read the bad words from the file and store them in a list</p></li>
<li><p>Split the text into words and for each word, we check if it is a bad word, if yes, then we replace it with asterisks</p></li>
<li><p>Print the censored text and the number of bad words censored</p></li>
</ol>
<dl class="simple">
<dt>Args:</dt><dd><p>text (str): text that needs to be censored</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="vocabCLI.modules.NLP.check_url_or_text">
<span class="sig-prename descclassname"><span class="pre">vocabCLI.modules.NLP.</span></span><span class="sig-name descname"><span class="pre">check_url_or_text</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="modules/vocabCLI/modules/NLP.html#check_url_or_text"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#vocabCLI.modules.NLP.check_url_or_text" title="Permalink to this definition">#</a></dt>
<dd><p>Checks if the value is a URL or a text</p>
<ol class="arabic simple">
<li><p>Try to get the response from the URL, if we get a response, then it is a URL</p></li>
<li><p>If we get an exception, then it is a text</p></li>
</ol>