-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.xml
1127 lines (1089 loc) · 104 KB
/
index.xml
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
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>CoMo Philippines</title>
<link>/</link>
<atom:link href="/index.xml" rel="self" type="application/rss+xml" />
<description>CoMo Philippines</description>
<generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-gb</language><copyright>© CoMo Philippines 2020</copyright><lastBuildDate>Sat, 01 Jun 2030 13:00:00 +0000</lastBuildDate>
<image>
<url>/img/como-ph.png</url>
<title>CoMo Philippines</title>
<link>/</link>
</image>
<item>
<title>Example Page 1</title>
<link>/courses/example/example1/</link>
<pubDate>Sun, 05 May 2019 00:00:00 +0100</pubDate>
<guid>/courses/example/example1/</guid>
<description><p>In this tutorial, I&rsquo;ll share my top 10 tips for getting started with Academic:</p>
<h2 id="tip-1">Tip 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellus ac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam. Quisque risus orci, mollis id ante sit amet, gravida egestas nisl. Sed ac tempus magna. Proin in dui enim. Donec condimentum, sem id dapibus fringilla, tellus enim condimentum arcu, nec volutpat est felis vel metus. Vestibulum sit amet erat at nulla eleifend gravida.</p>
<p>Nullam vel molestie justo. Curabitur vitae efficitur leo. In hac habitasse platea dictumst. Sed pulvinar mauris dui, eget varius purus congue ac. Nulla euismod, lorem vel elementum dapibus, nunc justo porta mi, sed tempus est est vel tellus. Nam et enim eleifend, laoreet sem sit amet, elementum sem. Morbi ut leo congue, maximus velit ut, finibus arcu. In et libero cursus, rutrum risus non, molestie leo. Nullam congue quam et volutpat malesuada. Sed risus tortor, pulvinar et dictum nec, sodales non mi. Phasellus lacinia commodo laoreet. Nam mollis, erat in feugiat consectetur, purus eros egestas tellus, in auctor urna odio at nibh. Mauris imperdiet nisi ac magna convallis, at rhoncus ligula cursus.</p>
<p>Cras aliquam rhoncus ipsum, in hendrerit nunc mattis vitae. Duis vitae efficitur metus, ac tempus leo. Cras nec fringilla lacus. Quisque sit amet risus at ipsum pharetra commodo. Sed aliquam mauris at consequat eleifend. Praesent porta, augue sed viverra bibendum, neque ante euismod ante, in vehicula justo lorem ac eros. Suspendisse augue libero, venenatis eget tincidunt ut, malesuada at lorem. Donec vitae bibendum arcu. Aenean maximus nulla non pretium iaculis. Quisque imperdiet, nulla in pulvinar aliquet, velit quam ultrices quam, sit amet fringilla leo sem vel nunc. Mauris in lacinia lacus.</p>
<p>Suspendisse a tincidunt lacus. Curabitur at urna sagittis, dictum ante sit amet, euismod magna. Sed rutrum massa id tortor commodo, vitae elementum turpis tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean purus turpis, venenatis a ullamcorper nec, tincidunt et massa. Integer posuere quam rutrum arcu vehicula imperdiet. Mauris ullamcorper quam vitae purus congue, quis euismod magna eleifend. Vestibulum semper vel augue eget tincidunt. Fusce eget justo sodales, dapibus odio eu, ultrices lorem. Duis condimentum lorem id eros commodo, in facilisis mauris scelerisque. Morbi sed auctor leo. Nullam volutpat a lacus quis pharetra. Nulla congue rutrum magna a ornare.</p>
<p>Aliquam in turpis accumsan, malesuada nibh ut, hendrerit justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque sed erat nec justo posuere suscipit. Donec ut efficitur arcu, in malesuada neque. Nunc dignissim nisl massa, id vulputate nunc pretium nec. Quisque eget urna in risus suscipit ultricies. Pellentesque odio odio, tincidunt in eleifend sed, posuere a diam. Nam gravida nisl convallis semper elementum. Morbi vitae felis faucibus, vulputate orci placerat, aliquet nisi. Aliquam erat volutpat. Maecenas sagittis pulvinar purus, sed porta quam laoreet at.</p>
<h2 id="tip-2">Tip 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellus ac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam. Quisque risus orci, mollis id ante sit amet, gravida egestas nisl. Sed ac tempus magna. Proin in dui enim. Donec condimentum, sem id dapibus fringilla, tellus enim condimentum arcu, nec volutpat est felis vel metus. Vestibulum sit amet erat at nulla eleifend gravida.</p>
<p>Nullam vel molestie justo. Curabitur vitae efficitur leo. In hac habitasse platea dictumst. Sed pulvinar mauris dui, eget varius purus congue ac. Nulla euismod, lorem vel elementum dapibus, nunc justo porta mi, sed tempus est est vel tellus. Nam et enim eleifend, laoreet sem sit amet, elementum sem. Morbi ut leo congue, maximus velit ut, finibus arcu. In et libero cursus, rutrum risus non, molestie leo. Nullam congue quam et volutpat malesuada. Sed risus tortor, pulvinar et dictum nec, sodales non mi. Phasellus lacinia commodo laoreet. Nam mollis, erat in feugiat consectetur, purus eros egestas tellus, in auctor urna odio at nibh. Mauris imperdiet nisi ac magna convallis, at rhoncus ligula cursus.</p>
<p>Cras aliquam rhoncus ipsum, in hendrerit nunc mattis vitae. Duis vitae efficitur metus, ac tempus leo. Cras nec fringilla lacus. Quisque sit amet risus at ipsum pharetra commodo. Sed aliquam mauris at consequat eleifend. Praesent porta, augue sed viverra bibendum, neque ante euismod ante, in vehicula justo lorem ac eros. Suspendisse augue libero, venenatis eget tincidunt ut, malesuada at lorem. Donec vitae bibendum arcu. Aenean maximus nulla non pretium iaculis. Quisque imperdiet, nulla in pulvinar aliquet, velit quam ultrices quam, sit amet fringilla leo sem vel nunc. Mauris in lacinia lacus.</p>
<p>Suspendisse a tincidunt lacus. Curabitur at urna sagittis, dictum ante sit amet, euismod magna. Sed rutrum massa id tortor commodo, vitae elementum turpis tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean purus turpis, venenatis a ullamcorper nec, tincidunt et massa. Integer posuere quam rutrum arcu vehicula imperdiet. Mauris ullamcorper quam vitae purus congue, quis euismod magna eleifend. Vestibulum semper vel augue eget tincidunt. Fusce eget justo sodales, dapibus odio eu, ultrices lorem. Duis condimentum lorem id eros commodo, in facilisis mauris scelerisque. Morbi sed auctor leo. Nullam volutpat a lacus quis pharetra. Nulla congue rutrum magna a ornare.</p>
<p>Aliquam in turpis accumsan, malesuada nibh ut, hendrerit justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque sed erat nec justo posuere suscipit. Donec ut efficitur arcu, in malesuada neque. Nunc dignissim nisl massa, id vulputate nunc pretium nec. Quisque eget urna in risus suscipit ultricies. Pellentesque odio odio, tincidunt in eleifend sed, posuere a diam. Nam gravida nisl convallis semper elementum. Morbi vitae felis faucibus, vulputate orci placerat, aliquet nisi. Aliquam erat volutpat. Maecenas sagittis pulvinar purus, sed porta quam laoreet at.</p>
</description>
</item>
<item>
<title>Example Page 2</title>
<link>/courses/example/example2/</link>
<pubDate>Sun, 05 May 2019 00:00:00 +0100</pubDate>
<guid>/courses/example/example2/</guid>
<description><p>Here are some more tips for getting started with Academic:</p>
<h2 id="tip-3">Tip 3</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellus ac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam. Quisque risus orci, mollis id ante sit amet, gravida egestas nisl. Sed ac tempus magna. Proin in dui enim. Donec condimentum, sem id dapibus fringilla, tellus enim condimentum arcu, nec volutpat est felis vel metus. Vestibulum sit amet erat at nulla eleifend gravida.</p>
<p>Nullam vel molestie justo. Curabitur vitae efficitur leo. In hac habitasse platea dictumst. Sed pulvinar mauris dui, eget varius purus congue ac. Nulla euismod, lorem vel elementum dapibus, nunc justo porta mi, sed tempus est est vel tellus. Nam et enim eleifend, laoreet sem sit amet, elementum sem. Morbi ut leo congue, maximus velit ut, finibus arcu. In et libero cursus, rutrum risus non, molestie leo. Nullam congue quam et volutpat malesuada. Sed risus tortor, pulvinar et dictum nec, sodales non mi. Phasellus lacinia commodo laoreet. Nam mollis, erat in feugiat consectetur, purus eros egestas tellus, in auctor urna odio at nibh. Mauris imperdiet nisi ac magna convallis, at rhoncus ligula cursus.</p>
<p>Cras aliquam rhoncus ipsum, in hendrerit nunc mattis vitae. Duis vitae efficitur metus, ac tempus leo. Cras nec fringilla lacus. Quisque sit amet risus at ipsum pharetra commodo. Sed aliquam mauris at consequat eleifend. Praesent porta, augue sed viverra bibendum, neque ante euismod ante, in vehicula justo lorem ac eros. Suspendisse augue libero, venenatis eget tincidunt ut, malesuada at lorem. Donec vitae bibendum arcu. Aenean maximus nulla non pretium iaculis. Quisque imperdiet, nulla in pulvinar aliquet, velit quam ultrices quam, sit amet fringilla leo sem vel nunc. Mauris in lacinia lacus.</p>
<p>Suspendisse a tincidunt lacus. Curabitur at urna sagittis, dictum ante sit amet, euismod magna. Sed rutrum massa id tortor commodo, vitae elementum turpis tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean purus turpis, venenatis a ullamcorper nec, tincidunt et massa. Integer posuere quam rutrum arcu vehicula imperdiet. Mauris ullamcorper quam vitae purus congue, quis euismod magna eleifend. Vestibulum semper vel augue eget tincidunt. Fusce eget justo sodales, dapibus odio eu, ultrices lorem. Duis condimentum lorem id eros commodo, in facilisis mauris scelerisque. Morbi sed auctor leo. Nullam volutpat a lacus quis pharetra. Nulla congue rutrum magna a ornare.</p>
<p>Aliquam in turpis accumsan, malesuada nibh ut, hendrerit justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque sed erat nec justo posuere suscipit. Donec ut efficitur arcu, in malesuada neque. Nunc dignissim nisl massa, id vulputate nunc pretium nec. Quisque eget urna in risus suscipit ultricies. Pellentesque odio odio, tincidunt in eleifend sed, posuere a diam. Nam gravida nisl convallis semper elementum. Morbi vitae felis faucibus, vulputate orci placerat, aliquet nisi. Aliquam erat volutpat. Maecenas sagittis pulvinar purus, sed porta quam laoreet at.</p>
<h2 id="tip-4">Tip 4</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellus ac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam. Quisque risus orci, mollis id ante sit amet, gravida egestas nisl. Sed ac tempus magna. Proin in dui enim. Donec condimentum, sem id dapibus fringilla, tellus enim condimentum arcu, nec volutpat est felis vel metus. Vestibulum sit amet erat at nulla eleifend gravida.</p>
<p>Nullam vel molestie justo. Curabitur vitae efficitur leo. In hac habitasse platea dictumst. Sed pulvinar mauris dui, eget varius purus congue ac. Nulla euismod, lorem vel elementum dapibus, nunc justo porta mi, sed tempus est est vel tellus. Nam et enim eleifend, laoreet sem sit amet, elementum sem. Morbi ut leo congue, maximus velit ut, finibus arcu. In et libero cursus, rutrum risus non, molestie leo. Nullam congue quam et volutpat malesuada. Sed risus tortor, pulvinar et dictum nec, sodales non mi. Phasellus lacinia commodo laoreet. Nam mollis, erat in feugiat consectetur, purus eros egestas tellus, in auctor urna odio at nibh. Mauris imperdiet nisi ac magna convallis, at rhoncus ligula cursus.</p>
<p>Cras aliquam rhoncus ipsum, in hendrerit nunc mattis vitae. Duis vitae efficitur metus, ac tempus leo. Cras nec fringilla lacus. Quisque sit amet risus at ipsum pharetra commodo. Sed aliquam mauris at consequat eleifend. Praesent porta, augue sed viverra bibendum, neque ante euismod ante, in vehicula justo lorem ac eros. Suspendisse augue libero, venenatis eget tincidunt ut, malesuada at lorem. Donec vitae bibendum arcu. Aenean maximus nulla non pretium iaculis. Quisque imperdiet, nulla in pulvinar aliquet, velit quam ultrices quam, sit amet fringilla leo sem vel nunc. Mauris in lacinia lacus.</p>
<p>Suspendisse a tincidunt lacus. Curabitur at urna sagittis, dictum ante sit amet, euismod magna. Sed rutrum massa id tortor commodo, vitae elementum turpis tempus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean purus turpis, venenatis a ullamcorper nec, tincidunt et massa. Integer posuere quam rutrum arcu vehicula imperdiet. Mauris ullamcorper quam vitae purus congue, quis euismod magna eleifend. Vestibulum semper vel augue eget tincidunt. Fusce eget justo sodales, dapibus odio eu, ultrices lorem. Duis condimentum lorem id eros commodo, in facilisis mauris scelerisque. Morbi sed auctor leo. Nullam volutpat a lacus quis pharetra. Nulla congue rutrum magna a ornare.</p>
<p>Aliquam in turpis accumsan, malesuada nibh ut, hendrerit justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque sed erat nec justo posuere suscipit. Donec ut efficitur arcu, in malesuada neque. Nunc dignissim nisl massa, id vulputate nunc pretium nec. Quisque eget urna in risus suscipit ultricies. Pellentesque odio odio, tincidunt in eleifend sed, posuere a diam. Nam gravida nisl convallis semper elementum. Morbi vitae felis faucibus, vulputate orci placerat, aliquet nisi. Aliquam erat volutpat. Maecenas sagittis pulvinar purus, sed porta quam laoreet at.</p>
</description>
</item>
<item>
<title>Example Talk</title>
<link>/talk/example/</link>
<pubDate>Sat, 01 Jun 2030 13:00:00 +0000</pubDate>
<guid>/talk/example/</guid>
<description><div class="alert alert-note">
<div>
Click on the <strong>Slides</strong> button above to view the built-in slides feature.
</div>
</div>
<p>Slides can be added in a few ways:</p>
<ul>
<li><strong>Create</strong> slides using Academic&rsquo;s
<a href="https://sourcethemes.com/academic/docs/managing-content/#create-slides" target="_blank" rel="noopener"><em>Slides</em></a> feature and link using <code>slides</code> parameter in the front matter of the talk file</li>
<li><strong>Upload</strong> an existing slide deck to <code>static/</code> and link using <code>url_slides</code> parameter in the front matter of the talk file</li>
<li><strong>Embed</strong> your slides (e.g. Google Slides) or presentation video on this page using
<a href="https://sourcethemes.com/academic/docs/writing-markdown-latex/" target="_blank" rel="noopener">shortcodes</a>.</li>
</ul>
<p>Further talk details can easily be added to this page using <em>Markdown</em> and $\rm \LaTeX$ math code.</p>
</description>
</item>
<item>
<title>Applying sentiment analysis on IATF resolutions</title>
<link>/post/applying-sentiment-analysis/</link>
<pubDate>Tue, 26 May 2020 00:00:00 +0000</pubDate>
<guid>/post/applying-sentiment-analysis/</guid>
<description>
<script src="/rmarkdown-libs/htmlwidgets/htmlwidgets.js"></script>
<script src="/rmarkdown-libs/viz/viz.js"></script>
<link href="/rmarkdown-libs/DiagrammeR-styles/styles.css" rel="stylesheet" />
<script src="/rmarkdown-libs/grViz-binding/grViz.js"></script>
<p><strong>Sentiment analysis</strong> or <strong>opinion mining</strong> as it’s sometimes called is commonly used to assess affective states and subjective information such as opinion and attitudes of subjects of interest using language <a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a>,<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a>. The most common use case of sentiment analysis is on analysing product or service reviews that are made available on the internet but it is increasingly being used in research that aims to quantify public sentiment or opinion. In the advent of Web 2.0 and wide use of various social media platforms alongside much affordable access to increased computing power for most people, the use of sentiment analysis has increased and expanded to various fields such as stock and financial markets, elections, extreme events and disaster, medicine, and policy analysis<sup>1</sup>.</p>
<p>Using the text data on IATF resolutions available from the <a href="https://como-ph.github.io/covidphtext">covidphtext</a> package we developed, we explore the use of <strong>sentiment analysis</strong> as one of several <em>natural language processing (NLP)</em>, <em>text analysis</em> and <em>computational linguistics</em> techniques we plan to use for assessing Philippine government policy with regard to the response to the COVID-19 pandemic. The following workflow illustrates the process we use:</p>
<div class="figure" style="text-align: center"><span id="fig:workflow"></span>
<div id="htmlwidget-1" style="width:576px;height:768px;" class="grViz html-widget"></div>
<script type="application/json" data-for="htmlwidget-1">{"x":{"diagram":"\n digraph sentimentAnalysis {\n\n # a \"graph\" statement\n graph [overlap = false, fontsize = 14, fontname = Helvetica]\n\n # Terminal nodes\n node [shape = oval, width = 1.5, penwidth = 1.5]\n \n a [label = \"Start\"];\n g [label = \"End\"];\n\n # Input/output nodes\n node [shape = parallelogram, height = 1, width = 1.5, penwidth = 1.5]\n \n b [label = \"1. covidphtext\ntext data\"];\n f [label = \"5. Visualise\"];\n\n # Process nodes\n node [shape = rect, fixedsize = true, height = 1, width = 1.5, penwidth = 1.5]\n \n c [label = \"2. Tokenise\ndata\"];\n d [label = \"3. Apply\nsentiment\nlexicon\"];\n e [label = \"4. Summarise\"];\n\n edge [minlen = 2, arrowsize = 1.5, penwidth = 1.5]\n \n a -> b\n b -> c\n c -> d\n c -> e\n d -> e\n e -> f\n f -> g\n\n subgraph {\n rank = same; c; d;\n }\n }","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<p class="caption">
Figure 1: Sentiment analysis workflow
</p>
</div>
<p><br></p>
<div id="step-1-text-data-covidphtext" class="section level2">
<h2>Step 1: Text data: covidphtext</h2>
<p>As described in an earlier <a href="https://como-ph.github.io/post/covidphtext/">post</a>, the <strong>covidphtext</strong> contains IATF resolutions text data structured for the purpose of text analysis. What we need to do now is to combine all resolutions into a single dataset. There is a convenience function in <strong>covidphtext</strong> that helps with this called <code>combine_iatf</code> and is used as follows:</p>
<pre class="r"><code>allText &lt;- covidphtext::combine_iatf(res = c(1:15, 17:46))</code></pre>
<p>You will notice that we left out <strong>IATF Resolution No. 16.</strong>. This resolution is the only resolution that has been written in Filipino (see below).</p>
<pre><code>## # A tibble: 87 x 7
## linenumber text source type id section date
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt;
## 1 1 Inter-Agency Task Force f… IATF resolu… 16 heading 2020-03-30
## 2 2 Additional Guidelines for… IATF resolu… 16 heading 2020-03-30
## 3 3 March 30, 2020 IATF resolu… 16 heading 2020-03-30
## 4 4 Resolution No. 16 IATF resolu… 16 heading 2020-03-30
## 5 5 A. Ayon sa direktiba ng D… IATF resolu… 16 operat… 2020-03-30
## 6 6 Autonomous Region in Musl… IATF resolu… 16 operat… 2020-03-30
## 7 7 mga pasilidad na maaring … IATF resolu… 16 operat… 2020-03-30
## 8 8 Inaatasan and DOT at iban… IATF resolu… 16 operat… 2020-03-30
## 9 9 pagtukoy ng mga pasilidad… IATF resolu… 16 operat… 2020-03-30
## 10 10 Ang mga natukoy na pasili… IATF resolu… 16 operat… 2020-03-30
## # … with 77 more rows</code></pre>
<p>Whilst it is possible to perform multi-lingual sentiment analysis, there is still no reliable <strong>sentiment lexicon</strong> (see following section for definition) for Filipino. Leaving out <strong>IATF Resolution No. 16</strong>, we arrive at the following concatenated IATF resolutions</p>
<pre><code>## # A tibble: 5,774 x 7
## linenumber text source type id section date
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt;
## 1 1 Republic of the Philippin… IATF resolu… 1 heading 2020-01-28
## 2 2 Department of Health IATF resolu… 1 heading 2020-01-28
## 3 3 Office of the Secretary IATF resolu… 1 heading 2020-01-28
## 4 4 Inter-Agency Task Force f… IATF resolu… 1 heading 2020-01-28
## 5 5 Emerging Infectious Disea… IATF resolu… 1 heading 2020-01-28
## 6 6 28 January 2020 IATF resolu… 1 heading 2020-01-28
## 7 7 Resolution No. 01 IATF resolu… 1 heading 2020-01-28
## 8 8 Series of 2020 IATF resolu… 1 heading 2020-01-28
## 9 9 Recommendations for the M… IATF resolu… 1 heading 2020-01-28
## 10 10 Novel Coronavirus Situati… IATF resolu… 1 &lt;NA&gt; 2020-01-28
## # … with 5,764 more rows</code></pre>
<p>with 7 columns and 5774 rows of text. We then consider whether all the sections of a resolution is going to be useful for sentiment analysis. A typical resolution is composed of 3 sections:</p>
<ul>
<li><p><strong>Heading</strong> - contains the <em>body proposing the resolution</em>, the <em>subject of the resolution</em>, the <em>resolution number</em> and the <em>date resolution is issued</em>;</p></li>
<li><p><strong>Preambulatory clauses</strong> - contains the <em>preamble statements of the resolution</em> i.e., the reasons for which the proposing body is addressing the issue and highlights past action done by the body or any other organisation regarding the issue. This is usually composed of a series of phrases that starts with the <strong>WHEREAS</strong></p></li>
<li><p><strong>Operative clauses</strong> - contains phrases/statements that offer solutions to the issues stated in the preamble.These phrases are action-oriented starting with a verb followed by the proposed solution. This section usually starts off with <strong>LET IT BE RESOLVED</strong></p></li>
</ul>
<p>The IATF Resolutions very much follow the aforementioned structure with the addition of a section stating the <strong>approval of the resolution and the signatories</strong> approving the resolution, and in later resolutions a section <strong>certifying</strong> that the resolution has been approved.</p>
<p>For purposes of sentiment analysis, the most meaningful sections to use will be the sections on preambulatory clauses and operative clauses. So, we further subset the concatenated text dataset of IATF Resolutions to only contain those that are preambulatory and operative clauses. You will notice that in the text data of each of the IATF Resolutions, these sections have been identified through the variable named <code>section</code>. We use this variable to filter the sections we need as follows:</p>
<pre class="r"><code>allText &lt;- allText %&gt;%
filter(section %in% c(&quot;preamble&quot;, &quot;operative&quot;))</code></pre>
<p>which results in</p>
<pre><code>## # A tibble: 4,048 x 7
## linenumber text source type id section date
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt;
## 1 11 WHEREAS, Executive Order N… IATF resol… 1 preamb… 2020-01-28
## 2 12 for the Management of Emer… IATF resol… 1 preamb… 2020-01-28
## 3 13 WHEREAS, the Inter-agency … IATF resol… 1 preamb… 2020-01-28
## 4 14 identify, screen, and assi… IATF resol… 1 preamb… 2020-01-28
## 5 15 prevent and/or minimize th… IATF resol… 1 preamb… 2020-01-28
## 6 16 as prevent and/or minimize… IATF resol… 1 preamb… 2020-01-28
## 7 17 WHEREAS, on January 7, 202… IATF resol… 1 preamb… 2020-01-28
## 8 18 the viral pneumonia outbre… IATF resol… 1 preamb… 2020-01-28
## 9 19 (2019-nCoV) that has not b… IATF resol… 1 preamb… 2020-01-28
## 10 20 WHEREAS, as of January 27,… IATF resol… 1 preamb… 2020-01-28
## # … with 4,038 more rows</code></pre>
<p>We are now left with <code>4048</code> rows of text for sentiment analysis.</p>
<p>Finally, we perform some final data cleaning and processing that will be useful when performing sentiment analysis. We convert the word <strong>COVID-19</strong> to <strong>COVID19</strong> without the dash. Since this word will most likely be a critical word in this analysis, we wanted to ensure that we capture it in its entirety. The next step on <strong>tokenisation</strong> removes any punctuation used in the text including dashes and will treat <strong>COVID</strong> as a separate word from <strong>19</strong>. We remove the dash prior to tokenisation so that we can keep these two as one word.</p>
<pre class="r"><code>allText$text &lt;- str_replace_all(string = allText$text,
pattern = &quot;COVID-19&quot;,
replacement = &quot;COVID19&quot;)</code></pre>
<p>And then, anticipating that we will need some kind of grouping variable later in the analysis, we create a <code>month</code> variable within the concatenated text dataset that indicates the month when a specific resolution was issued. This was done as follows:</p>
<pre class="r"><code>allText &lt;- allText %&gt;%
mutate(month = factor(x = months(date),
levels = c(&quot;January&quot;, &quot;February&quot;, &quot;March&quot;,
&quot;April&quot;, &quot;May&quot;, &quot;June&quot;)))</code></pre>
<p>Our final working text dataset is this:</p>
<pre><code>## # A tibble: 4,048 x 8
## linenumber text source type id section date month
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt; &lt;fct&gt;
## 1 11 WHEREAS, Executive O… IATF resol… 1 preamb… 2020-01-28 Janu…
## 2 12 for the Management o… IATF resol… 1 preamb… 2020-01-28 Janu…
## 3 13 WHEREAS, the Inter-a… IATF resol… 1 preamb… 2020-01-28 Janu…
## 4 14 identify, screen, an… IATF resol… 1 preamb… 2020-01-28 Janu…
## 5 15 prevent and/or minim… IATF resol… 1 preamb… 2020-01-28 Janu…
## 6 16 as prevent and/or mi… IATF resol… 1 preamb… 2020-01-28 Janu…
## 7 17 WHEREAS, on January … IATF resol… 1 preamb… 2020-01-28 Janu…
## 8 18 the viral pneumonia … IATF resol… 1 preamb… 2020-01-28 Janu…
## 9 19 (2019-nCoV) that has… IATF resol… 1 preamb… 2020-01-28 Janu…
## 10 20 WHEREAS, as of Janua… IATF resol… 1 preamb… 2020-01-28 Janu…
## # … with 4,038 more rows</code></pre>
<p><br></p>
</div>
<div id="step-2-tokenise-data" class="section level2">
<h2>Step 2: Tokenise data</h2>
<p>We are now ready to <strong>tokenise</strong> the data. <strong>Tokenisation</strong> of text data simply means structuring the text data into <strong>tokens</strong> – meaningful units of text such as a word, or groups of words, or a sentence, or a paragraph. For sentiment analysis, the most useful token will be a word mainly because the <strong>sentiment lexicons</strong> (see following section for definition) we plan to use are based on words.</p>
<p>We use the <a href="https://juliasilge.github.io/tidytext/">tidytext</a> package and the function <code>unnest_tokens</code> within it to perform <strong>tokenisation</strong> using words as follows:</p>
<pre class="r"><code>tidy_resolutions &lt;- allText %&gt;%
unnest_tokens(output = word, input = text)</code></pre>
<p>This results in the following dataset:</p>
<pre><code>## # A tibble: 40,024 x 8
## linenumber source type id section date month word
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt; &lt;fct&gt; &lt;chr&gt;
## 1 11 IATF resolution 1 preamble 2020-01-28 January whereas
## 2 11 IATF resolution 1 preamble 2020-01-28 January executive
## 3 11 IATF resolution 1 preamble 2020-01-28 January order
## 4 11 IATF resolution 1 preamble 2020-01-28 January no
## 5 11 IATF resolution 1 preamble 2020-01-28 January 168
## 6 11 IATF resolution 1 preamble 2020-01-28 January s
## 7 11 IATF resolution 1 preamble 2020-01-28 January 2014
## 8 11 IATF resolution 1 preamble 2020-01-28 January creates
## 9 11 IATF resolution 1 preamble 2020-01-28 January the
## 10 11 IATF resolution 1 preamble 2020-01-28 January inter
## # … with 40,014 more rows</code></pre>
<p>You will notice that our new tokenised dataset is structured such that each word in the concatenated IATF Resolutions of preambles and operative clauses is a unit of data i.e. in a row. We now have a dataset with <code>40024</code> rows and <code>8</code> columns that we can use for the next step.</p>
<p><br></p>
</div>
<div id="step-3-apply-sentiment-lexicon" class="section level2">
<h2>Step 3: Apply sentiment lexicon</h2>
<p>We now apply a <strong>sentiment lexicon</strong> onto the tokenised dataset from the previous step. <strong>Sentiment lexicons</strong> are basically a list of common words in a specific language with each word having a value pertaining to the sentiment or emotion associated with a specific word. The value assigned to a word can be binary i.e. negative or positive, or can be categories of sentiments or emotions such as positive, negative, anger, anticipation, disgust, fear, joy, sadness, surprise, and trust, or a numerical value on a scale that runs from negative values indicating progressively negative sentiments to positive values indicating progressively positive sentiments.</p>
<p>The <a href="https://juliasilge.github.io/tidytext/">tidytext</a> package comes with three general use lexicons:</p>
<ul>
<li><p><code>AFINN</code> - from Finn Årup Nielsen which is a lexicon that assigns a score to words from -5 to +5 with negative scores indicating negative sentiments and positive scores indicating positive sentiments;</p></li>
<li><p><code>bing</code> - from Bing Liu and collaborators which is a lexicon that simply classifies words into either negative or positive categories; and,</p></li>
<li><p><code>nrc</code> - from Saif Mohammad and Peter Turney which is a lexicon that groups words into categories of positive, negative, anger, anticipation, disgust, fear, joy, sadness, surprise, or trust</p></li>
</ul>
<p>Below we describe how to apply these sentiment lexicons to the tokenised data. The techniques described below in applying sentiment onto a text dataset are not the only ways to approach sentiment analysis but they are the most basic and common approaches used. These approaches treat the text dataset as a <em>“bag of words”</em> such that the sentiment content of the whole dataset is the sum of the sentiment content of each of the words in the dataset.</p>
<div id="labeling-words-in-the-dataset-as-having-positive-or-negative-sentiment" class="section level3">
<h3>Labeling words in the dataset as having positive or negative sentiment</h3>
<p>We apply the sentiment lexicon from <em>Bing and colleagues</em> to our tokenised data as follows:</p>
<pre class="r"><code>resolution_sentiment_bing &lt;- tidy_resolutions %&gt;%
inner_join(get_sentiments(&quot;bing&quot;))</code></pre>
<p>What we are basically doing here is to match the words in our tokenised data with the words in the sentiment lexicon from <em>Bing and colleagues</em> to get the sentiment value of positive or negative for our tokenised data. This results in the following sentiment-orientated IATF word token dataset:</p>
<pre><code>## # A tibble: 1,303 x 9
## linenumber source type id section date month word sentiment
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt; &lt;fct&gt; &lt;chr&gt; &lt;chr&gt;
## 1 14 IATF resolu… 1 preamble 2020-01-28 Janua… infected negative
## 2 15 IATF resolu… 1 preamble 2020-01-28 Janua… well positive
## 3 18 IATF resolu… 1 preamble 2020-01-28 Janua… outbreak negative
## 4 21 IATF resolu… 1 preamble 2020-01-28 Janua… risk negative
## 5 21 IATF resolu… 1 preamble 2020-01-28 Janua… infecti… negative
## 6 25 IATF resolu… 1 operati… 2020-01-28 Janua… recomme… positive
## 7 26 IATF resolu… 1 operati… 2020-01-28 Janua… support positive
## 8 26 IATF resolu… 1 operati… 2020-01-28 Janua… accurate positive
## 9 27 IATF resolu… 1 operati… 2020-01-28 Janua… timely positive
## 10 27 IATF resolu… 1 operati… 2020-01-28 Janua… support positive
## # … with 1,293 more rows</code></pre>
</div>
<div id="labeling-words-in-the-dataset-as-having-a-specific-type-of-sentiment-or-emotion" class="section level3">
<h3>Labeling words in the dataset as having a specific type of sentiment or emotion</h3>
<p>Using the <code>nrc</code> lexicon, we use the same approach as the previous:</p>
<pre class="r"><code>resolution_sentiment_nrc &lt;- tidy_resolutions %&gt;%
inner_join(get_sentiments(&quot;nrc&quot;))</code></pre>
<p>which results in a tokenised dataset of words with associated sentiments or emotions alongside them as shown below:</p>
<pre><code>## # A tibble: 8,028 x 9
## linenumber source type id section date month word sentiment
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt; &lt;fct&gt; &lt;chr&gt; &lt;chr&gt;
## 1 11 IATF resolut… 1 preamble 2020-01-28 Janua… inter negative
## 2 11 IATF resolut… 1 preamble 2020-01-28 Janua… inter sadness
## 3 11 IATF resolut… 1 preamble 2020-01-28 Janua… task positive
## 4 11 IATF resolut… 1 preamble 2020-01-28 Janua… force anger
## 5 11 IATF resolut… 1 preamble 2020-01-28 Janua… force fear
## 6 11 IATF resolut… 1 preamble 2020-01-28 Janua… force negative
## 7 12 IATF resolut… 1 preamble 2020-01-28 Janua… manage… positive
## 8 12 IATF resolut… 1 preamble 2020-01-28 Janua… manage… trust
## 9 12 IATF resolut… 1 preamble 2020-01-28 Janua… infect… disgust
## 10 12 IATF resolut… 1 preamble 2020-01-28 Janua… infect… fear
## # … with 8,018 more rows</code></pre>
</div>
<div id="scoring-words-by-their-level-of-positive-or-negative-sentiment" class="section level3">
<h3>Scoring words by their level of positive or negative sentiment</h3>
<p>Using the <code>AFINN</code> lexicon, we use the same approach as the previous:</p>
<pre class="r"><code>resolution_sentiment_afinn &lt;- tidy_resolutions %&gt;%
inner_join(get_sentiments(&quot;afinn&quot;))</code></pre>
<p>which results in a tokenised dataset of words with associated sentiment scores ranging from -5 (highly negative) to +5 (highly positive).</p>
<p><br></p>
</div>
</div>
<div id="step-4-and-5-summarise-sentiment-orientated-word-token-dataset-and-visualise-summaries" class="section level2">
<h2>Step 4 and 5: Summarise sentiment-orientated word token dataset and visualise summaries</h2>
<p>We can now make various summaries with the sentiment-orientated datasets from the previous step and then visualise the output. Summaries and visualisation go hand-in-hand and these steps will be influenced by what questions you want answered by the sentiment analysis. Here we ask some questions with regard to sentiments in the IATF resolutions and demonstrate how we can summarise and visualise the data to answer the questions.</p>
<div id="question-1-how-does-the-sentiment-change-throughout-each-resolution-and-over-time" class="section level3">
<h3>Question 1: How does the sentiment change throughout each resolution and over time?</h3>
<p>To answer this question, we count how many positive and negative words there are in a specified block of text in the resolutions (referred to as the <em>index</em>). To decide what a meaningful block of text or <em>index</em> would be for a resolution, we need to remember that resolutions tend to be written in a very structured and concise way and that meaning can already be derived within short chunks of text. So, for this, we use an index of 5 lines at most.</p>
<p>We perform this using the tokenised dataset <code>resolution_sentiment_bing</code> which has a binary sentiment value of positive or negative:</p>
<pre class="r"><code>resolution_sentiment_bing %&gt;%
count(id, date, index = linenumber %/% 5, sentiment) %&gt;%
spread(sentiment, n, fill = 0) %&gt;%
mutate(sentiment = positive - negative)</code></pre>
<pre><code>## # A tibble: 631 x 6
## id date index negative positive sentiment
## &lt;dbl&gt; &lt;date&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
## 1 1 2020-01-28 2 1 0 -1
## 2 1 2020-01-28 3 1 1 0
## 3 1 2020-01-28 4 2 0 -2
## 4 1 2020-01-28 5 0 6 6
## 5 1 2020-01-28 6 3 0 -3
## 6 2 2020-01-31 2 0 2 2
## 7 2 2020-01-31 3 1 2 1
## 8 2 2020-01-31 4 1 0 -1
## 9 2 2020-01-31 5 2 0 -2
## 10 2 2020-01-31 6 0 1 1
## # … with 621 more rows</code></pre>
<p>We then visualise this output using a bar chart for each resolution as shown below:</p>
<div class="figure" style="text-align: center"><span id="fig:senPlot1a"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/senPlot1a-1.png" alt="Sentiment change throughout each resolution" width="1200" />
<p class="caption">
Figure 2: Sentiment change throughout each resolution
</p>
</div>
<p>In interpreting our output to answer the question, we can treat each of the individual bar charts as describing what the pattern of sentiment is within a single resolution (as each resolution have been issued on a specific date) and we can think of the whole collection of bar charts by date as a time-series given that each resolution was issued chronologically from January up to current date. So, in the bar chart, moving from left to right starting from the first row of bar charts to the last, we are seeing the progression of sentiments in the IATF over time since January to current date.</p>
<p>General observations are:</p>
<ul>
<li><p>No discernible and consistent intra-resolution pattern of sentiment. This is interesting given that we took both the preambulatory and operative clauses section only which by definition can each have a different tone and sentiment. A naive assumption can be that preambulatory clauses section can be more negative in that it states the issues that are being resolved by the resolution whilst the operative clauses section is meant to be action oriented hence more positive. But given that the whole topic is about a pandemic and its control, actions taken to address the issue can be negative such as quarantine, lockdown, limitation of movement, etc.</p></li>
<li><p>The resolutions start out as relatively shorter texts from January 2020 up to 9 March 2020 (first 2 rows of bar charts). By the 12th of March 2020, the amount of text increases to an almost consistent amount up to current date except during the period of the second week of April 2020;</p></li>
<li><p>Resolutions issued from January 2020 to 3 April 2020 tended to be more negative whilst resolutions after this date tended to be more positive.</p></li>
</ul>
</div>
<div id="question-2-how-does-the-sentiment-change-by-month" class="section level3">
<h3>Question 2: How does the sentiment change by month?</h3>
<p>In the previous question and in the outputs we produced to provide answers to that question, no clear patterns showed based on a resolution-by-resolution summary and visualisation. In this question, the level of aggregation is by month which will mean at least 2-3 resolutions grouped together. We perform this summary as follows:</p>
<pre class="r"><code>resolution_sentiment_bing %&gt;%
count(month, index = linenumber %/% 5, sentiment) %&gt;%
spread(sentiment, n, fill = 0) %&gt;%
mutate(sentiment = positive - negative)</code></pre>
<pre><code>## # A tibble: 207 x 5
## month index negative positive sentiment
## &lt;fct&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
## 1 January 2 1 2 1
## 2 January 3 2 3 1
## 3 January 4 3 0 -3
## 4 January 5 2 6 4
## 5 January 6 3 1 -2
## 6 January 7 1 1 0
## 7 January 8 1 1 0
## 8 January 9 0 1 1
## 9 January 10 0 1 1
## 10 January 11 2 0 -2
## # … with 197 more rows</code></pre>
<p>We then visualise this in a similar manner as above but with months as the grouping variable. We get the following output:</p>
<div class="figure" style="text-align: center"><span id="fig:senPlot1b"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/senPlot1b-1.png" alt="Sentiment change by month" width="1152" />
<p class="caption">
Figure 3: Sentiment change by month
</p>
</div>
<p>With this summary and visualisation, we confirm our earlier observation of resolutions being shorter texts in January and February 2020. Also, there is a more discernible intra-month pattern of sentiment particularly starting in March 2020 onwards. March 2020 starts off in a more negative which then picks up as more positive later on. April 2020 on the other hand is predominantly positive. May 2020 has the most amount of text (most number of resolutions). Earlier resolutions in May 2020 were highly positive which eventually tapers off to a mix of sentiments moving forward. By June 2020, the sentiments seem to be returning to something similar to the January to February 2020 pattern of relatively more positive sentiments.</p>
</div>
<div id="question-3-what-is-the-sentiment-change-across-all-resolutions" class="section level3">
<h3>Question 3: What is the sentiment change across all resolutions?</h3>
<p>We’ve summarised the sentiments by resolution by month. Now we’d like to see what the overall progression of sentiment is through the full body of text of preambles and operative clauses. We summarise and visualise the data as follows:</p>
<pre class="r"><code>resolution_sentiment_bing &lt;- tidy_resolutions %&gt;%
inner_join(get_sentiments(&quot;bing&quot;)) %&gt;%
count(index = linenumber %/% 5, sentiment) %&gt;%
spread(sentiment, n, fill = 0) %&gt;%
mutate(sentiment = positive - negative)
ggplot(resolution_sentiment_bing, aes(index, sentiment)) +
geom_col(colour = &quot;#18BC9C&quot;,
fill = &quot;#18BC9C&quot;,
alpha = 0.7,
show.legend = FALSE) +
theme_como</code></pre>
<div class="figure" style="text-align: center"><span id="fig:senPlot1c"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/senPlot1c-1.png" alt="Sentiment change across all resolutions" width="1152" />
<p class="caption">
Figure 4: Sentiment change across all resolutions
</p>
</div>
<p>Strongly positive sentiment early on in the text (earlier resolutions in the January to February 2020 period) which then tapers off in March 2020. From then onwards, its been a relatively even mix of positive and negative sentiments.</p>
</div>
<div id="question-4-which-words-contribute-the-most-to-positive-and-negative-sentiments" class="section level3">
<h3>Question 4: Which words contribute the most to positive and negative sentiments?</h3>
<p>Now what we know the trend of sentiments in the resolutions across time and overall, we’d like to know which words contribute the most to positive and negative sentiments. We summarise and visualise the data to answer this question as follows:</p>
<div class="figure" style="text-align: center"><span id="fig:sentiment2a"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/sentiment2a-1.png" alt="Top ten words that contribute to positive and negative sentiment" width="960" />
<p class="caption">
Figure 5: Top ten words that contribute to positive and negative sentiment
</p>
</div>
<p>Another way of visualising the same information:</p>
<div class="figure" style="text-align: center"><span id="fig:sentiment2b"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/sentiment2b-1.png" alt="Top ten words that contribute to positive and negative sentiment" width="768" />
<p class="caption">
Figure 6: Top ten words that contribute to positive and negative sentiment
</p>
</div>
<p>These top ten words contributing to positive and negative sentiments are consistent with what we would expect from a body of text that talk about a health emergency i.e., pandemic and consistent with the nature of the text itself i.e., resolutions which talk about the issues related to the situation/context and actions to be taken in response.</p>
</div>
<div id="question-5-what-is-the-overall-sentiment-value-of-each-resolution" class="section level3">
<h3>Question 5: What is the overall sentiment value of each resolution?</h3>
<div class="figure" style="text-align: center"><span id="fig:sentiment3c"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/sentiment3c-1.png" alt="Average sentiment value per resolution" width="768" />
<p class="caption">
Figure 7: Average sentiment value per resolution
</p>
</div>
<p>Eight out of the 46 resolutions analysed had a negative average sentiment value. These resolutions were during the early stages of the response (January 2020) and in the height of the response (late April 2020 to May 2020).</p>
</div>
<div id="question-6-what-is-the-average-sentiment-value-contribution-of-specific-words" class="section level3">
<h3>Question 6: What is the average sentiment value contribution of specific words</h3>
<p>To answer this question we use the <code>AFINN</code> sentiment lexicon which assigns a numerical score for positive and negative sentiments ranging from -5 to +5 respectively. Once we have assigned sentiment scores to the words, we do a counting of the words and then calculate a sentiment value per word by multiplying the sentiment score for the word with the proportion of the frequency of the word with the total frequency of all the words.</p>
<p><span class="math display">\[ \text{Sentiment value} ~ = ~ \text{Sentiment score} ~ \times ~ \frac{\text{Word frequency}}{\sum{\text{World frequency}}}\]</span></p>
<p>To get to this answer, we summarise and visualise the data as follows:</p>
<div class="figure" style="text-align: center"><span id="fig:sentiment4a"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/sentiment4a-1.png" alt="Sentiment value of words across all resolutions" width="1152" />
<p class="caption">
Figure 8: Sentiment value of words across all resolutions
</p>
</div>
<p>Of the top ten most frequent words from all the resolutions, 6 have positive sentiment value and 4 with negative sentiment value. All top ten words are indicative of the nature of the text dataset that we are analysing. The top words for positive sentiment have roughly similar sentiment value as the top words for negative sentiment.</p>
<p>We disaggregate the results for resolutions per month as below:</p>
<div class="figure" style="text-align: center"><span id="fig:sentiment4b"></span>
<img src="/post/applying-sentiment-analysis/index_files/figure-html/sentiment4b-1.png" alt="Sentiment value of words across all resolutions by month" width="1440" />
<p class="caption">
Figure 9: Sentiment value of words across all resolutions by month
</p>
</div>
<p>Resolutions for April and May mirror the words and the sentiment value for the entire dataset.</p>
<p><br>
<br></p>
</div>
</div>
<div class="footnotes">
<hr />
<ol>
<li id="fn1"><p>Mäntylä MV, Graziotin D, Kuutila M. The evolution of sentiment analysis—A review of research topics, venues, and top cited papers. Computer Science Review. 2018;27: 16–32. <a href="doi:10.1016/j.cosrev.2017.10.002" class="uri">doi:10.1016/j.cosrev.2017.10.002</a><a href="#fnref1" class="footnote-back">↩︎</a></p></li>
<li id="fn2"><p>Liu B. Handbook Chapter: Sentiment Analysis and Subjectivity. Handbook of Natural Language Processing, Handbook of Natural Language Processing, Marcel Dekker, Inc. New York, NY, USA (2009)<a href="#fnref2" class="footnote-back">↩︎</a></p></li>
</ol>
</div>
</description>
</item>
<item>
<title>Use of text analysis and topic modelling in policy analysis</title>
<link>/project/topic-modelling/</link>
<pubDate>Tue, 26 May 2020 00:00:00 +0000</pubDate>
<guid>/project/topic-modelling/</guid>
<description><p>In this project we explore the potential use of text anlaysis and topic modelling in assessing and potentially measuring the impact of various methematical modelling efforts in shaping government policy with regard to responding to the COVID-19 pandemic.</p>
<p>We propose to use the Philippines as a case study for this research. Several groups and individuals within the Philippines have proferred predictions on the course of the pandemic in the country. Particularly, these groups or individuals have predicted through their models the possible effects of various non-pharmaceutical interventions on the evolution of the pandemic particularly on the numbers of cases and deaths and their temporal and spatial distribution. Based on these, they have offered recommendations on what should be done further to mitigate these predicted outcomes. On the other hand, the national government has indicated that it will make policies and take action based on scientific evidence and has even commissioned a team of scientists to specifically perform mathenmatical modelling to generate this scientific evidence to guide its policy making.</p>
<p>We propose to quantify the impact of the best available scientific evidence with regard to the COVID-19 pandemic on the policies formulated and enacted by the Philippine government. Specifically, we will measure the degree of fit between the themes/topics focused on by the government&rsquo;s policies with the themes/topics of the recommendations based on the scientific evidence using text analysis and topic modelling.</p>
<br>
<br>
</description>
</item>
<item>
<title>Creating text data from IATF resolutions for use in text analysis</title>
<link>/post/creating-text-data-from-iatf-resolutions/</link>
<pubDate>Fri, 22 May 2020 00:00:00 +0000</pubDate>
<guid>/post/creating-text-data-from-iatf-resolutions/</guid>
<description>
<script src="/rmarkdown-libs/htmlwidgets/htmlwidgets.js"></script>
<script src="/rmarkdown-libs/d3/d3.min.js"></script>
<script src="/rmarkdown-libs/dagre/dagre-d3.min.js"></script>
<link href="/rmarkdown-libs/mermaid/dist/mermaid.css" rel="stylesheet" />
<script src="/rmarkdown-libs/mermaid/dist/mermaid.slim.min.js"></script>
<link href="/rmarkdown-libs/DiagrammeR-styles/styles.css" rel="stylesheet" />
<script src="/rmarkdown-libs/chromatography/chromatography.js"></script>
<script src="/rmarkdown-libs/DiagrammeR-binding/DiagrammeR.js"></script>
<p>In line with our proposed project on use of text analysis and topic modelling for conducting policy analysis in relation to the <strong>COVID-19</strong> pandemic response in the Philippines, we first had to identify what sources of text were most appropriate for our purpose and then assess how we can extract text from these sources for our purposes. We knew it was always going to be a balance between having the most ideal sources of text data for what we want to do and those sources that could be mined of their text data in a reasonably efficient way.</p>
<p>In our search for sources, we found out about the IATF and its role/mandate to respond to the issues concerning emerging infectious diseases in the Philippines. The IATF was convened in early January 2020 in response to the growing outbreak in Wuhan, China. Since then, we found that the task force has released several resolutions that reflected the national government’s on-going assessment of the evolution and spread of COVID-19 and it’s intended response. Given this, we felt that the IATF resolutions were the key manifestation of the national government’s overarching policy with regard go the COVID-19 pandemic from which other more detailed and specific departmental and sub-national policies were derived from.</p>
<p>We noted that the <a href="https://www.doh.gov.ph">Department of Health</a>, which chairs the IATF, have routinely uploaded to their <a href="http://doh.gov.ph/COVID-19/IATF-Resolutions">website</a> copies of resolutions once they have been formally endorsed and signed by all departmental members. We later found out that IATF resolutions were also released via the country’s official journal, <a href="https://www.officialgazette.gov.ph">The Official Gazette</a>, online via its <a href="https://www.officialgazette.gov.ph/section/laws/other-issuances/inter-agency-task-force-for-the-management-of-emerging-infectious-diseases-resolutions/">website</a>. Based on these considerations, we decided to focus on using the IATF resolutions for our policy analysis project.</p>
<p>The next challenge was how to extract the text from these resolutions into a data structure and format useful for text analysis and topic modelling. In this post, we describe how we used the <a href="https://www.r-project.org">R language for statistical computing</a> to develop a supervised text extraction workflow described in the diagram below:</p>
<div class="figure" style="text-align: center"><span id="fig:workflow"></span>
<div id="htmlwidget-1" style="width:768px;height:800px;" class="DiagrammeR html-widget"></div>
<script type="application/json" data-for="htmlwidget-1">{"x":{"diagram":"\n graph TD\n X(START) --> A[1. Download PDF] \n A --> B[2. Read PDF]\n B --> C[3. Clean text data]\n C --> D[4. Structure text data]\n D --> E[5. Save data]\n E --> Y(END)\n "},"evals":[],"jsHooks":[]}</script>
<p class="caption">
Figure 1: Text extraction workflow in R
</p>
</div>
<div id="step-1-downloading-the-resolutions" class="section level2">
<h2>Step 1: Downloading the resolutions</h2>
<p>The resolutions are available either from the <a href="https://www.doh.gov.ph">DoH</a> <a href="https://www.doh.gov.ph/COVID-19/IATF-Resolutions">website</a> or from <a href="https://www.officialgazette.gov.ph">The Official Gazette</a> <a href="https://www.officialgazette.gov.ph/section/laws/other-issuances/inter-agency-task-force-for-the-management-of-emerging-infectious-diseases-resolutions/">website</a>. There are two key differences between these two sources. First, the <a href="https://www.doh.gov.ph">DoH</a> only provides resolutions starting from March 2020 at Resolution No. 9. Second, the <a href="https://www.doh.gov.ph">DoH</a> uploads the most recent resolutions a little bit later than <a href="https://www.officialgazette.gov.ph">The Official Gazette</a>.</p>
<p>We automated the bulk download of all available resolutions from either sources in <a href="https://www.r-project.org">R</a> by first creating a function that reads the HTML page/s for the resolutions and extracting the download links/URLs for each available resolution. Then, using these links, we created another function that downloads the PDFs into a temporary directory which can then be accessed for the next step of the workflow.</p>
<div id="extracting-download-linksurls-of-resolutions" class="section level3">
<h3>Extracting download links/URLs of resolutions</h3>
<p>To extract download links/URLs of resolutions from either sources, we created wrappers around web scraping functions in the <a href="https://rvest.tidyverse.org">rvest</a> package.</p>
<p>For the resolutions in the <a href="https://www.doh.gov.ph">DoH</a> website, we created the function <code>get_iatf_links</code>. This function only requires a single argument termed <code>base</code> which is the URL of the <a href="https://www.doh.gov.ph">DoH</a> webpage for IATF resolutions. The current URL for this is at <a href="https://www.doh.gov.ph/COVID-19/IATF-Resolutions" class="uri">https://www.doh.gov.ph/COVID-19/IATF-Resolutions</a> and this is what is used as default value for <code>base</code>. So, to get the links/URLs for the resolutions found in the <a href="https://www.doh.gov.ph">DoH</a> website, we use:</p>
<pre class="r"><code>get_iatf_links()</code></pre>
<p>which gives the following:</p>
<pre><code>## # A tibble: 41 x 7
## id title date source type url checked
## &lt;dbl&gt; &lt;chr&gt; &lt;date&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;date&gt;
## 1 9 Recommendations f… 2020-03-03 IATF reso… https://doh.gov.… 2020-06-17
## 2 10 Recommendations f… 2020-03-09 IATF reso… https://doh.gov.… 2020-06-17
## 3 11 Recommendations f… 2020-03-12 IATF reso… https://doh.gov.… 2020-06-17
## 4 12 Recommendations f… 2020-03-13 IATF reso… https://doh.gov.… 2020-06-17
## 5 13 Recommendations f… 2020-03-17 IATF reso… https://doh.gov.… 2020-06-17
## 6 14 Resolutions Relat… 2020-03-20 IATF reso… https://doh.gov.… 2020-06-17
## 7 15 Resolutions Relat… 2020-03-25 IATF reso… https://doh.gov.… 2020-06-17
## 8 16 Additional Guidel… 2020-03-30 IATF reso… https://doh.gov.… 2020-06-17
## 9 17 Recommendations R… 2020-03-30 IATF reso… https://doh.gov.… 2020-06-17
## 10 18 Recommendations R… 2020-04-01 IATF reso… https://doh.gov.… 2020-06-17
## # … with 31 more rows</code></pre>
<p>The result is a <code>tibble</code> with 7 columns and the number of rows equal to the number of resolutions available from the <a href="https://www.doh.gov.ph">DoH</a> website on the day the output was produced. The column named <code>checked</code> in the output indicates when it was produced. The number of rows of the output may change between two calls to this function as newer resolution/s may have been uploaded from the time the first call was made to the time the second call was made.</p>
<p>For the resolutions in <a href="https://www.officialgazette.gov.ph">The Official Gazette</a>, we created the <code>get_iatf_gazette</code> function. As with the <code>get_iatf_links</code> function, this requires the URL to the IATF resolutions webpage in <a href="https://www.officialgazette.gov.ph">The Official Gazette</a> which is set at <a href="https://www.officialgazette.gov.ph/section/laws/other-issuances/inter-agency-task-force-for-the-management-of-emerging-infectious-diseases-resolutions/" class="uri">https://www.officialgazette.gov.ph/section/laws/other-issuances/inter-agency-task-force-for-the-management-of-emerging-infectious-diseases-resolutions/</a>. However, a second argument named <code>pages</code> is required. Unlike the <a href="https://www.doh.gov.ph">DoH</a> page that has all the download links to the resolutions available on a single page, <a href="https://www.officialgazette.gov.ph">The Official Gazette</a> uses pagination to split the information on download links into multiple pages. To be able to get the links of all the resolutions, we would need to supply a vector of the page numbers of all the pages that contains the download links. So, to get the links/URLs for all available resolutions found in the <a href="https://www.officialgazette.gov.ph">The Official Gazette</a> website, we use:</p>
<pre class="r"><code>get_iatf_gazette(pages = 1:6)</code></pre>
<p>after determining from the website that the download links are contained in 6 pages.</p>
<p>This gives the following result:</p>
<pre><code>## # A tibble: 53 x 7
## id title date source type url checked
## &lt;dbl&gt; &lt;chr&gt; &lt;date&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;date&gt;
## 1 46 RESOLUTION NO. 46… 2020-06-15 IATF reso… https://www.offi… 2020-06-17
## 2 46 RESOLUTION NO. 46… 2020-06-15 IATF reso… https://www.offi… 2020-06-17
## 3 45 RESOLUTION NO. 45… 2020-06-10 IATF reso… https://www.offi… 2020-06-17
## 4 44 RESOLUTION NO. 44… 2020-06-08 IATF reso… https://www.offi… 2020-06-17
## 5 NA OMNIBUS GUIDELINE… 2020-06-03 IATF reso… https://www.offi… 2020-06-17
## 6 43 RESOLUTION NO. 43… 2020-06-03 IATF reso… https://www.offi… 2020-06-17
## 7 42 RESOLUTION NO. 42… 2020-06-01 IATF reso… https://www.offi… 2020-06-17
## 8 41 RESOLUTION NO. 41… 2020-05-29 IATF reso… https://www.offi… 2020-06-17
## 9 40 RESOLUTION NO. 40… 2020-05-27 IATF reso… https://www.offi… 2020-06-17
## 10 NA OMNIBUS GUIDELINE… 2020-05-22 IATF reso… https://www.offi… 2020-06-17
## # … with 43 more rows</code></pre>
<p>Notice that the ouput is the same in class and structure as the output of the previous function the only difference being that this produces more rows. This is because, as already mentioned earlier, <a href="https://www.officialgazette.gov.ph">The Official Gazette</a> has the first 8 resolutions issued in January and February 2020 and is updated soon after resolutions are endorsed and signed by the IATF compared to that of the <a href="https://www.doh.gov.ph">DoH</a>.</p>
</div>
<div id="downloading-the-resolutions" class="section level3">
<h3>Downloading the resolutions</h3>
<p>The most important information from the output from either functions is the column named <code>url</code> as this contains the links/URLs to the PDFs of the various resolutions.</p>
<p>We automated the download of the resolution PDFs from the <a href="https://www.doh.gov.ph">DoH</a> site using a convenience function called <code>get_iatf_pdf</code>. In this function, the user can choose which specific resolution to download by specifying the argument <code>id</code>. If the user wants to download the PDF for Resolution No. 29, the following call is made:</p>
<pre class="r"><code>iatfLinks %&gt;%
get_iatf_pdf(id = 29)</code></pre>
<p>which gives the following output:</p>
<pre><code>## [1] &quot;/var/folders/rx/nr32tl5n6f3d_86tn0tc7kc00000gp/T//RtmpEQY0KS/iatfResolution29.pdf&quot;</code></pre>
<p>The output is a character vector of the path to the temporary directory created where the PDF for Resolution No. 29 has been stored under the filename <strong>iatfResolution29.pdf</strong>.</p>
<p>It is considered best practice for a function that downloads something from the internet to save this download into a temporary directory as this is more secure and potentially less harmful for the user. It is also advantageous for the user as the PDFs do not have to be saved into the local computer but instead immediately read and used in <a href="https://www.r-project.org">R</a>.</p>
</div>
</div>
<div id="steps-2-3-and-4-reading-cleaning-and-structuring-text-data-from-the-resolutions" class="section level2">
<h2>Steps 2, 3 and 4: Reading, cleaning and structuring text data from the resolutions</h2>
<p>These steps form the supervised component of the workflow.</p>
<p>Using the output from the previous step, the PDF/s can be read into <a href="https://www.r-project.org">R</a> using the <a href="https://ropensci.org/blog/2016/03/01/pdftools-and-jeroen/">pdftools</a> package. Typically, reading a PDF with <a href="https://ropensci.org/blog/2016/03/01/pdftools-and-jeroen/">pdftools</a> would be as straightforward as:</p>
<pre class="r"><code>pdftools::pdf_text(pdf = &quot;PATH/TO/PDF&quot;)</code></pre>
<p>However, the IATF resolutions have been released as downloadable PDF documents produced by scanning the hard copy, signed versions of the resolutions. This type of PDF requires a different function from the <a href="https://ropensci.org/blog/2016/03/01/pdftools-and-jeroen/">pdftools</a> package to extract the data:</p>
<pre class="r"><code>pdftools::pdf_ocr_text(pdf = &quot;PATH/TO/SCANNED/PDF&quot;)</code></pre>
<p>Whilst this type of document format can be read by <a href="https://ropensci.org/blog/2016/03/01/pdftools-and-jeroen/">pdftools</a> package, the extracted text often requires a lot of manual cleaning and some words or phrases needing to be edited. Below is an example raw output after reading the PDF of IATF Resolution No. 29 and adding some linebreaks.</p>
<pre class="r"><code>iatfLinks %&gt;% ## Reference iatfLinks table
get_iatf_pdf(id = 29) %&gt;% ## Download PDF of Resolution 29
pdftools::pdf_ocr_text() %&gt;% ## Extract text using OCR
stringr::str_split(pattern = &quot;\n&quot;) %&gt;% ## Split lines of text
unlist() %&gt;% ## Unlist to create data.frame
head(n = 30) ## Show first 30 rows/lines of text</code></pre>
<pre><code>## Converting page 1 to iatfResolution29_1.png... done!
## Converting page 2 to iatfResolution29_2.png... done!
## Converting page 3 to iatfResolution29_3.png... done!
## Converting page 4 to iatfResolution29_4.png... done!</code></pre>
<pre><code>## [1] &quot;g \\ REPUBLIC OF THE PHILIPPINES&quot;
## [2] &quot;&quot;
## [3] &quot;; ay ; INTER-AGENCY TASK FORCE&quot;
## [4] &quot;&quot;
## [5] &quot;%, - FOR THE MANAGEMENT OF EMERGING INFECTIOUS DISEASES&quot;
## [6] &quot;“it Ore on Emer&quot;
## [7] &quot;&quot;
## [8] &quot;RESOLUTION NO. 29&quot;
## [9] &quot;Series of 2020&quot;
## [10] &quot;April 27, 2020&quot;
## [11] &quot;RECOMMENDATIONS RELATIVE TO THE MANAGEMENT&quot;
## [12] &quot;OF THE CORONAVIRUS DISEASE 2019 (COVID-19) SITUATION&quot;
## [13] &quot;&quot;
## [14] &quot;WHEREAS, on March 16, 2020, to prevent the sharp rise of COVID-19 cases in the&quot;
## [15] &quot;country, the President placed the entirety of Luzon under Enhanced Community Quarantine until&quot;
## [16] &quot;April 14, 2020;&quot;
## [17] &quot;&quot;
## [18] &quot;WHEREAS, on March 30, 2020, to develop a science-based approach in determining&quot;
## [19] &quot;whether the Enhanced Community Quarantine in Luzon should be totally or partially lifted,&quot;
## [20] &quot;extended, or expanded to other areas, the Inter-Agency Task Force (IATF) convened a&quot;
## [21] &quot;sub-Technical Working Group tasked to define parameters in assessing recent developments in&quot;
## [22] &quot;the Philippine COVID-19 situation;&quot;
## [23] &quot;&quot;
## [24] &quot;WHEREAS, on April 3, 2020, the [ATF finalized the parameters for deciding on the&quot;
## [25] &quot;lifting or extension of the Enhanced Community Quarantine in Luzon, which include trends on&quot;
## [26] &quot;the COVID-19 epidemiological curve, the health capacity of the country, social factors,&quot;
## [27] &quot;economic factors, and security factors;&quot;
## [28] &quot;&quot;
## [29] &quot;WHEREAS, on April 7, 2020, upon the recommendation of the IATF, the President&quot;
## [30] &quot;extended the implementation of the Enhanced Community Quarantine over the entirety of Luzon&quot;</code></pre>
<p>This is the reason why <strong>Steps 2</strong>, <strong>3</strong> and <strong>4</strong> cannot be automated algorithmically or in an unsupervised approach.</p>
<p>Following is the complete script used to read, clean and structure Resolution No. 29 in a manner that is amenable for text analysis:</p>
<pre class="r"><code>## Read and re-structure text data
y &lt;- iatfLinks %&gt;% ## Reference iatfLinks table
get_iatf_pdf(id = 29) %&gt;% ## Download PDF of Resolution 29
pdftools::pdf_ocr_text() %&gt;% ## Extract text using OCR
stringr::str_split(pattern = &quot;\n&quot;) %&gt;% ## Split lines of text
unlist() ## Unlist to create data.frame
## Restructure text and clean
y &lt;- y[c(14:48, 55:90, 98:109, 115:149)]
y &lt;- y[y != &quot;&quot;]
y[69] &lt;- &quot;Francisco T. Duque III Karlo Alexei B. Nograles&quot;
y[70] &lt;- &quot;Secretary, Department of Health Cabinet Secretary, Office of the Cabinet Secretary&quot;
y[71] &lt;- &quot;IATF Chairperson IATF Co-Chairperson&quot;
y[74] &lt;- &quot;1. I am presently an Assistant Secretary of the Department of Health;&quot;
y[83] &lt;- stringr::str_replace(string = y[83], pattern = &quot;\\[&quot;, replacement = &quot;I&quot;)
y[84] &lt;- stringr::str_replace(string = y[84], pattern = &quot;\\[&quot;, replacement = &quot;I&quot;)
y[87] &lt;- stringr::str_replace(string = y[87], pattern = &quot;\\[&quot;, replacement = &quot;I&quot;)
y[93] &lt;- stringr::str_replace(string = y[93], pattern = &quot;1g!&quot;, replacement = &quot;28th&quot;)
y[95] &lt;- &quot;Kenneth G. Ronquillo, MD, MPHM&quot;
y[97] &lt;- stringr::str_replace(string = y[97], pattern = &quot;\\[&quot;, replacement = &quot;I&quot;)
y &lt;- stringr::str_trim(string = y, side = &quot;both&quot;)
## Add heading
y &lt;- c(c(&quot;Republic of the Philippines&quot;,
&quot;Inter-Agency Task Force&quot;,
&quot;for the Management of Emerging Infectious Diseases&quot;,
&quot;Resolution No. 29&quot;,
&quot;Series of 2020&quot;,
&quot;27 April 2020&quot;,
&quot;Recommendations relative to the management&quot;,
&quot;of the coronavirus disease 2019 (COVID-19) situation&quot;), y)
## Add section
pStart &lt;- which(stringr::str_detect(string = y, pattern = &quot;WHEREAS&quot;))[1]
oStart &lt;- which(stringr::str_detect(string = y, pattern = &quot;RESOLVED&quot;))[1]
pEnd &lt;- oStart - 1
eStart &lt;- which(stringr::str_detect(string = y, pattern = &quot;APPROVED&quot;))[1]
oEnd &lt;- eStart - 1
cStart &lt;- which(stringr::str_detect(string = y, pattern = &quot;CERTIFICATE|CERTIFICATION&quot;))
eEnd &lt;- cStart - 1
section &lt;- NULL
section[1:8] &lt;- &quot;heading&quot;
section[pStart:pEnd] &lt;- &quot;preamble&quot;
section[oStart:oEnd] &lt;- &quot;operative&quot;
section[eStart:eEnd] &lt;- &quot;endorsement&quot;
section[cStart:length(y)] &lt;- &quot;certification&quot;
## Re-structure text data.frame
y &lt;- data.frame(linenumber = 1:length(y),
text = y,
source = &quot;IATF&quot;,
type = &quot;resolution&quot;,
id = 29,
section = section,
date = as.Date(&quot;27/04/2020&quot;, format = &quot;%d/%m/%y&quot;),
stringsAsFactors = FALSE)
## Convert data.frame to tibble
iatfResolution29 &lt;- tibble::tibble(y)</code></pre>
<p>This results in the following text data:</p>
<pre><code>## # A tibble: 105 x 7
## linenumber text source type id section date
## &lt;int&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;chr&gt; &lt;date&gt;
## 1 1 Republic of the Philippines IATF resol… 29 heading 2020-04-27
## 2 2 Inter-Agency Task Force IATF resol… 29 heading 2020-04-27
## 3 3 for the Management of Emer… IATF resol… 29 heading 2020-04-27
## 4 4 Resolution No. 29 IATF resol… 29 heading 2020-04-27
## 5 5 Series of 2020 IATF resol… 29 heading 2020-04-27
## 6 6 27 April 2020 IATF resol… 29 heading 2020-04-27
## 7 7 Recommendations relative t… IATF resol… 29 heading 2020-04-27
## 8 8 of the coronavirus disease… IATF resol… 29 heading 2020-04-27
## 9 9 WHEREAS, on March 16, 2020… IATF resol… 29 preamb… 2020-04-27
## 10 10 country, the President pla… IATF resol… 29 preamb… 2020-04-27
## # … with 95 more rows</code></pre>
</div>
<div id="step-5-save-the-data" class="section level2">
<h2>Step 5: Save the data</h2>
<p>Once data have been read, processed and structured, they are saved in <code>.rda</code> format for further use in text analysis or topic modelling with <a href="https://www.r-project.org">R language for statistical computing</a>. To allow for replicability of the whole data extraction, processing and structuring process and to facilitate ease of distribution of the text data outputs, we packaged the functions we’ve developed and the datasets we produced into a standard, portable <a href="https://www.r-project.org">R</a> package named <code>covidphtext</code>. We then made the package available via <a href="https://github.io/como-ph/covidphtext">GitHub</a> from which those requiring the functions we developed and the text datasets we’ve produced can install the package. A detailed description of the package including installation and use can be found <a href="https://como-ph.github.io/covidphtext">here</a>.</p>
<p><br>
<br></p>
</div>
</description>
</item>
<item>
<title>comoparams: R utility tool to extract, process and structure Philippines-specific datasets for use in the CoMo Consortium Model</title>
<link>/post/specifying-covid19-model-parameters/</link>
<pubDate>Wed, 06 May 2020 00:00:00 +0000</pubDate>
<guid>/post/specifying-covid19-model-parameters/</guid>
<description></description>
</item>
<item>
<title>Infectious disease modelling and policy</title>
<link>/project/policy-analysis/</link>
<pubDate>Fri, 01 May 2020 00:00:00 +0000</pubDate>
<guid>/project/policy-analysis/</guid>
<description></description>
</item>
<item>
<title>The COVID-19 Modelling (CoMo) Consortium Model</title>
<link>/post/como-consortium-model/</link>
<pubDate>Fri, 01 May 2020 00:00:00 +0000</pubDate>
<guid>/post/como-consortium-model/</guid>
<description>
<p>The age structured SEIR model with infected compartments stratified by symptoms, severity and treatment seeking and access.</p>
<p>The model uses publicly available country-specific data to define the population structure <a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> as a model input. The model interface uses publicly available country-specific data on cases and mortality <a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a> for visual calibration of model parameters to user selected baseline scenarios. More elaborate calibration methods are under consideration but are not a priority since the system is unidentifiable and therefore calibration will be entirely dependent on user-selected baseline scenarios.</p>
<p>The model interface can be found here: <a href="https://comomodel.net/" class="uri">https://comomodel.net/</a>. The equations for the basic model structure follow (Equation 1).</p>
<p><span class="math display">\[ \begin{aligned}
\frac{dS}{dt} ~ &amp; = ~ -S ~ \circ ~ \Lambda ~ + ~ \omega R ~ + ~ A ~ \cdot ~ S ~ - ~ \mu ~ \cdot ~ S ~ + ~ bP \\
\\
\frac{dE}{dt} ~ &amp; = ~ S ~ \circ ~ \Lambda ~ - ~ \gamma E ~ + ~ A ~ \cdot ~ E ~ - ~ \mu ~ \cdot ~ E \\
\\
\frac{dI}{dt} ~ &amp; = ~ \gamma(1 ~ - ~ p_{clin})(1 ~ - ~ p_{ihr}) ~ \cdot ~ E ~ - ~ v_I I ~ + ~ A ~ \cdot ~ I ~ - ~ \mu ~ \cdot ~ I \\
\\
\frac{dC}{dt} ~ &amp; = ~ \gamma p_{clin}(1 ~ - ~ p_{ihr}) ~ \cdot ~ E ~ - ~ v_I C ~ + ~ A ~ \cdot ~ C ~ - ~ \mu \cdot C \\
\\
\frac{dR}{dt} ~ &amp; = ~ v_I (I ~ + ~ C) ~ + ~ A ~ \cdot ~ R ~ - ~ \omega R ~ - ~ \mu ~ \cdot ~ R ~ + ~ (1 ~ - ~ \delta_H p_{ifr})v_H ~ \cdot ~ H \\
~ &amp; + ~ (1 ~ - ~ \delta_{H_c} p_{ifr})v_H ~ \cdot ~ H ~ + ~ (1 ~ - ~ \delta_U p_{ifr})v_U ~ \cdot ~ U \\
~ &amp; + ~ (1 ~ - ~ \delta_{U_c} p_{ifr})v_U ~ \cdot ~ U ~ + ~ (1 ~ - ~ \delta_{V} p_{ifr})v_V ~ \cdot ~ V \\
~ &amp; + ~ (1 ~ - ~ \delta_{V_c} p_{ifr})v_V ~ \cdot ~ V \\
\\
\frac{dH}{dt} ~ &amp; = ~ p_{ihr}(1 ~ - ~ p_U)(1 ~ - ~ p{K_H})\gamma E ~ - ~ v_H H ~ + ~ A ~ \cdot ~ H ~ - ~ \mu ~ \cdot ~ H \\
\\
\frac{dH_c}{dt} ~ &amp; = ~ p_{ihr}(1 ~ - ~ p_U)p_{K_H}\gamma E ~ - ~ v_H H_c ~ + ~ A ~ \cdot ~ H_c ~ - ~ \mu ~ \cdot ~ H_c \\
\\
\frac{dU}{dt} ~ &amp; = ~ p_{ihr} p_U (1 ~ - ~ p_{K_U})(1 ~ - ~ p_V)\gamma E ~ - ~ v_U U ~ + ~ A ~ \cdot ~ U ~ - ~ \mu ~ \cdot ~ U \\
\\
\frac{dU_c}{dt} ~ &amp; = ~ p_{ihr} p_U p_{K_U} (1 ~ - ~ p_v)\gamma E ~ - ~ v_U U_c ~ + ~ A ~ \cdot ~ U_c ~ - ~ \mu ~ \cdot ~ U_c \\
\\
\frac{dV}{dt} ~ &amp; = ~ p_{ihr} p_U(1 ~ - ~ p_{K_U})(1 ~ - ~ p_{K_V})p_V \gamma E ~ - ~ v_V V ~ + ~ A ~ \cdot ~ V ~ - ~ \mu ~ \cdot ~ V \\
\\
\frac{dV_c}{dt} ~ &amp; = ~ p_{ihr} p_U(1 ~ - ~ p_{K_U})p_{K_V} p_V \gamma E ~ - ~ v_V V_c ~ + ~ A ~ \cdot ~ V_c ~ - ~ \mu ~ \cdot ~ V_c \\
\\
\\
P ~ &amp; = ~ (S ~ + ~ E ~ + ~ I ~ + ~ R ~ + ~ H ~ + ~ H_c ~ + ~ U ~ + ~ U_c ~ + ~ V ~ + ~ V_c) \\
\\
\\
s ~ &amp; = ~ 1 ~ + ~ a ~ cos \left (2\pi \frac{ \left (t ~ - ~ \left (\frac{365.25\phi}{12} \right) \right ) ~ + ~ t_{in}}{365.25} \right) \\
\\
\\
W ~ &amp; = ~ W_{home} ~ + ~ W_{work} ~ + ~ W_{school} ~ + ~ W_{other} \\
\\
\\
\Lambda ~ &amp; = ~ p ~ s ~ W ~ \cdot ~ \left (\frac{\rho E ~ + ~ I ~ + ~ C ~ + ~ \rho_s ~ \times ~ (H ~ + ~ H_c ~ + ~ U ~ + ~ U_c ~ + ~ V ~ + ~ V_c)}{P} \right ) \\
\\
\\
A ~ &amp; = ~
\begin{pmatrix}
\begin{pmatrix} -1 &amp; 0 \\ 1 &amp; -1 \end{pmatrix} &amp; \ldots &amp; 0 \\
\vdots &amp; \ddots \begin{pmatrix} -1 &amp; 0 \\ 1 &amp; -1 \end{pmatrix} \ddots &amp; \vdots \\
0 &amp; \ldots &amp; \begin{pmatrix} -1 &amp; 0 \\ 1 &amp; 0 \end{pmatrix}
\end{pmatrix} \\
\\
\\
p_{K_H} ~ &amp; = ~
\begin{Bmatrix}
0 ~ \text{for} ~ H &lt; K_H \\
1 ~ \text{for} ~ H \geq K_H \\
\end{Bmatrix} \\
\\
p_{K_U} ~ &amp; = ~
\begin{Bmatrix}
0 ~ \text{for} ~ U &lt; K_U \\
1 ~ \text{for} ~ U \geq K_U \\
\end{Bmatrix} \\
\\
p_{K_V} ~ &amp; = ~
\begin{Bmatrix}
0 ~ \text{for} ~ V &lt; K_V \\
1 ~ \text{for} ~ V \geq K_V \\
\end{Bmatrix} \\
\\
\\
&amp; \text{where model variables are defined as:} \\
\\
\\
S ~ &amp; = ~ \text{Susceptible} \\
\\
E ~ &amp; = ~ \text{Infected and incubating} \\
\\
I ~ &amp; = ~ \text{Infected and asymptomatic following incubation} \\
\\
C ~ &amp; = ~ \text{Infected and mildly symptomatic following incubation} \\
\\
R ~ &amp; = ~ \text{Recovered and immune} \\
\\
H ~ &amp; = ~ \text{Severe infection: hospitalised} \\
\\
H_c ~ &amp; = ~ \text{Severe infection: not hospitalised due to lack of capacity} \\
\\
U ~ &amp; = ~ \text{Severe infection: hospitalised in ICU} \\
\\
U_c ~ &amp; = ~ \text{Severe infection: hospitalised and requiring ICU but placed in surge ward} \\
\\
V ~ &amp; = ~ \text{Severe infection: hospitalised in ICU and on a ventilator} \\
\\
V_c ~ &amp; = ~ \text{Severe infection: hospitalised in ICU requiring a ventilator but not on one} \\
\\
\\
&amp; \text{and model parameters are defined as:} \\
\\
\\
W_{home} ~ &amp; = ~
\begin{aligned}
&amp; \text{Country-specific age-dependent contact matrix describing the} \\
&amp; \text{number of potentially infectious contacts at home per person per day}
\end{aligned} \\
\\
W_{work} ~ &amp; = ~
\begin{aligned}
&amp; \text{Country-specific age-dependent contact matrix describing the} \\
&amp; \text{number of potentially infectious contacts at work per person per day}
\end{aligned} \\
\\
W_{school} ~ &amp; = ~
\begin{aligned}
&amp; \text{Country-specific age-dependent contact matrix describing the} \\
&amp; \text{number of potentially infectious contacts at work per person per day}
\end{aligned} \\
\\
W_{other} ~ &amp; = ~
\begin{aligned}
&amp; \text{Country-specific age-dependent contact matrix describing the} \\
&amp; \text{number of potentially infectious societal contacts per person per day}
\end{aligned} \\
\\
\mu ~ &amp; = ~ \frac{1}{\text{Age-dependent non-covid related death rate}} \\
\\
b ~ &amp; = ~ \frac{1}{\text{Age-dependent fertility rate}} \\
\\
\alpha ~ &amp; = ~ \frac{1}{\text{Duration in each category}} \\
\\
p ~ &amp; = ~ \text{Probability of infection given a single contact} \\
\\
\gamma ~ &amp; = ~ \frac{1}{\text{Duration of incubation period}} \\
\\
\rho ~ &amp; = ~ \text{Relative infectiousness of incubating phase per contact} \\
\\
p_{clin} ~ &amp; = ~ \text{Proportion of all infections that ever develop symptoms} \\
\\
\nu_I ~ &amp; = ~ \frac{1}{\text{Duration of infectious phase}} \\
\\
\rho_s ~ &amp; = ~ \text{Relative number of contacts for hospitalised patients} \\
\\
\omega ~ &amp; = ~ \frac{1}{\text{Duration of immunity}} \\
\\
\alpha ~ &amp; = ~ \text{Relative variation in transmissibility throughout the year} \pm \text{a proportion} \\
\\
\phi ~ &amp; = ~ \text{Month of peak in transmissibility} \\
\\
t_{in} ~ &amp; = ~ \text{Start date} \\
\\
p_{ihr} ~ &amp; = ~ \text{Probability of an infection being severe (requiring hospitalisation) by age} \\
\\
p_{ifr} ~ &amp; = ~ \text{Probability of an infection being fatal by age} \\
\\
\nu_H ~ &amp; = ~ \text{Duration of hospitalised infection} \\
\\
\nu_U ~ &amp; = ~ \text{Duration of ICU infection} \\
\\
\nu_V ~ &amp; = ~ \text{Duration of ventilated infection} \\
\\
\delta_H ~ &amp; = ~ \text{Probability of death for a hospitalised infection} \\
\\
\delta_{H_c} ~ &amp; = ~ \text{Probability of death for an infection requiring hospital not get} \\
\\
\delta_U ~ &amp; = ~ \text{Maximum death probability for a hospitalized infection requiring ICU admission} \\
\\
\delta_{U_c} ~ &amp; = ~
\begin{aligned}
&amp; \text{Maximum death probability for a hospitalized infection that} \\
&amp; \text{would require ICU admission but was not admitted to the ICU}
\end{aligned} \\
\\
\delta_V ~ &amp; = ~ \text{Maximum death probability for a hospitalized infection requiring a ventilator} \\
\\
\delta_{V_c} ~ &amp; = ~
\begin{aligned}
&amp; \text{Maximum death probability for a hospitalized infection that} \\
&amp; \text{would require a ventilator but did not get one}
\end{aligned} \\
\\
p_U ~ &amp; = ~ \text{Probability of an infected patient needing ICU} \\
\\
p_V ~ &amp; = ~ \text{Probability of an infected patient needing ICU and a ventilator} \\
\\
p_{K_H} ~ &amp; = ~ \text{Decision to assign a patient a hospital bed depending on capacity} \\
\\
p_{K_U} ~ &amp; = ~ \text{Decision to assign a patient an ICU bed depending on capacity} \\
\\
p_{K_V} ~ &amp; = ~ \text{Decision to assign a patient a ventilator depending on capacity}
\end{aligned} \]</span></p>
<p><br>
<br></p>
<p><br>
<br></p>
<div class="footnotes">
<hr />
<ol>
<li id="fn1"><p>UN Department of Economic and Social Affairs Population Dynamics. Available
from: <a href="https://population.un.org/wpp/Download/Standard/Population/" class="uri">https://population.un.org/wpp/Download/Standard/Population/</a>.<a href="#fnref1" class="footnote-back">↩︎</a></p></li>
<li id="fn2"><p>European Centre for Disease Prevention and Control. Available from:
<a href="https://www.ecdc.europa.eu/en" class="uri">https://www.ecdc.europa.eu/en</a>.<a href="#fnref2" class="footnote-back">↩︎</a></p></li>
</ol>
</div>
</description>
</item>
<item>
<title>Applying the CoMo Consortium model to the Philippines</title>
<link>/project/como-ph/</link>
<pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate>
<guid>/project/como-ph/</guid>
<description><p>The application of the CoMo Consortium model to the Philippines context is the main project of the CoMo Philippines team and is the reason for the formation of the team. The CoMo Consortium model is described
<a href="https://www.tropicalmedicine.ox.ac.uk/files/news-files/comoconsortium_description_may2020.pdf" target="_blank" rel="noopener">here</a> in more detail.</p>
<p>The CoMo Philippines team seeks to answer the following:</p>
<ol>
<li>
<p>How can the CoMo Consortium model inform preparations for a post-lockdown scenario?</p>
</li>
<li>
<p>What combination of interventions could work best in the Philippines?</p>
</li>
</ol>
<p>The national team will compare the CoMo Consortium model against other, locally developed models. This will support the development of a local model that better reflects the dynamic local situation and appropriate responses to the COVID-19 epidemic in the Philippines. Other models being used are the official FASSTER COVID-19 module and the UP COVID-19 Pandemic Response Team model.</p>
<br/>
<br/>
</description>
</item>
<item>
<title>COVID-19 International Modelling Consortium (CoMo)</title>
<link>/project/como/</link>
<pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate>
<guid>/project/como/</guid>
<description></description>
</item>
<item>
<title>An example preprint / working paper</title>
<link>/publication/preprint/</link>
<pubDate>Sun, 07 Apr 2019 00:00:00 +0000</pubDate>
<guid>/publication/preprint/</guid>
<description><div class="alert alert-note">
<div>
Click the <em>Slides</em> button above to demo Academic&rsquo;s Markdown slides feature.
</div>
</div>
<p>Supplementary notes can be added here, including
<a href="https://sourcethemes.com/academic/docs/writing-markdown-latex/" target="_blank" rel="noopener">code and math</a>.</p>
</description>
</item>
<item>
<title>Slides</title>
<link>/slides/example/</link>
<pubDate>Tue, 05 Feb 2019 00:00:00 +0000</pubDate>
<guid>/slides/example/</guid>
<description><h1 id="create-slides-in-markdown-with-academic">Create slides in Markdown with Academic</h1>
<p>
<a href="https://sourcethemes.com/academic/" target="_blank" rel="noopener">Academic</a> |
<a href="https://sourcethemes.com/academic/docs/managing-content/#create-slides" target="_blank" rel="noopener">Documentation</a></p>
<hr>
<h2 id="features">Features</h2>
<ul>
<li>Efficiently write slides in Markdown</li>
<li>3-in-1: Create, Present, and Publish your slides</li>
<li>Supports speaker notes</li>
<li>Mobile friendly slides</li>
</ul>
<hr>
<h2 id="controls">Controls</h2>
<ul>
<li>Next: <code>Right Arrow</code> or <code>Space</code></li>
<li>Previous: <code>Left Arrow</code></li>
<li>Start: <code>Home</code></li>
<li>Finish: <code>End</code></li>
<li>Overview: <code>Esc</code></li>
<li>Speaker notes: <code>S</code></li>
<li>Fullscreen: <code>F</code></li>
<li>Zoom: <code>Alt + Click</code></li>
<li>
<a href="https://github.com/hakimel/reveal.js#pdf-export" target="_blank" rel="noopener">PDF Export</a>: <code>E</code></li>
</ul>
<hr>
<h2 id="code-highlighting">Code Highlighting</h2>
<p>Inline code: <code>variable</code></p>
<p>Code block:</p>
<pre><code class="language-python">porridge = &quot;blueberry&quot;
if porridge == &quot;blueberry&quot;:
print(&quot;Eating...&quot;)
</code></pre>
<hr>
<h2 id="math">Math</h2>
<p>In-line math: $x + y = z$</p>
<p>Block math:</p>
<p>$$
f\left( x \right) = ;\frac{{2\left( {x + 4} \right)\left( {x - 4} \right)}}{{\left( {x + 4} \right)\left( {x + 1} \right)}}
$$</p>
<hr>
<h2 id="fragments">Fragments</h2>
<p>Make content appear incrementally</p>
<pre><code>{{% fragment %}} One {{% /fragment %}}
{{% fragment %}} **Two** {{% /fragment %}}
{{% fragment %}} Three {{% /fragment %}}
</code></pre>
<p>Press <code>Space</code> to play!</p>
<p><span class="fragment " >
One
</span>
<span class="fragment " >
<strong>Two</strong>
</span>
<span class="fragment " >
Three
</span></p>
<hr>
<p>A fragment can accept two optional parameters:</p>
<ul>
<li><code>class</code>: use a custom style (requires definition in custom CSS)</li>