Module Expr Str Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Str Assign NameStore SetComp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr keyword Call AttributeLoad Str attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Return CompareIn AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Num For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body For NameStore Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If Call AttributeLoad NameLoad attr NameLoad body Expr Yield Call NameLoad NameLoad NameLoad AugAssignAdd NameStore Num If CompareEq BinOpMod NameLoad Num Num body Print Call AttributeLoad Str attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign NameStore Call NameLoad For NameStore NameLoad body For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If CompareNotIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args defaults body Assign NameStore Dict Str Str NameLoad NameLoad Assign NameStore Num For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body For NameStore Call NameLoad NameLoad body AugAssignAdd NameStore Num Print Call AttributeLoad Str attr NameLoad Assign NameStore Call NameLoad BinOpDiv NameLoad Num Num Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Lambda arguments args NameParam defaults CompareNotIn NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Lambda arguments args NameParam defaults CompareIn NameLoad NameLoad Print Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Print Str Assign NameStore Call NameLoad NameLoad NameLoad Print Call AttributeLoad Str attr NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
Opinion Mining example.
More about opinion mining here: http://en.wikipedia.org/wiki/Sentiment_analysis

Dataset extracted from: http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html
precisely http://www.cs.uic.edu/~liub/FBS/pros-cons.rar
It should be placed in a folder called corpus in the same location of this file.
 N/A os N/A re N/A codecs N/A random simpleai.machine_learning precision simpleai.machine_learning Attribute simpleai.machine_learning NaiveBayes simpleai.machine_learning ClassificationProblem N/A BASE_PATH N/A N/A N/A os path dirname N/A N/A N/A os path abspath __file__ N/A PRO_CORPUS_PATH N/A N/A N/A os path join BASE_PATH corpus IntegratedPros.txt N/A CON_CORPUS_PATH N/A N/A N/A os path join BASE_PATH corpus IntegratedCons.txt N/A STOPWORDS_PATH N/A N/A N/A os path join BASE_PATH corpus stopwordsEN.txt N/A STOPWORDS N/A N/A N/A s strip N/A s N/A N/A codecs open STOPWORDS_PATH encoding utf-8 Opinion N/A object N/A __init__ N/A N/A self text category N/A None N/A N/A N/A self text text N/A N/A self category category N/A N/A WordIsPresent N/A Attribute N/A __init__ N/A N/A self word N/A N/A N/A N/A N/A N/A super WordIsPresent self __init__ name N/A N/A {} is present format word N/A N/A self word word N/A __call__ N/A N/A self opinion N/A N/A N/A words N/A N/A N/A opinion text split N/A N/A N/A self word words N/A N/A ProConsCorpus N/A object N/A __init__ N/A N/A self input_files accept_criteria N/A N/A N/A N/A self input_files input_files N/A N/A self accept_criteria accept_criteria N/A _clean_line N/A N/A self line N/A N/A N/A line N/A N/A re sub \<[\/]*Pros\> line N/A line N/A N/A re sub \<[\/]*Cons\> line N/A line N/A N/A re sub [;":!\.,()] line N/A line N/A N/A line strip N/A line N/A N/A line lower N/A line N/A __iter__ N/A N/A self N/A N/A N/A i 0 N/A N/A category filename N/A N/A N/A self input_files items N/A N/A line N/A open filename N/A N/A line N/A N/A self _clean_line line N/A N/A N/A self accept_criteria i N/A N/A N/A N/A Opinion line category N/A i 1 N/A N/A N/A i 1000 0 N/A N/A N/A N/A 	Readed {} examples format i N/A N/A OpinionProblem N/A ClassificationProblem N/A __init__ N/A N/A self corpus N/A N/A N/A N/A N/A N/A super OpinionProblem self __init__ N/A words N/A set N/A opinion corpus N/A N/A word N/A N/A N/A opinion text split N/A N/A N/A word STOPWORDS N/A N/A N/A N/A words add word N/A word words N/A N/A N/A N/A N/A self attributes append N/A WordIsPresent word N/A target N/A N/A self opinion N/A N/A N/A N/A opinion category N/A N/A main N/A N/A N/A N/A N/A input_files N/A pro con PRO_CORPUS_PATH CON_CORPUS_PATH N/A N 0 N/A N/A _ filename N/A N/A input_files items N/A N/A _ N/A open filename N/A N/A N 1 N/A N/A N/A Corpus has {} examples format N N/A M N/A min N/A N 10 1000 N/A testindexes N/A set N/A N/A random sample N/A xrange N M N/A corpus N/A ProConsCorpus input_files N/A N/A N/A i N/A N/A i testindexes N/A test N/A ProConsCorpus input_files N/A N/A N/A i N/A N/A i testindexes N/A Corpuses created N/A problem N/A OpinionProblem corpus N/A classifier N/A NaiveBayes corpus problem N/A Classifier created N/A p N/A precision classifier test N/A N/A N/A Precision = {} format p N/A N/A N/A __name__ __main__ N/A N/A N/A main