def run(self): try: print("LIST m_sentences", "wow", len(m_sentences), m_sentences[0], "enf") except: print("LIST m_sentences") try: m_aspectkeywords = aspectSegmenter.loadAspectKeywords( "jupiter/sentient/aspect/Data/restaurant_bootstrapping.dat" ) except Exception as e: m_aspectkeywords = aspectSegmenter.loadAspectKeywords("aspect/Data/restaurant_bootstrapping.dat") q_sentences = loadReviewAndProcess(self.sid, self.p)[0] m_sentences = loadReviewAndProcess(self.sid, self.p)[1] m_sentences_annotated, m_aspectkeywords_fixed = aspectSegmenter.BootStrapping( m_sentences, m_vocabulary, m_aspectkeywords ) try: saveAnnotatedSentences( m_sentences_annotated, q_sentences, "jupiter/sentient/aspect/Data/annotated_sentences_chi_final.csv", self.sid, self.p, ) saveExtendedAspectKeywords( m_aspectkeywords_fixed, "jupiter/sentient/aspect/Data/restaurant_bootstrapped_keywords_chi_final.dat" ) except Exception as e: saveAnnotatedSentences( m_sentences_annotated, q_sentences, "aspect/Data/annotated_sentences_chi_final.csv", self.sid, self.p ) saveExtendedAspectKeywords( m_aspectkeywords_fixed, "aspect/Data/restaurant_bootstrapped_keywords_chi_final.dat" ) print("Review Processing Done!")
def run(self): try: print("LIST m_sentences", "wow", len(m_sentences), m_sentences[0], "enf") except: print("LIST m_sentences") try: m_aspectkeywords = aspectSegmenter.loadAspectKeywords( 'jupiter/sentient/aspect/Data/restaurant_bootstrapping.dat') except Exception as e: m_aspectkeywords = aspectSegmenter.loadAspectKeywords( 'aspect/Data/restaurant_bootstrapping.dat') q_sentences = loadReviewAndProcess(self.sid, self.p)[0] m_sentences = loadReviewAndProcess(self.sid, self.p)[1] m_sentences_annotated, m_aspectkeywords_fixed = aspectSegmenter.BootStrapping( m_sentences, m_vocabulary, m_aspectkeywords) try: saveAnnotatedSentences( m_sentences_annotated, q_sentences, "jupiter/sentient/aspect/Data/annotated_sentences_chi_final.csv", self.sid, self.p) saveExtendedAspectKeywords( m_aspectkeywords_fixed, 'jupiter/sentient/aspect/Data/restaurant_bootstrapped_keywords_chi_final.dat' ) except Exception as e: saveAnnotatedSentences( m_sentences_annotated, q_sentences, "aspect/Data/annotated_sentences_chi_final.csv", self.sid, self.p) saveExtendedAspectKeywords( m_aspectkeywords_fixed, 'aspect/Data/restaurant_bootstrapped_keywords_chi_final.dat') print("Review Processing Done!")
saveAnnotatedSentences( m_sentences_annotated, q_sentences, "aspect/Data/annotated_sentences_chi_final.csv", self.sid, self.p) saveExtendedAspectKeywords( m_aspectkeywords_fixed, 'aspect/Data/restaurant_bootstrapped_keywords_chi_final.dat') print("Review Processing Done!") if __name__ == '__main__': # os.chdir('..') # os.chdir('..') print('Load Aspect Seed Words...') m_aspectkeywords = aspectSegmenter.loadAspectKeywords( 'Data/restaurant_bootstrapping.dat') print('Load Reviews And Process...') q_sentences = loadReviewAndProcess('Data/reviews.csv') print('Start Bootstrapping For Aspect Segmentation') m_sentences_annotated, m_aspectkeywords_fixed = aspectSegmenter.BootStrapping( m_sentences, m_vocabulary, m_aspectkeywords) print('Saving Annotated sentences and extended aspect keywords list') saveAnnotatedSentences(m_sentences_annotated, q_sentences, 'Data/annotated_sentences_chi_final.csv') print('Saving Extended Aspect Keyword list') saveExtendedAspectKeywords( m_aspectkeywords_fixed, 'Data/restaurant_bootstrapped_keywords_chi_final.dat') # if nltk errors go refer this # http://stackoverflow.com/questions/4867197/failed-loading-english-pickle-with-nltk-data-load
except Exception as e: saveAnnotatedSentences( m_sentences_annotated, q_sentences, "aspect/Data/annotated_sentences_chi_final.csv", self.sid, self.p ) saveExtendedAspectKeywords( m_aspectkeywords_fixed, "aspect/Data/restaurant_bootstrapped_keywords_chi_final.dat" ) print("Review Processing Done!") if __name__ == "__main__": # os.chdir('..') # os.chdir('..') print("Load Aspect Seed Words...") m_aspectkeywords = aspectSegmenter.loadAspectKeywords("Data/restaurant_bootstrapping.dat") print("Load Reviews And Process...") q_sentences = loadReviewAndProcess("Data/reviews.csv") print("Start Bootstrapping For Aspect Segmentation") m_sentences_annotated, m_aspectkeywords_fixed = aspectSegmenter.BootStrapping( m_sentences, m_vocabulary, m_aspectkeywords ) print("Saving Annotated sentences and extended aspect keywords list") saveAnnotatedSentences(m_sentences_annotated, q_sentences, "Data/annotated_sentences_chi_final.csv") print("Saving Extended Aspect Keyword list") saveExtendedAspectKeywords(m_aspectkeywords_fixed, "Data/restaurant_bootstrapped_keywords_chi_final.dat") # if nltk errors go refer this # http://stackoverflow.com/questions/4867197/failed-loading-english-pickle-with-nltk-data-load # http://stackoverflow.com/questions/8590370/how-to-do-pos-tagging-using-the-nltk-pos-tagger-in-python # Zurez