
138 Text Mining and Visualization: Case Studies Using Open-Source Tools
139 reviews containing only code or markup fragments. These are filtered out by the fourth
condition in lines 12 and 17 by not considering review texts starting with “<!--”, which
indicates a comment in HTML.
As a last step we want to ensure that each comment is loaded only once for the later
analysis to avoid noise in the classification. Therefore, we filter out multiple occurrences of
the same comments in lines 14 – 15 for positive reviews and lines 19 – 20 for negative ones.
1 def readJSONdata ( op in io nD ata ) :
2 a l l f i l e s = g lob . g l ob ( opin io nD at a )
3 p o s