{"id":760,"date":"2018-01-01T05:38:55","date_gmt":"2018-01-01T05:38:55","guid":{"rendered":"http:\/\/www.rangakrish.com\/?p=760"},"modified":"2018-01-03T10:21:00","modified_gmt":"2018-01-03T10:21:00","slug":"analysing-screenplay-with-mathematica","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/","title":{"rendered":"Analysing Screenplay with Mathematica"},"content":{"rendered":"<p>I have a close relative who is an aspiring movie screenplay writer. During one of our recent meetings, he shared with me with a lot of interesting information about screenplay writing and its challenges. He even lent me a few good books to read further. One of the books is <em><strong>Essentials of Screenwriting<\/strong><\/em> by <em><strong>Richard Walter<\/strong><\/em>. I thoroughly enjoyed reading it!<\/p>\n<p>After reading the book, I was quite eager to go through some actual film screenplays. I searched the net and found the script for the movie\u00a0<em><strong>The Prestige (2006)<\/strong><\/em>. I downloaded the PDF version and started reading it. It was then that another thought crossed my mind: Wouldn\u2019t it be nice if we can parse and analyse the script programmatically? Now, why would anyone want to do that? Computational analysis can throw up interesting statistics about the screenplay, and if you are into text mining, this can be an interesting source of data.<\/p>\n<p>Properly formatted scripts have a well-defined structure. Instead of worrying about low-level parsing, I wanted to convert the script file to XML format so that I can process the file without much difficulty. There is a script writing software called <a href=\"https:\/\/www.fadeinpro.com\" target=\"_blank\" rel=\"noopener\"><em><strong>Fade In<\/strong><\/em><\/a>\u00a0that allows opening script files in PDF format and exporting in XML. I used that software and converted the original PDF version of the script to XML format.<\/p>\n<p>I then decided to use Mathematica for analysing the script. It is quite straightforward to work with XML files in Mathematica. I am not describing the code in this article, but you can download the source for the program using the link given later in the article.<\/p>\n<p>Let us first load the XML file and list the top 20 Characters that appear in the script.<\/p>\n<figure id=\"attachment_762\" aria-describedby=\"caption-attachment-762\" style=\"width: 670px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Character-Names.png\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"762\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/character-names\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Character-Names.png\" data-orig-size=\"670,437\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Character Names\" data-image-description=\"&lt;p&gt;Character Names&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Character Names&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Character-Names.png\" class=\"size-full wp-image-762\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Character-Names.png?resize=670%2C437\" alt=\"Character Names\" width=\"670\" height=\"437\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Character-Names.png?w=670&amp;ssl=1 670w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Character-Names.png?resize=300%2C196&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Character-Names.png?resize=140%2C90&amp;ssl=1 140w\" sizes=\"(max-width: 670px) 100vw, 670px\" \/><\/a><figcaption id=\"caption-attachment-762\" class=\"wp-caption-text\"><strong>Character Names<\/strong><\/figcaption><\/figure>\n<p>Remember that the script only talks about characters, not about the real actors who play these characters.<\/p>\n<p>OK. Next, how many scenes are there in the script and what are some scene <em><strong>headings<\/strong><\/em> (also called <em><strong>slug lines<\/strong><\/em>)? The following table lists the first 25 scenes (there are 219 scenes overall).<\/p>\n<figure id=\"attachment_763\" aria-describedby=\"caption-attachment-763\" style=\"width: 576px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scenes.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"763\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/scenes\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scenes.png\" data-orig-size=\"576,578\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Scene Headings\" data-image-description=\"&lt;p&gt;Scene Headings&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Scene Headings&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scenes.png\" class=\"size-full wp-image-763\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scenes.png?resize=576%2C578\" alt=\"Scene Headings\" width=\"576\" height=\"578\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scenes.png?w=576&amp;ssl=1 576w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scenes.png?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scenes.png?resize=300%2C300&amp;ssl=1 300w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/a><figcaption id=\"caption-attachment-763\" class=\"wp-caption-text\"><strong>Scene Headings<\/strong><\/figcaption><\/figure>\n<p>Let us find out some of the locations where the scenes are set, and how many such locations are there.<\/p>\n<figure id=\"attachment_764\" aria-describedby=\"caption-attachment-764\" style=\"width: 561px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Locations.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"764\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/locations\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Locations.png\" data-orig-size=\"561,577\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Locations\" data-image-description=\"&lt;p&gt;Locations&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Locations&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Locations.png\" class=\"size-full wp-image-764\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Locations.png?resize=561%2C577\" alt=\"Locations\" width=\"561\" height=\"577\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Locations.png?w=561&amp;ssl=1 561w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Locations.png?resize=292%2C300&amp;ssl=1 292w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/a><figcaption id=\"caption-attachment-764\" class=\"wp-caption-text\"><strong>Locations<\/strong><\/figcaption><\/figure>\n<p>When you study the various scene headings, you will notice prefixes such as <em><strong>INT. (Interior)<\/strong><\/em>\u00a0and <em><strong>EXT. (Exterior)<\/strong><\/em>, and some form of time specification such as <em><strong>DAY<\/strong><\/em>, <em><strong>NIGHT<\/strong><\/em>, etc. The following table shows the different types of scenes in this screenplay.<\/p>\n<figure id=\"attachment_765\" aria-describedby=\"caption-attachment-765\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scene-Types.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"765\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/scene-types\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scene-Types.png\" data-orig-size=\"810,274\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Scene Types\" data-image-description=\"&lt;p&gt;Scene Types&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Scene Types&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scene-Types.png\" class=\"wp-image-765\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scene-Types.png?resize=650%2C220\" alt=\"Scene Types\" width=\"650\" height=\"220\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scene-Types.png?w=810&amp;ssl=1 810w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scene-Types.png?resize=300%2C101&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Scene-Types.png?resize=768%2C260&amp;ssl=1 768w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-765\" class=\"wp-caption-text\"><strong>Scene Types<\/strong><\/figcaption><\/figure>\n<p>Looks good so far. How can we find out the dialogues spoken by a specific character? That is easy. The following tables lists the first 10 dialogues uttered by the character called\u00a0<em><strong>Borden<\/strong><\/em>.<\/p>\n<figure id=\"attachment_766\" aria-describedby=\"caption-attachment-766\" style=\"width: 664px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Borden-Dialogs.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"766\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/borden-dialogs\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Borden-Dialogs.png\" data-orig-size=\"664,247\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Borden Dialogs\" data-image-description=\"&lt;p&gt;Borden Dialogs&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Borden Dialogs&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Borden-Dialogs.png\" class=\"size-full wp-image-766\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Borden-Dialogs.png?resize=664%2C247\" alt=\"Borden Dialogs\" width=\"664\" height=\"247\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Borden-Dialogs.png?w=664&amp;ssl=1 664w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Borden-Dialogs.png?resize=300%2C112&amp;ssl=1 300w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><figcaption id=\"caption-attachment-766\" class=\"wp-caption-text\"><strong>Borden Dialogues<\/strong><\/figcaption><\/figure>\n<p>And if you want to know the number of dialogs uttered by each of the characters in the screenplay, that is also easy to get:<\/p>\n<figure id=\"attachment_767\" aria-describedby=\"caption-attachment-767\" style=\"width: 910px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/All-Dialogs.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"767\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/all-dialogs\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/All-Dialogs.png\" data-orig-size=\"910,171\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Dialogues of All Characters\" data-image-description=\"&lt;p&gt;Dialogues of All Characters&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Dialogues of All Characters&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/All-Dialogs.png\" class=\"size-full wp-image-767\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/All-Dialogs.png?resize=780%2C147\" alt=\"Dialogues of All Characters\" width=\"780\" height=\"147\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/All-Dialogs.png?w=910&amp;ssl=1 910w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/All-Dialogs.png?resize=300%2C56&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/All-Dialogs.png?resize=768%2C144&amp;ssl=1 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/a><figcaption id=\"caption-attachment-767\" class=\"wp-caption-text\"><strong>Dialogues of All Characters<\/strong><\/figcaption><\/figure>\n<p>The same information plotted as a Bar chart appears below.<\/p>\n<figure id=\"attachment_768\" aria-describedby=\"caption-attachment-768\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"768\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/dialogs-bar-chart\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart.png\" data-orig-size=\"1119,293\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Dialogs Bar Chart\" data-image-description=\"&lt;p&gt;Dialogs Bar Chart&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Dialogs Bar Chart&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart-1024x268.png\" class=\"wp-image-768\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart-1024x268.png?resize=650%2C170\" alt=\"Dialogs Bar Chart\" width=\"650\" height=\"170\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart.png?resize=1024%2C268&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart.png?resize=300%2C79&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart.png?resize=768%2C201&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Bar-Chart.png?w=1119&amp;ssl=1 1119w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-768\" class=\"wp-caption-text\"><strong>Dialogues Bar Chart<\/strong><\/figcaption><\/figure>\n<p>For ease of decoding, I am listing the top 20 dialogue counts by different characters in the following table.<\/p>\n<figure id=\"attachment_769\" aria-describedby=\"caption-attachment-769\" style=\"width: 544px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Grid.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"769\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/01\/analysing-screenplay-with-mathematica\/dialogs-grid\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Grid.png\" data-orig-size=\"544,404\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Dialogues Table\" data-image-description=\"&lt;p&gt;Dialogues Table&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Dialogues Table&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Grid.png\" class=\"size-full wp-image-769\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Grid.png?resize=544%2C404\" alt=\"Dialogues Table\" width=\"544\" height=\"404\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Grid.png?w=544&amp;ssl=1 544w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Dialogs-Grid.png?resize=300%2C223&amp;ssl=1 300w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/a><figcaption id=\"caption-attachment-769\" class=\"wp-caption-text\"><strong>Dialogues Table<\/strong><\/figcaption><\/figure>\n<p>The number of dialogues spoken by each character is likely to reveal the prominence of that character in the movie. Here\u00a0<em><strong>Angier, Borden<\/strong><\/em> and <em><strong>Cutter<\/strong><\/em> seem to be key characters.<\/p>\n<p>As you can see, it is quite easy to perform such interesting analysis on a screenplay once you have the right tool. If you are into deep text analysis, you can even scan the dialogues for patterns, sentiments, etc.<\/p>\n<p>That was an interesting exercise for me. I learnt a fair amount of technicalities of movie screenplay writing while doing this study. Hope you enjoyed reading this article! You can find the XML version of the screenplay <a href=\"http:\/\/www.rangakrish.com\/downloads\/The_Prestige_script.xml\" target=\"_blank\" rel=\"noopener\">here<\/a>, and the Mathematica source <a href=\"http:\/\/www.rangakrish.com\/downloads\/Screenplay-Analysis.nb\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>I want to take this opportunity to thank you for your continued support.\u00a0 <strong>Have a fantastic New Year! Let this year bring you lots of happiness and prosperity!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a close relative who is an aspiring movie screenplay writer. During one of our recent meetings, he shared with me with a lot of interesting information about screenplay writing and its challenges. He even lent me a few good books to read further. One of the books is Essentials of Screenwriting by Richard [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[72,17],"tags":[127,43,126],"class_list":["post-760","post","type-post","status-publish","format-standard","hentry","category-mathematica","category-programming","tag-fade-in","tag-mathematica","tag-screenplay"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-cg","jetpack-related-posts":[{"id":783,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/01\/14\/analysing-screenplay-in-mathematica-part-2\/","url_meta":{"origin":760,"position":0},"title":"Analysing Screenplay in Mathematica &#8211; II","author":"admin","date":"January 14, 2018","format":false,"excerpt":"In the previous post I showed how we can use Mathematica to analyse screenplays, and gave some interesting statistics about the various characters and scenes from the movie The Prestige. In today\u2019s post, I want to continue that discussion by sharing some more statistics, and then look at another movie,\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Characters vs. Scenes","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/01\/Num-Scenes.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":409,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/11\/02\/working-with-linguistic-data-in-mathematica\/","url_meta":{"origin":760,"position":1},"title":"Working with Linguistic Data in Mathematica","author":"admin","date":"November 2, 2016","format":false,"excerpt":"There are many interesting functions in Mathematica for working with language data, not just in English but in many other languages too. The DictionaryLookup[] function is a good starting point. Let us see what languages are supported as part of dictionary lookup: That is a good collection. It is nice\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Supported Languages","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/11\/dict-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/11\/dict-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/11\/dict-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":328,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/09\/11\/natural-language-processing-in-mathematica\/","url_meta":{"origin":760,"position":2},"title":"Natural Language Processing in Mathematica","author":"admin","date":"September 11, 2016","format":false,"excerpt":"Welcome back. Today I am going to share with you some of the nice capabilities of Mathematica in the area of Natural Language Processing (NLP). Let us start with words. What if we wish to know\u00a0the various definitions of the word image?\u00a0Here is the answer. Mathematica gives the various senses\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Word Definition","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/09\/word-data1-1024x238.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/09\/word-data1-1024x238.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/09\/word-data1-1024x238.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/09\/word-data1-1024x238.png?resize=700%2C400 2x"},"classes":[]},{"id":348,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/09\/26\/computer-vision-with-mathematica\/","url_meta":{"origin":760,"position":3},"title":"Computer Vision with Mathematica","author":"admin","date":"September 26, 2016","format":false,"excerpt":"Over the past several weeks, I have been discussing many interesting features of Mathematica. As a continuation, today, I would like to show some cool functionality in the domain of computer vision and machine learning. The function ImageIdentify[] tries to identify the object in the given image. According to the\u2026","rel":"","context":"In &quot;Machine Learning&quot;","block_context":{"text":"Machine Learning","link":"https:\/\/www.rangakrish.com\/index.php\/category\/machine-learning\/"},"img":{"alt_text":"A Truck","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/09\/truck-fig.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":285,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/07\/22\/using-julia-to-interact-with-mathematica\/","url_meta":{"origin":760,"position":4},"title":"Using Julia to Interact with Mathematica","author":"admin","date":"July 22, 2016","format":false,"excerpt":"Mathematica is a powerful environment for symbolic and numerical computation. I have been using it for many years now. In this post\u00a0I had explained how we can use Mathematica bundled with Raspberry distribution to control littleBits devices. When I saw that there is support in Julia for interacting with Mathematica,\u2026","rel":"","context":"In &quot;Julia&quot;","block_context":{"text":"Julia","link":"https:\/\/www.rangakrish.com\/index.php\/category\/julia\/"},"img":{"alt_text":"Julia Session","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/07\/Julia-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/07\/Julia-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/07\/Julia-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":1541,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/04\/21\/textcontents-function-in-mathematica-12\/","url_meta":{"origin":760,"position":5},"title":"TextContents[ ] Function in Mathematica 12","author":"admin","date":"April 21, 2019","format":false,"excerpt":"Mathematica 12 was released a few days ago.\u00a0 It has been over a year since version 11.3 came out in March 2018. The long wait appears justified since the new release boasts of numerous improvements and new features across several areas. You may want to read this blog post\u00a0by Stephen\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Importing Text File","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=760"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/760\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}