Commits

Robert Bu  committed b2df706

minor adjustments

  • Participants
  • Parent commits 222f95c

Comments (0)

Files changed (2)

 def build_html(query, term, comment_num, is_train):
 	dom = json.loads(query)
 
-	html = '''
-	<!DOCTYPE HTML>
-	<html>
-	<head>
-	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
-'''
-	html += "<title>{0}</title>\n".format(term)
-	html += '''
-<style type=\"text/css\">
-html, body {
-	height: 100%;
-	color: rgb(82,82,82);
-	font-family: Helvetica, Arial, Sans-Serif;
-	font-size: 15px;
-}
-
-a:link, a:visited { color: rgb(94,160,186); text-decoration: none; position: relative; }
-a:hover { color: rgb(63,63,63); text-decoration: none; }
-	
-div.resultbox
-{
-	border: solid black 1px;
-	border-radius: 1em;
-	height: auto;
-	width: auto;
-}
-
-#review_pos {
-background: #cdeb8b; /* Old browsers */
-background: -moz-linear-gradient(top, #cdeb8b 0%, #cdeb8b 100%); /* FF3.6+ */
-background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cdeb8b), color-stop(100%,#cdeb8b)); /* Chrome,Safari4+ */
-background: -webkit-linear-gradient(top, #cdeb8b 0%,#cdeb8b 100%); /* Chrome10+,Safari5.1+ */
-background: -o-linear-gradient(top, #cdeb8b 0%,#cdeb8b 100%); /* Opera 11.10+ */
-background: -ms-linear-gradient(top, #cdeb8b 0%,#cdeb8b 100%); /* IE10+ */
-background: linear-gradient(top, #cdeb8b 0%,#cdeb8b 100%); /* W3C */
-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cdeb8b', endColorstr='#cdeb8b',GradientType=0 ); /* IE6-9 */
-
-}
-
-#review_neg {
-background: #febbbb; /* Old browsers */
-background: -moz-linear-gradient(top, #febbbb 0%, #fe9090 95%, #ff8c8c 100%); /* FF3.6+ */
-background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#febbbb), color-stop(95%,#fe9090), color-stop(100%,#ff8c8c)); /* Chrome,Safari4+ */
-background: -webkit-linear-gradient(top, #febbbb 0%,#fe9090 95%,#ff8c8c 100%); /* Chrome10+,Safari5.1+ */
-background: -o-linear-gradient(top, #febbbb 0%,#fe9090 95%,#ff8c8c 100%); /* Opera 11.10+ */
-background: -ms-linear-gradient(top, #febbbb 0%,#fe9090 95%,#ff8c8c 100%); /* IE10+ */
-background: linear-gradient(top, #febbbb 0%,#fe9090 95%,#ff8c8c 100%); /* W3C */
-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#febbbb', endColorstr='#ff8c8c',GradientType=0 ); /* IE6-9 */
-}
-
-strong {
-	color: #3E8621
-}
-
-.resulttitle
-{
-	font-size: 16px;
-	color: rgb(63, 63, 63);
-	font-weight: bold;
-	padding-top: -5px;
-}
-
-#horizontallist li
-{
-	list-style-type: none;
-}
-
-li.column1 {
-	margin-left: 0em;
-}
-
-li.column2 {
-	margin-left: 10em;
-}
-
-li
-{
-    line-height: 1.2em;
-}
-
-li.reset {
-    margin-top: -1.2em;
-}
-</style>
-'''
+	html = open("imdb_template.html").read()
+	html += "<title>{0}</title></head>".format(term)
+
 	html += "<body>";
 	html += "<div id=\"movie\">"
 
 	if nb.FILTER_STOP_WORDS:
 		words = nb.filterStopWords(words)
 	guess = nb.classify(words)
-
-	print guess
 	
 	return guess
 
 This is a experimental python project that extracts IMDB reviews for a movie, classifies them and generate a result html file
-The project is based on the programming assignments in **Udacity CSC 101 class** and **Stanford NLP class**
+The project is based on the programming assignments and what I've learned in **Udacity CSC 101 class** and **Stanford NLP class**
 The script is also used as a plugin in my term project for my Distributed System class this semster
 
 Usage:
 The files in the lists directory is the movie lists I used to train the NaiveBayes classifier, they come from random titles in
 	* IMDB Top 250 (http://www.imdb.com/chart/top)
 	* IMDB Bottom 100 (http://www.imdb.com/chart/bottom)
-	* New York Times The Best 1,000 Movies Ever Made (http://www.nytimes.com/ref/movies/1000best.html)
+	* The Best 1,000 Movies Ever Made (http://www.nytimes.com/ref/movies/1000best.html)
 
 To simplify the problem, the train process will flag reviews with more than 6 stars as a positive review, reviews with less than 4 stars as a negative review