@@ -0,0 +1,1887 @@
+#!/usr/bin/env python3.5%0A%0Aimport sys%0Aimport re%0Aimport os%0Aimport csv%0Aimport json%0A# import numpy as np%0A# import pandas as pd%0Afrom itertools import groupby%0Afrom collections import OrderedDict%0A%0Afrom extract_toc import parseargs%0Aimport find_topics%0Afrom predict_using_toc_mapper import Mapper, get_topic, read_model_file%0Afrom predict_using_subtopic_mapper import SubtopicPredictor%0Afrom analyze_topic import SubtopicReader%0A%0Adef main(args):%0A  argsmap = parseargs(args)%0A%0A  files = argsmap.get('files')%0A  if (not files):%0A    sys.exit(0)%0A%0A  topic = argsmap.get(%22topic%22)%0A  if (not topic):%0A    topic = %22IT Assessment%22%0A  else:%0A    topic = topic%5B0%5D%0A%0A  summaryfile = argsmap.get(%22summary%22)%0A  if (not summaryfile):%0A    print(%22Summary file must be specified...%22)%0A    sys.exit(1)%0A  summaryfile = summaryfile%5B0%5D%0A  summary_map = find_topics.get_summary_map(summaryfile)%0A%0A  tmodelfile = argsmap.get(%22tmodel%22)%0A  if (not tmodelfile):%0A    print('Topic Model must be specified. using --tmmodel ..')%0A    sys.exit(1)%0A  tmodelfile = tmodelfile%5B0%5D%0A  (origmap, sorted_y, vectorizer, le, grid_search) = read_model_file(tmodelfile)%0A  topics = find_topics.toc_entries(origmap)%0A  # print(topics)%0A  mapper = Mapper(origmap, sorted_y, vectorizer, le, grid_search)%0A%0A  subtopicReader = SubtopicReader(topic, mapper, summary_map)%0A%0A  smodelfile = argsmap.get(%22smodel%22)%0A  if (not smodelfile):%0A    print('Subtopic Model must be specified using --smodel ...')%0A    sys.exit(1)%0A  smodelfile = smodelfile%5B0%5D%0A  subtopicPredictor = SubtopicPredictor(smodelfile)%0A  %0A  for filename in files:%0A    subtopic_dict = subtopicReader.mapped_subtopics(filename, subtopicPredictor)%0A    subtopic_columns = subtopicReader.get_column_names(subtopicPredictor)%0A    print(json.dumps(subtopic_dict, indent=2))%0A    print('---------------------------------------')%0A    print(subtopic_columns)%0A%0Aif __name__ == '__main__':%0A  args = sys.argv%5B1:%5D%0A  main(args)%0A

Create subtopic_test_01.py