{"id":210,"date":"2013-08-04T07:58:43","date_gmt":"2013-08-04T14:58:43","guid":{"rendered":"http:\/\/blog.400pixels.net\/?p=210"},"modified":"2022-06-05T13:13:09","modified_gmt":"2022-06-05T20:13:09","slug":"project-ecuacines","status":"publish","type":"post","link":"https:\/\/blog.400pixels.net\/?p=210","title":{"rendered":"Project: EcuaCines"},"content":{"rendered":"<p style=\"text-align: center;\"><a title=\"EcuaCines\" href=\"http:\/\/ecuacines.com\/\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-225 aligncenter\" alt=\"EcuaCines.com\" src=\"http:\/\/blog.400pixels.net\/wp-content\/uploads\/2013\/08\/logo9-300x113.png\" width=\"300\" height=\"113\" srcset=\"https:\/\/blog.400pixels.net\/wp-content\/uploads\/2013\/08\/logo9-300x113.png 300w, https:\/\/blog.400pixels.net\/wp-content\/uploads\/2013\/08\/logo9.png 516w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h4>Features:<\/h4>\n<ul>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">Displays up-to-date movie descriptions, trailers, and showtimes\u00a0for all major movie theaters in Quito, Ecuador<\/span><\/li>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">Allows users to quickly compare movie times instead of loading each theater's web page<\/span><\/li>\n<li>Works on mobile devices<\/li>\n<li>Loads faster than any of the corresponding movie theaters' websites<\/li>\n<li>Has <a title=\"Sprite Sheets\" href=\"http:\/\/blog.400pixels.net\/?p=151\" target=\"_blank\" rel=\"noopener\">at least one Easter egg<\/a><\/li>\n<\/ul>\n<h4>Technologies:<\/h4>\n<ul>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">Zurb Foundation, jQuery, Font Awesome, and Box2DWeb for the front-end<\/span><\/li>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">PHP with Simple HTML DOM and MySQL for the back-end, with cron jobs and Google Page Speed optimizations<\/span><\/li>\n<li>Photoshop for the logo design<\/li>\n<\/ul>\n<h4>Discussion:<\/h4>\n<p>The website automatically obtains all\u00a0movie showtime information\u00a0from each cinema's official website, and then it has to be able to show these showtimes grouped by movie or by cinema. While this may seem like a trivial task, it turned out to be an interesting algorithmic challenge.<\/p>\n<p>Human Steps:<\/p>\n<ol>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">Open each movie theater's website<\/span><\/li>\n<li>Recognize that \"Superman: El hombre de acero\", \" EL HOMBRE DE ACERO\", and \"Hombre de Acero\" all refer to the same movie.<\/li>\n<li>Copy and paste the movie title (pick one of the three variations) and description along with\u00a0the showtimes for each theater into Ecua Cines's database<\/li>\n<\/ol>\n<p>Robot Steps:<\/p>\n<ol>\n<li>Open each movie theater's website<\/li>\n<li>\u00a0Find a piece of text that represents the movie's title by traversing each website's html tags according to hard-coded directions.<\/li>\n<li><em>Recognize that \"Superman: El hombre de acero\", \" EL HOMBRE DE ACERO\", and \"Hombre de Acero\"\u00a0all refer to the same movie.<\/em><\/li>\n<li>Traverse cinema website according to hard-coded rules to find the movie summary text. (we only need to do this once for each movie)<\/li>\n<li>Traverse \u00a0cinema website according to hard-coded rules to find the\u00a0movie times. Get each of the times by matching pieces of text with one or two digits followed by a \":\" or an \"h\" and followed by two more digits. Assume a 24-hour time format.<\/li>\n<li>Save the title, description, and showtimes for each movie as obtained in steps 3, 4, and 5 into Ecua Cines's database<\/li>\n<\/ol>\n<p>How can we teach a robot to ignore the differences between the three strings of characters from step 3, but still differentiate these from other movie titles? This is what I ended up making the program do, and that has worked in practice:<\/p>\n<ul>\n<li>Trim whitespace from the start and end of movie titles<\/li>\n<li><span style=\"line-height: 14px;\">Remove all accents from letters, e.g. turn all '\u00e1's into 'a's <span style=\"color: #999999;\">(this accounts for the fact that many people prefer to capitalize \"\u00e1\u00e9\u00ed\u00f3\u00fa\" as \"AEIOU\" instead of \"\u00c1\u00c9\u00cd\u00d3\u00da\")<\/span><\/span><\/li>\n<li>TURN THE MOVIE TITLES INTO ALL CAPS <span style=\"color: #999999;\">(this accounts for variations in capitalization)<\/span><\/li>\n<li>Remove commonplace Spanish words like \"EL,\" \"LA,\" and \"Y\" <span style=\"color: #999999;\">(only keep 'important' words)<\/span><\/li>\n<li>Match each movie title with the title from another theater with the shortest\u00a0<a title=\"Levenshtein distance\" href=\"http:\/\/en.wikipedia.org\/wiki\/Levenshtein_distance\">Levenshtein distance<\/a>\u00a0to this title, but requiring a maximum threshold to avoid false positives when there actually is no valid match. <span style=\"color: #999999;\">(this accounts for small misspellings and singular-plural variation e.g. \"MONSTERS UNIVERSITY\" vs. \"MONSTER UNIVERSITY\")<\/span><\/li>\n<li>If the thresholded Levenshtein method finds no matches, match together movie titles that have a 8-or-more-letter common substring\u00a0<span style=\"color: #888888;\">(there's a really cool dynamic programming algorithm for efficiently finding the greatest common substring of two strings)<\/span><\/li>\n<li>If everything else fails, conclude that this movie is unique to this theater<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Features: Displays up-to-date movie descriptions, trailers, and showtimes\u00a0for all major movie theaters in Quito, Ecuador Allows users to quickly compare movie times instead of loading each theater's web page Works on mobile devices Loads faster than any of the corresponding movie theaters' websites Has at least one Easter egg Technologies: Zurb Foundation, jQuery, Font Awesome, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-210","post","type-post","status-publish","format-standard","hentry","category-projects"],"_links":{"self":[{"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=\/wp\/v2\/posts\/210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=210"}],"version-history":[{"count":10,"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=\/wp\/v2\/posts\/210\/revisions"}],"predecessor-version":[{"id":609,"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=\/wp\/v2\/posts\/210\/revisions\/609"}],"wp:attachment":[{"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.400pixels.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}