def test_parallel(start): pairs_file = open(os.path.join(os.pardir, "data", "pairs.pkl"), 'rb') pairs = pickle.load(pairs_file) pairs_file.close() synonyms_file = open(os.path.join(os.pardir, "data", "synonyms.pkl"), 'rb') synonyms = pickle.load(synonyms_file) synonyms_file.close() pattern_matcher = PatternMatcher() connection = pymysql.connect(host='localhost', user='******', password='******'.format(sys.argv[1]), db='stackoverflow') with connection.cursor() as cursor: sql = "SELECT Id, Body FROM Posts WHERE Score >= 0 AND Id >= {} AND Id < {}".format( start, start + 100) cursor.execute(sql) for i in range(cursor.rowcount): # post_count += 1 current_id, row = cursor.fetchone() word_list = get_words(row) # total_sent_count += len(word_list) for words in word_list: rtn = check_tech_pairs(words) if rtn is not None: words = rtn[0].split(" ") pattern_matcher.match_pattern(words, current_id, rtn[1], "keytechs")