示例#1
0
 def __init__(self):
     # initialize all parsing objects, functions and regex matchers
     self.words_to_numbers = WordsToNumbers()
     self.create_argument_pattern_dict()
     self.basic_name_matcher = re.compile(self.basic_name_pattern)
     self.web_jargon_matcher = re.compile(self.valid_web_jargon_pattern)
     self.url_matcher = re.compile(self.url_pattern)
     self.percent_matcher = re.compile(self.percentage_pattern)
     self.action_text_mappings = h.load_web_action_template(h.DEFAULT_ACTIONS_PATH, False)
     self.split_action_keys = [x.split("_") for x in self.action_text_mappings.keys()]
示例#2
0
def run_help_page_creator():
    # load action keys and possible commands
    action_dict = h.load_web_action_template(h.DEFAULT_ACTIONS_PATH, False)
    # create help pages for all contexts
    for context in CONTEXTS:
        # create and write the help page to html page
        file_path = os.path.join(os.getcwd() + "/browser_extension/html_help_pages/",
                                 '_'.join([str(context), "help_page.html"]))
        html = create_help_html_page(context, action_dict)
        try:
            print "writing file to: " + file_path
            f = open(file_path, 'w')
            html = unicode(html)
            ascii_html = html.encode('ascii', 'ignore')
            f.write(ascii_html)
            f.close()
        except IOError:
            print "had issue writing file to file: " + file_path
示例#3
0
 def __init__(self):
     self.action_call_map = h.load_web_action_template(DEFAULT_ACTIONS_PATH)