Пример #1
0
    def __init__(self,
                 map_proxy: MapProxy = None,
                 game_object_proxy: GameObjectProxy = None):
        self.__map_proxy = map_proxy
        self.__game_object_proxy = game_object_proxy

        self.__attack_filters = multi_key_dict()
        self.__move_filters = multi_key_dict()

        self.__prepare_attack_filters()
        self.__prepare_move_filters()
Пример #2
0
    def initialize(self, db):
        """
        Initialize a new working set with the given database connection
        """
        self.db = db

        print("[MAIN] Loading working set")

        # [game_id, name, c_name] => Game
        self.games = multi_key_dict()

        # [steam_id] => Game
        self.games_steam = multi_key_dict()

        # [igdb_id] => Game
        self.games_igdb = multi_key_dict()

        # [igdb_id, name] => Developer
        self.developers = multi_key_dict()

        # [article_id, title] => Article
        self.articles = multi_key_dict()

        # [video_id, name] => Video
        self.videos = multi_key_dict()

        # [tweet_id] => Tweet
        self.tweets = multi_key_dict()

        # [genre_id, name] => Genre
        self.genres = multi_key_dict()

        # [platform_id, name] => Platform
        self.platforms = multi_key_dict()

        for game in Game.query.all():
            self.add_game(game)

        for dev in Developer.query.all():
            self.add_developer(dev)

        for article in Article.query.all():
            self.add_article(article)

        for genre in Genre.query.all():
            self.add_genre(genre)

        for platform in Platform.query.all():
            self.add_platform(platform)

        count = len(self.games) + len(self.developers) + \
            len(self.articles) + len(self.genres) + len(self.platforms)
        print("[MAIN] Loaded %d entities" % count)

        self.initialized = True
Пример #3
0
def get_input(prompt, type_=None, max=10, min=1):
    if type_ == 'int':
        while True:
            try:
                v = int(input(prompt))
            except ValueError:
                print(
                    "That is a psychotic thing to answer - try again asshole")
                continue
            if min <= v <= max:
                return v
                break
            else:
                print("That's an absurd number to give")
                continue
    if type_ == 'bin':
        while True:
            bin_dict = multi_key_dict()
            bin_dict['true', 't', 'yes', 'y', '1'] = True
            bin_dict['false', 'f', 'no', 'n', '0'] = False
            tv = str(input(prompt).lower())
            try:
                v = bin_dict[tv]
                return v
                break
            except KeyError:
                print(
                    'Invalid answer - there are only 2 options, try again plz')
                continue
    else:
        v = str(input(prompt))
        while v == "":
            print('You need to say something at least ...')
            v = str(input(prompt))
        return v
Пример #4
0
    def __init__(self):
        super(WeatherSkill, self).__init__("WeatherSkill")

        # Build a dictionary to translate OWM weather-conditions
        # codes into the Mycroft weather icon codes
        # (see https://openweathermap.org/weather-conditions)
        self.CODES = multi_key_dict()
        self.CODES['01d', '01n'] = 0  # clear
        self.CODES['02d', '02n', '03d', '03n'] = 1  # partly cloudy
        self.CODES['04d', '04n'] = 2  # cloudy
        self.CODES['09d', '09n'] = 3  # light rain
        self.CODES['10d', '10n'] = 4  # raining
        self.CODES['11d', '11n'] = 5  # stormy
        self.CODES['13d', '13n'] = 6  # snowing
        self.CODES['50d', '50n'] = 7  # windy/misty

        # Use Mycroft proxy if no private key provided
        try:
            key = self.config_core.get("APIS").get("Weather")
        except:
            key = self.config.get('api_key')
        if key and not self.config.get('proxy'):
            self.owm = OWM(key)
        else:
            self.owm = OWMApi()
Пример #5
0
    def makeCodonDict(self):

        codonDict = multi_key_dict()
        codonDict["UUU", "UUC"] = Phenylalanine()
        codonDict["UUA", "UUG", "CUU", "CUC", "CUA", "CUG"] = Leucine()
        codonDict["AUU", "AUC", "AUA"] = Isoleucine()
        codonDict["AUG"] = Methionine()
        codonDict["GUU", "GUC", "GUA", "GUG"] = Valine()
        codonDict["UCU", "UCC", "UCA", "UCG", "AGU", "AGC"] = Serine()
        codonDict["CCU", "CCC", "CCA", "CCG"] = Proline()
        codonDict["ACU", "ACC", "ACA", "ACG"] = Threonine()
        codonDict["GCU", "GCC", "GCA", "GCG"] = Alanine()
        codonDict["UAU", "UAC"] = Tyrosine()
        codonDict["UAA", "UAG", "UGA"] = "stop"
        codonDict["CAU", "CAC"] = Histidine()
        codonDict["CAA", "CAG"] = Glutamine()
        codonDict["AAU", "AAC"] = Asparagine()
        codonDict["AAA", "AAG"] = Lysine()
        codonDict["GAU", "GAC"] = AsparticAcid()
        codonDict["GAA", "GAG"] = GlutamicAcid()
        codonDict["UGU", "UGC"] = Cysteine()
        codonDict["UGG"] = Tryptophan()
        codonDict["CGU", "CGC", "CGA", "CGG", "AGA", "AGG"] = Arginine()
        codonDict["GGU", "GGC", "GGA", "GGG"] = Glycine()
        return codonDict
Пример #6
0
def fileBrowser(view, page):
    file_extensions = multi_key_dict()
    file_extensions['.mp3', '.flac'] = 'audio'
    file_extensions['.mp4', '.mkv', '.mpeg', '.wmv'] = 'videos'
    file_extensions['.png', '.jpg', '.jpeg'] = 'photos'
    file_types = {v: k for k, v in file_extensions.items()}
    file_type_html = {
        'audio':
        """
		 <audio controls style="display:block;">
  	      <source src="{0}" type="audio/webm">
         </audio>
    	""",
        'videos':
        """
		 <video controls class="FIThumb_content">
	  	  <source src="{0}" type="video/webm">
		  Your browser does not support the video tag.
		 </video>
		""",
        'photos':
        """
		 <img src="{0}" class="FIThumb_content">
		""",
        'default':
        """<img class="FIThumb_content" src="/static/images/unknown.png">""",
    }
    form = FormFileSearch(view='search')
    form.search_view.choices = [(k, k.title()) for k in file_types]
    form.search_view.choices.append(tuple(['all', 'All']))

    if form.validate_on_submit():
        session['search'] = form.search.data
        session['search_view'] = form.search_view.data
        return redirect(url_for('site.fileBrowser', view='search', page=1))
    if view != 'all' and view in file_types:
        pagination = g.user.files.filter(File.fext.in_(
            file_types[view])).paginate(page, 10)
    elif view == 'search':
        baseq = g.user.files.filter(File.name.contains(session['search']))
        if session['search_view'] == 'all':
            pagination = baseq.order_by(desc(File.datetime)).paginate(page, 10)
        else:
            pagination = baseq.filter(
                File.fext.in_(file_types[session['search_view']])).paginate(
                    page, 10)
    else:
        pagination = g.user.files.order_by(desc(File.datetime)).paginate(
            page, 10)
    files = pagination.items

    return render_template("site/filebrowser.html",
                           form_file_upload=FormFileUpload(),
                           form_file_search=form,
                           files=files,
                           file_extensions=file_extensions,
                           file_type_html=file_type_html,
                           file_types=file_types,
                           pagination=pagination,
                           view=view)
Пример #7
0
def get_skill_ability_class(s: SkillClass) -> AbilityClass:
    """
    Returns the AbilityClass that affects the given SkillClass.

    :param SkillClass s: Skill class to check
    :returns dict Ability class the given skill class is affected by.
    """
    k = multi_key_dict()
    k[SkillClass.ACROBATICS, SkillClass.DISABLE_DEVICE,
      SkillClass.ESCAPE_ARTIST, SkillClass.FLY, SkillClass.RIDE,
      SkillClass.SLEIGHT_OF_HAND,
      SkillClass.STEALTH, ] = AbilityClass.DEXTERITY
    k[SkillClass.APPRAISE, SkillClass.CRAFT, SkillClass.KNOWLEDGE_ARCANA,
      SkillClass.KNOWLEDGE_DUNGEONEERING, SkillClass.KNOWLEDGE_ENGINEERING,
      SkillClass.KNOWLEDGE_GEOGRAPHY, SkillClass.KNOWLEDGE_HISTORY,
      SkillClass.KNOWLEDGE_LOCAL, SkillClass.KNOWLEDGE_NATURE,
      SkillClass.KNOWLEDGE_NOBILITY, SkillClass.KNOWLEDGE_PLANES,
      SkillClass.KNOWLEDGE_RELIGION, SkillClass.LINGUISTICS,
      SkillClass.SPELLCRAFT] = AbilityClass.INTELLIGENCE
    k[SkillClass.BLUFF, SkillClass.DIPLOMACY, SkillClass.DISGUISE,
      SkillClass.HANDLE_ANIMAL, SkillClass.PERFORM,
      SkillClass.USE_MAGIC_DEVICE,
      SkillClass.INTIMIDATE, ] = AbilityClass.CHARISMA
    k[SkillClass.SWIM, SkillClass.CLIMB] = AbilityClass.STRENGTH
    k[SkillClass.HEAL, SkillClass.PERCEPTION, SkillClass.PROFESSION,
      SkillClass.SENSE_MOTIVE, SkillClass.SURVIVAL] = AbilityClass.WISDOM
    return k[s]
Пример #8
0
    def __init__(self):
        super(WeatherSkill, self).__init__("WeatherSkill")

        # Build a dictionary to translate OWM weather-conditions
        # codes into the Mycroft weather icon codes
        # (see https://openweathermap.org/weather-conditions)
        self.CODES = multi_key_dict()
        self.CODES['01d', '01n'] = 0                # clear
        self.CODES['02d', '02n', '03d', '03n'] = 1  # partly cloudy
        self.CODES['04d', '04n'] = 2                # cloudy
        self.CODES['09d', '09n'] = 3                # light rain
        self.CODES['10d', '10n'] = 4                # raining
        self.CODES['11d', '11n'] = 5                # stormy
        self.CODES['13d', '13n'] = 6                # snowing
        self.CODES['50d', '50n'] = 7                # windy/misty

        # Use Mycroft proxy if no private key provided
        key = self.config.get('api_key')
        # TODO: Remove lat,lon parameters from the OWMApi()
        #       methods and implement _at_coords() versions
        #       instead to make the interfaces compatible
        #       again.
        #
        # if key and not self.config.get('proxy'):
        #     self.owm = OWM(key)
        # else:
        #     self.owm = OWMApi()
        self.owm = OWMApi()
        if self.owm:
            self.owm.set_OWM_language(lang=self.__get_OWM_language(self.lang))
Пример #9
0
def get_table(row_ranges, col_ranges, image, iterative_update_xs=True):
    table = multi_key_dict()
    if iterative_update_xs:
        y1_curr = []
        y2_curr = []
    for i, (colname, dx) in enumerate(col_ranges.items()):
        for j, (snum, dy) in enumerate(row_ranges.items()):
            x1 = dx[0]
            x2 = dx[1]
            y1 = dy[0]
            y2 = dy[1]
            if iterative_update_xs:
                if i > 0:
                    y1 = y1_curr[j]
                    y2 = y2_curr[j]
                else:
                    y1_curr.append(y1_curr)
                    y2_curr.append(y2_curr)
            # image=cv2.rectangle(image, p1, p2 ,(255,0,0), 5)
            bbox_out = [x1, y1, x2, y2]
            p1 = (x1, y1)
            p2 = (x2, y2)
            p1 = hocr_to_cv2(p1)
            p2 = hocr_to_cv2(p2)
            image = cv2.rectangle(image, p1, p2, (255, 0, 0), 5)
            # out = get_below_boxes(bbox_out, strict= True)
            # #print([root.get_element_by_id(o[0]).text for o in out])
            # image=cv2.rectangle(image, p1, p2 ,(255,0,0), 5)
            rel_bboxes = [(word_ids[i], bbox)
                          for i, bbox in enumerate(word_bboxes)
                          if bbox_within(bbox, bbox_out)]
            # for (id, bbox) in rel_bboxes:
            # 	p1 = (bbox[0], bbox[1])
            # 	p2 = (bbox[2], bbox[3])
            # 	p1 = hocr_to_cv2(p1)
            # 	p2 = hocr_to_cv2(p2)
            # 	image=cv2.rectangle(image, p1, p2 ,(255,0,0), 5)
            if rel_bboxes:
                if iterative_update_xs:
                    new_y1 = [x[1][1] for x in rel_bboxes]
                    new_y2 = [x[1][3] for x in rel_bboxes]
                    new_y1 = sum(new_y1) / len(new_y1)
                    new_y2 = sum(new_y2) / len(new_y2)
                    new_y1, new_y2 = int(new_y1), int(new_y2)
                    y1_curr[j] = new_y1
                    y2_curr[j] = new_y2
                # if testing:
                # 	print(snum, colname, [get_text_by_id(x[0]) for x in rel_bboxes])

            else:
                if iterative_update_xs:
                    y1_curr[j] = y1
                    y2_curr[j] = y2
Пример #10
0
 def __init__(self):
     super(WeatherSkill, self).__init__(name="WeatherSkill")
     self.temperature = self.config['temperature']
     self.CODES = multi_key_dict()
     self.CODES['01d', '01n'] = 0
     self.CODES['02d', '02n', '03d', '03n'] = 1
     self.CODES['04d', '04n'] = 2
     self.CODES['09d', '09n'] = 3
     self.CODES['10d', '10n'] = 4
     self.CODES['11d', '11n'] = 5
     self.CODES['13d', '13n'] = 6
     self.CODES['50d', '50n'] = 7
Пример #11
0
 def __init__(self):
     super(WeatherSkill, self).__init__(name="WeatherSkill")
     self.temperature = self.config['temperature']
     self.CODES = multi_key_dict()
     self.CODES['01d', '01n'] = 0
     self.CODES['02d', '02n', '03d', '03n'] = 1
     self.CODES['04d', '04n'] = 2
     self.CODES['09d', '09n'] = 3
     self.CODES['10d', '10n'] = 4
     self.CODES['11d', '11n'] = 5
     self.CODES['13d', '13n'] = 6
     self.CODES['50d', '50n'] = 7
 def __init__(self):
     super(WeatherSkill, self).__init__("WeatherSkill")
     self.__init_owm()
     self.CODES = multi_key_dict()
     self.CODES['01d', '01n'] = 0
     self.CODES['02d', '02n', '03d', '03n'] = 1
     self.CODES['04d', '04n'] = 2
     self.CODES['09d', '09n'] = 3
     self.CODES['10d', '10n'] = 4
     self.CODES['11d', '11n'] = 5
     self.CODES['13d', '13n'] = 6
     self.CODES['50d', '50n'] = 7
Пример #13
0
 def __init__(self):
     super(WeatherSkill, self).__init__("WeatherSkill")
     self.language = self.config_core.get('lang')
     self.temperature = self.config.get('temperature')
     self.__init_owm()
     self.CODES = multi_key_dict()
     self.CODES['01d', '01n'] = 0
     self.CODES['02d', '02n', '03d', '03n'] = 1
     self.CODES['04d', '04n'] = 2
     self.CODES['09d', '09n'] = 3
     self.CODES['10d', '10n'] = 4
     self.CODES['11d', '11n'] = 5
     self.CODES['13d', '13n'] = 6
     self.CODES['50d', '50n'] = 7
Пример #14
0
 def __init__(self,
              dnac,
              name=SITE_HIERARCHY_NAME,
              verify=False,
              timeout=5):
     """
     Creates at new Site object.
     :param dnac: The Cisco DNA Center cluster to which the site belongs.
         type: Dnac object
         required: yes
         default: none
     :param name: The site hierarchy's name.
         type: str
         required: no
         default: Either the Dnac object's name or IP address concatenated with SITE_HIERARCHY_NAME.
     :param verify: A flag indicating whether or not to validate the cluster's certificate.
         type: bool
         required: no
         default: False
     :param timeout: The number of seconds to wait for a response from a site hierarchy API call.
         type: int
         required: no
         default: 5
     """
     if dnac.version in SUPPORTED_DNAC_VERSIONS:
         path = SITE_RESOURCE_PATH[dnac.version]
     else:
         raise DnacError('__init__: %s: %s' %
                         (UNSUPPORTED_DNAC_VERSION, dnac.version))
     if dnac.name != NO_DNAC_PATH:
         site_hierarchy_name = '%s%s' % (dnac.name, name)
     elif dnac.ip != NO_DNAC_PATH:
         site_hierarchy_name = '%s%s' % (dnac.ip, name)
     else:
         raise DnacError('__init__: critical error: %s: %s' %
                         (NO_DNAC_PATH_ERROR, NO_DNAC_PATH_RESOLUTION))
     super(SiteHierarchy, self).__init__(dnac,
                                         site_hierarchy_name,
                                         resource=path,
                                         verify=verify,
                                         timeout=timeout)
     self.__all_sites = []
     self.__site_nodes = multi_key_dict()
     self.__site_count = NO_SITES
     self.load_sites()
Пример #15
0
def init_sound_dict():
    """
    Creates dictionary of similar morpheme groups.

    Morphemes are grouped by similarity, stressed (including secondary) are separated from unstressed,
    paired consonants are grouped together.

    :return: multi key dictionary with morpheme groups.
    """
    sound_dict = multi_key_dict()
    sound_dict['IY2', 'IY1', 'IH1', 'IH2', 'UH2', 'Y'] = ['IY2', 'IY1', 'IH1', 'IH2', 'UH2', 'Y']
    sound_dict['IH0', 'IY0'] = ['IH0', 'IY0']
    sound_dict['UW0', 'UH0'] = ['UW0', 'UH0']
    sound_dict['UW1', 'UW2', 'UH1'] = ['UW1', 'UW2', 'UH1']
    sound_dict['AA0', 'AH0'] = ['AA0', 'AH0']
    sound_dict['AA1', 'AA2', 'AH1', 'AH2'] = ['AA1', 'AA2', 'AH1', 'AH2']
    sound_dict['AY0'] = ['AY0']
    sound_dict['AY1', 'AY2'] = ['AY1', 'AY2']
    sound_dict['AW0'] = ['AW0']
    sound_dict['AW1', 'AW2'] = ['AW1', 'AW2']
    sound_dict['AO0'] = ['AO0']
    sound_dict['AO1', 'AO1', 'AO2'] = ['AO1', 'AO1', 'AO2']
    sound_dict['OY0'] = ['OY0']
    sound_dict['OY1', 'OY2'] = ['OY1', 'OY2']
    sound_dict['OW0'] = ['OW0']
    sound_dict['OW1', 'OW2'] = ['OW1', 'OW2']
    sound_dict['EY0'] = ['EY0']
    sound_dict['EY1', 'EY2'] = ['EY1', 'EY2']
    sound_dict['EH0', 'AE0'] = ['EH0', 'AE0']
    sound_dict['EH1', 'EH2', 'AE1', 'AE2'] = ['EH1', 'EH2', 'AE1', 'AE2']
    sound_dict['ER0'] = ['ER0']
    sound_dict['ER1', 'ER2'] = ['ER1', 'ER2']
    sound_dict['S', 'Z', 'DH', 'TH'] = ['S', 'Z', 'DH', 'TH']
    sound_dict['P', 'B'] = ['P', 'B']
    sound_dict['M', 'N', 'NG'] = ['M', 'N', 'NG']
    sound_dict['F', 'V'] = ['F', 'V']
    sound_dict['G', 'K'] = ['G', 'K']
    sound_dict['T', 'D'] = ['T', 'D']
    sound_dict['JH', 'CH'] = ['JH', 'CH']
    sound_dict['SH', 'ZH'] = ['SH', 'ZH']
    sound_dict['L'] = ['L']
    sound_dict['R'] = ['R']
    sound_dict['HH'] = ['HH']
    sound_dict['W'] = ['W']
    return sound_dict
Пример #16
0
    def __init__(self, subreddit_name, thread_limit):
        print("Initializing for {} threads on subreddit: {}...".format(
            thread_limit, subreddit_name))
        self.reddit = praw.Reddit(
            client_id='GETTHISONREDDIT',
            client_secret='GETTHISONREDDIT',
            username='******',
            password='******',
            user_agent='GETTHISONREDDIT')  #reddit instance

        self.subreddit = self.reddit.subreddit(subreddit_name)
        self.hot_python = self.subreddit.hot(
            limit=thread_limit)  #some id looking thing
        self.coin_dict = multi_key_dict()
        self.analyzer = SentimentIntensityAnalyzer()

        #make separate searches for thread and comment count
        print("Finished Initializing!")
Пример #17
0
def get_iconfile(icon):

    icons = multi_key_dict()
    icons['clear', 'sunny'] = 'clear-day'
    icons['nt_clear', 'nt_sunny'] = 'clear-night'
    icons['rain', 'chancerain', 'nt_rain', 'nt_chancerain'] = 'rain'
    icons['snow', 'chancesnow', 'flurries', 'chanceflurries'] = 'snow-day'
    icons['nt_snow', 'nt_chancesnow', 'nt_flurries', 'nt_chanceflurries'] = 'snow-night'
    icons['mostlysunny', 'partlysunny', 'partlycloudy'] = 'partly-cloudy-day'
    icons['nt_mostlysunny', 'nt_partlysunny', 'nt_partlycloudy'] = 'partly-cloudy-night'
    icons['cloudy', 'mostlycloudy'] = 'cloudy'
    icons['nt_cloudy', 'nt_mostlycloudy'] = 'cloudy-night'
    icons['sleet', 'chancesleet', 'nt_sleet', 'nt_chancesleet'] = 'sleet'
    icons['tstorms', 'chancetstorms', 'nt_tstorms', 'nt_chancetstorms'] = 'thunderstorm'
    icons['fog', 'haze', 'nt_fog', 'nt_haze'] = 'fog'

    filename = icons.get(icon, None)
    if filename is None:
        print ("Error: Filename not found. Unknown weather condition: '%s'" % icon)
        return ('notfound.png')
    else:
        return (filename+'.png')
Пример #18
0

basepos = BasePosition()
'''doubledict = multi_key_dict()
doubledict['AA'] = A.unit_couplet_value(A)
doubledict['AC', 'CA'] = A.unit_couplet_value(C)
doubledict['AG', 'GA'] = A.unit_couplet_value(G)
doubledict['AT', 'TA'] = A.unit_couplet_value(T)
doubledict['CC'] = C.unit_couplet_value(C)
doubledict['CG', 'GC'] = C.unit_couplet_value(G)
doubledict['CT', 'TC'] = C.unit_couplet_value(T)
doubledict['GG'] = G.unit_couplet_value(G)
doubledict['GT', 'TG'] = G.unit_couplet_value(T)
doubledict['TT'] = T.unit_couplet_value(T)'''

doubledict = multi_key_dict()
doubledict['AA'] = basepos.A.unit_couplet_value(basepos.A)
doubledict['AC', 'CA'] = basepos.A.unit_couplet_value(basepos.C)
doubledict['AG', 'GA'] = basepos.A.unit_couplet_value(basepos.G)
doubledict['AT', 'TA'] = basepos.A.unit_couplet_value(basepos.T)
doubledict['CC'] = basepos.C.unit_couplet_value(basepos.C)
doubledict['CG', 'GC'] = basepos.C.unit_couplet_value(basepos.G)
doubledict['CT', 'TC'] = basepos.C.unit_couplet_value(basepos.T)
doubledict['GG'] = basepos.G.unit_couplet_value(basepos.G)
doubledict['GT', 'TG'] = basepos.G.unit_couplet_value(basepos.T)
doubledict['TT'] = basepos.T.unit_couplet_value(basepos.T)


def lifeizhaoyuplot(fname):
    seqlen = getseqlen(fname)
    #print(seqlen)
Пример #19
0
###########################################
## Python 2. Uses multi-key-dict module. ##
###########################################

from multi_key_dict import multi_key_dict

two = three = four = five = six = seven = eight = nine = multi_key_dict()

two['A', 'B', 'C'] = '2'
three['D', 'E', 'F'] = '3'
four['G', 'H', 'I'] = '4'
five['J', 'K' 'L'] = '5'
six['M', 'N', 'O'] = '6'
seven['P', 'Q', 'R', 'S'] = '7'
eight['T', 'U', 'V'] = '8'
nine['W', 'X', 'Y', 'Z'] = '9'


def request():
    print "Enter telephone number (7 letters)"
    number = raw_input('1-800-')
    return number.upper()


def decrypt(number):
    d = '1-800-'
    for i in range(0, 7):
        d = d + two[number[i]]
        if i == 2:  #add dash
            d = d + '-'
Пример #20
0
def union(x, y):
    return multi_key_dict({**x.items_dict, **y.items_dict})
Пример #21
0
    title = title[:-3]  # remove last 3 chars

    if hdr != "":
        hdr += "</style>"

    return render_template("station.html",
                           stations=stats,
                           time=d.strftime("%R"),
                           header=Markup(hdr),
                           title=title)


rnv = pyrnvapi.RNVStartInfoApi(get_env_variable("RNV_API_KEY"))  # rnv key

# global list of all available stations and all available lines
gstations = multi_key_dict()
gstations_sorted = OrderedDict()
glines = {}

# caching of requested stations
gnext_call_stations = time.time()
gcached_stations = multi_key_dict()

if __name__ == "__main__":
    get_all_stations()
    get_all_lines()
    # gen_css()

    app.run()
illegal_characters = re.compile(r'[‶″Â]')
cut_list = ['for', 'cut', 'such as']
replacements = {
    'yoghurt': 'yogurt',
    "'s": '',
    'squeeze': 'squeezed',
    'aubergine': 'eggplant',
    'self raising': 'self-raising',
    'pitta': 'pita',
    'chile': 'chili',
    'chilli': 'chili',
    'tomate': 'tomato',
    'zucker': 'sugar'
}  # removed , 'olife': 'olive'

unit_conversions = multi_key_dict()
unit_conversions['pounds', 'pound', 'lbs', 'lb'] = ('g', 453.6)
unit_conversions['ounces', 'ounce', 'ozs', 'oz', 'weight'] = ('g', 28.35)
unit_conversions['can', 'cans', 'cn'] = ('can', 1)
unit_conversions['pints', 'pint', 'pts', 'pt'] = ('l', 0.4732)
unit_conversions['quarts', 'quart', 'qts', 'qt'] = ('l', 1.946352946)
unit_conversions['cups', 'cup', 'c'] = ('l', 0.2366)
unit_conversions['cubes', 'cube'] = ('cube', 1)
unit_conversions['fluid', 'fl'] = ('l', 0.02957)
unit_conversions['tablespoons', 'tablespoon', 'tbsps', 'tbsp', 'tb', 'tbs',
                 'T'] = ('l', 0.01479)
unit_conversions['teaspoons', 'teaspoon', 'tsps', 'tsp', 't',
                 'ts'] = ('l', 0.004929)
unit_conversions['milliliters', 'millilitres', 'ml'] = ('l', 0.001)
unit_conversions['gram', 'gs', 'grams'] = ('g', 1)
unit_conversions['kilogram', 'kgs', 'kg', 'kilograms'] = ('g', 0.001)
Пример #23
0
"Décale-la dans la colonne trois",\
"Décale la pièce deux colonnes à droite",\
"Termine mon tour",\
"Décale la vers la droite de deux colonnes"]


def union(x, y):
    return multi_key_dict({**x.items_dict, **y.items_dict})


ordinals_vocab = multi_key_dict({
    ("première", "1er"): 1,
    ("deuxième", "2e"): 2,
    ("troisième", "3e"): 3,
    ("quatrième", "4e"): 4,
    ("cinquième", "5e"): 5,
    ("sixième", "6e"): 6,
    ("septième", "7e"): 7,
    ("huitième", "8e"): 8,
    ("neuvième", "9e"): 9,
    ("dixième", "10e"): 10
})
index_piece_vocab = multi_key_dict({
    ("1", "un", "une"): 1,
    ("2", "de", "deux"): 2,
    ("3", "trois", "troie"): 3
})
index_column_vocab = union(
    index_piece_vocab,
    multi_key_dict({
        ("4", "quatre"): 4,
        ("5", "cinq"): 5,
Пример #24
0
from multi_key_dict import multi_key_dict
from math import *
from seqlencalc import getseqlen
import datetime

tripletdict = multi_key_dict()
tripletdict['TAA', 'TAG', 'TGA'] = 0
tripletdict['ATG'] = 1
tripletdict['GCT', 'GCC', 'GCA', 'GCG'] = 2
tripletdict['CGT', 'CGC', 'CGA', 'CGG', 'AGA', 'AGG'] = 3
tripletdict['AAT', 'AAC'] = 4
tripletdict['GAT', 'GAC'] = 5
tripletdict['TGT', 'TGC'] = 6
tripletdict['CAA', 'CAG'] = 7
tripletdict['GAA', 'GAG'] = 8
tripletdict['GGT', 'GGC', 'GGA', 'GGG'] = 9
tripletdict['ATT', 'ATC', 'ATA'] = 10
tripletdict['CAT', 'CAC'] = 11
tripletdict['TTA', 'TTG', 'CTT', 'CTC', 'CTA', 'CTG'] = 12
tripletdict['AAA', 'AAG'] = 13
tripletdict['TTT', 'TTC'] = 14
tripletdict['CCT', 'CCC', 'CCA', 'CCG'] = 15
tripletdict['TCT', 'TCC', 'TCA', 'TCG', 'AGT', 'AGC'] = 16
tripletdict['ACT', 'ACC', 'ACA', 'ACG'] = 17
tripletdict['TGG'] = 18
tripletdict['TAT', 'TAC'] = 19
tripletdict['GTT', 'GTC', 'GTA', 'GTG'] = 20

#print(tripletdict['TAG'])

Пример #25
0
                     cmds.listNodeTypes('texture') + \
                     cmds.listNodeTypes('light') + \
                     cmds.listNodeTypes('postProcess') + \
                     cmds.listNodeTypes('utility')
                     
UNPACK_TYPES = [u'short2', u'short3', u'long2', u'long3', u'float2', u'float3',
                u'double2', u'double3', u'matrix', u'pointArray', 
                u'vectorArray', u'stringArray', u'cone', u'reflectanceRGB', 
                u'spectrumRGB', u'componentList']

PACKED_TYPES = [u'Int32Array', u'doubleArray', u'attributeAlias']

TIME_VALS = ['hour','min','sec','millisec','game','film',
             'pal','ntsc','show','palf','ntscf']

SSELECT_CURVES = multi_key_dict()
SSELECT_CURVES['soft', 0] = '1,0,2, 0,1,2'
SSELECT_CURVES['medium', 1] = '1,0.5,2, 0,1,2, 1,0,2'
SSELECT_CURVES['linear', 2] = '0,1,0, 1,0,1'
SSELECT_CURVES['hard', 3] = '1,0,0, 0,1,0'
SSELECT_CURVES['crater', 4] = '0,0,2, 1,0.8,2, 0,1,2'
SSELECT_CURVES['wave', 5] = '1,0,2, 0,0.16,2, 0.75,0.32,2, 0,0.48,2,' \
                            '0.25,0.64,2, 0,0.8,2, 0,1,2'
SSELECT_CURVES['stairs', 6] = '1,0,1, 0.75,0.25,1, 0.5,0.5,1, 0.75,0.25,1,' \
                            '0.25,0.75,1, 1,0.249,1, 0.749,0.499,1,' \
                            '0.499,0.749,1'
SSELECT_CURVES['ring', 7] = '0,0.25,2, 1,0.5,2, 0,0.75,2'
SSELECT_CURVES['sine', 8] = '1,0,2, 0,0.16,2, 1,0.32,2, 0,0.48,2,' \
                             '1,0.64,2, 0,0.8,2, 0,1,2'
                             
SHADER_NODE_FLAGS = {'asLight': bool, 'asPostProcess': bool, 
###########################################
## Python 2. Uses multi-key-dict module. ##
###########################################

from multi_key_dict import multi_key_dict

two = three = four = five = six = seven = eight = nine = multi_key_dict()

two['A', 'B', 'C'] = '2'
three['D', 'E', 'F'] = '3'
four['G', 'H', 'I'] = '4'
five['J','K' 'L'] = '5'
six['M', 'N', 'O'] = '6'
seven['P', 'Q', 'R', 'S'] = '7'
eight['T', 'U', 'V'] = '8'
nine['W','X','Y', 'Z'] = '9'

def request():
	print "Enter telephone number (7 letters)"
	number = raw_input('1-800-')
	return number.upper()

def decrypt(number):
	d = '1-800-'
	for i in range(0,7):
		d = d +  two[number[i]]
		if i == 2: #add dash
			d = d + '-'

	return d
Пример #27
0
def dummify_features(recipes_json):

    ingredient_dict = multi_key_dict()

    # Baking
    ingredient_dict['active yeast', 'bread machine yeast', 'dry yeast', 'instant yeast', 'nutritional yeast',
                    'yeast'] = 'yeast'
    ingredient_dict['baking powder', 'cream of tartar'] = 'baking_powder'
    ingredient_dict['baking soda', 'bicarbonate of soda'] = 'baking_soda'
    ingredient_dict['alcohol free vanilla flavor', 'bourbon vanilla extract', 'colher de de essência de baunilha'] = 'vanilla_extract'
    ingredient_dict['food coloring','food colourings','food dye', 'green food color','green food coloring',
                    'red food coloring','yellow food color','yellow food coloring', 'achiote'] = 'food_coloring'
    ingredient_dict['vanilla','vanilla extract','vanilla bean','vanilla bean paste','vanilla paste','vanilla pod'] = 'vanilla'
    ingredient_dict['coconut', 'flake coconut', 'unsweetened coconut flakes', 'unsweetened dried coconut',
                    'unsweetened shredded coconut', 'sweetened coconut','sweetened coconut flakes',
                    'sweetened shredded coconut','coconut extract'] = 'coconut'

    # Misc
    ingredient_dict['all-bran cereal', 'cereal', 'corn flakes', 'cornflakes', 'crisp rice cereal', 'rice chex',
                    'rice krispies cereal'] = 'cereal'
    ingredient_dict['chex snack mix'] = 'chex'
    ingredient_dict['granola'] = 'granola'
    ingredient_dict['angostura bitters', 'bitters', 'orange bitters'] = 'bitters'
    ingredient_dict['blackberry jam','pineapple jam','strawberry jam','strawberry preserves','raspberry jam',
                    'cherry jam','apricot jam','apricot preserves','apple jelly', 'jam','jelly', 'grape jelly',
                    'orange marmalade'] = 'fruit_preserve'
    ingredient_dict['champagne vinegar', 'malt vinegar','unseasoned rice wine vinegar','vinegar','white vinegar',
                    'white wine vinegar','white distilled vinegar','wine vinegar','red wine vinegar',
                    'sherry vinegar','rice vinegar','rice wine vinegar','seasoned rice vinegar',
                    'apple cider vinegar', 'cider vinegar'] = 'vinegar'
    ingredient_dict['condensed cream of mushroom soup', 'cream of chicken soup', 'cheddar cheese soup',
                    'cheese soup'] = 'cream_soup'
    ingredient_dict['fried onions'] = 'fried_onion'
    ingredient_dict['ice', 'ice cubes'] = 'ice'
    ingredient_dict['water','ice water'] ='water'
    ingredient_dict['liquid smoke'] = 'liquid_smoke'
    ingredient_dict['mac & cheese', 'macaroni'] = 'mac&cheese'
    ingredient_dict['maple extract','maple flavoring','maple syrup'] = 'maple'
    ingredient_dict['maraschino cherries','maraschino liqueur','grenadine'] = 'maraschino'
    ingredient_dict['microwave popcorn', 'popcorn','popped corn',
                    'sacos de pipoca de microondas ou 9 xícaras de de pipoca pronta'] = 'popcorn'
    ingredient_dict['mid-sized skewers', 'wooden skewers'] = 'skewer'
    ingredient_dict['vanilla powder','vanilla protein powder','soy protein','soy protein powder'] = 'protein_powder'
    ingredient_dict['polenta'] = 'polenta'
    ingredient_dict['brine'] = 'brine'

    # Fruits
    ingredient_dict['dried apricots','dried cherries','dried cranberries','dried fruit',
                    'sweetened dried cranberries','raisins','golden raisins'] = 'dried_fruit'
    ingredient_dict['whole berry cranberry sauce','whole cranberry sauce'] = 'cranberry_sauce'
    ingredient_dict['peach','peaches', 'peach nectar','peach schnapps'] = 'peach'
    ingredient_dict['rhubarb'] = 'rhubarb'
    ingredient_dict['pineapple','pineapple chunks','pineapple in juice','pineapple juice'] = 'pineapple'
    ingredient_dict['pomegranate arils','pomegranate juice','pomegranate seeds','pomegranates',
                    'seeds of pomegranate'] = 'pomegranate'
    ingredient_dict['mango','mangoes','mangos', 'mango chutney','mango puree'] = 'mango'
    ingredient_dict['lemon peel', 'lemon zest', 'orange peel','orange zest', 'lime peel', 'lime zest',
                    'finely grated lime zest'] = 'citrus_zest'
    ingredient_dict['juice of lemon', 'lemon', 'lemon juice', 'lemons', 'meyer lemon juice','lemon curd','lemon extract'] = 'lemon'
    ingredient_dict['juice of lime', 'lime','lime juice', 'lime wedge','lime wedges','limes'] = 'lime'
    ingredient_dict['juice of orange', 'mandarin orange segments','mandarin oranges','mandarins', 'orange',
                    'oranges','navel oranges','nectarines', 'orange juice','orange juice concentrate',
                    'tangerine juice', 'orange extract','clementines', 'blood orange','blood orange juice'] = 'orange'
    ingredient_dict['guava juice'] = 'guava_juice'
    ingredient_dict['grapefruit','grapefruit juice'] = 'grapefruit'
    ingredient_dict['grapes', 'red grapes','white grape juice'] = 'grapes'
    ingredient_dict['watermelon'] = 'watermelon'
    ingredient_dict['plums'] = 'plum'
    ingredient_dict['currants', 'currant']   = 'currant'
    ingredient_dict['date','dates', 'medjool dates'] = 'date'
    ingredient_dict['figs', 'fig', 'fresh figs'] = 'fig'
    ingredient_dict['cherries','cherry','sweet cherries','cherry juice','cherry pie filling'] = 'cherry'
    ingredient_dict['berries', 'blackberries', 'blueberries', 'cranberries', 'mixed berries', 'strawberries',
                    'strawberry','raspberries','raspberry', 'freeze-dried strawberries'] = 'berry'
    ingredient_dict['banana','bananas','plantain','plantains'] = 'banana'
    ingredient_dict['apple', 'apples', 'fuji apple', 'gala apples', 'granny smith apples',
                    'golden delicious apple','mcintosh apple','tart apple','tart apples','apple butter',
                    'apple cider', 'apple juice','applesauce', 'unsweetened applesauce'] = 'apple'
    ingredient_dict['bartlett pears', 'pear','pears'] = 'pear'
    ingredient_dict['musk melon','cantaloupe'] = 'melon'

    # Meat
    ingredient_dict['93% lean ground turkey meat', 'ground turkey', 'lean ground turkey','ground beef',
                    'ground beef chuck','ground bison','hamburger meat', 'lean beef', 'lean ground beef',
                    'ground lamb','ground pork','meatballs','ground chicken'] = 'ground_meat'
    ingredient_dict['breakfast sausage', 'bulk sausage', 'ground sausage', 'italian turkey sausage',
                    'italian sausage', 'linguiça and/or presunto', 'polish sausage','pork sausage',
                    'pork sausages','sausage','sausage links','sausages','spanish chorizo','smoked sausage',
                    'turkey sausage','andouille sausage', 'andouille sausages','chicken sausage',
                    'chicken sausage links','chorizo','franks'] = 'sausage'
    ingredient_dict['bone in chicken thighs', 'bone-in skin-on chicken thighs', 'chicken','chicken breast','chicken breasts',
                    'chicken drumsticks and thighs','chicken meat','chicken pieces', 'chicken strips',
                    'chicken tenderloins','chicken tenders','chicken thigh','chicken thighs','chicken wings',
                    'chickens','cooked chicken','cooked chicken breast','cooked chicken breasts', 'roasted chicken',
                    'rotisserie chicken','skinless boneless chicken breast','shredded chicken',
                    'skinless boneless chicken breast halves','skinless boneless chicken breasts',
                    'skinless boneless chicken thighs'] = 'chicken'
    ingredient_dict['beef','beef brisket', 'beef chuck roast', 'beef shoulder roast', 'beef steak',
                    'beef stew meat', 'beef tenderloin', 'chuck roast', 'porterhouse steak','rib roast',
                    'rib-eye','rib-eye steak','ribeye steaks','ribs','roast beef','round steak', 'short ribs',
                    'steak', 'steaks','skirt steak'] = 'beef'
    ingredient_dict['boneless pork loin roast','boneless pork shoulder','boston butt', 'cooked pork',
                    'lean pork tenderloin', 'pork','pork belly','pork butt','pork chops','pork loin',
                    'pork loin chops','pork ribs','pork shoulder','pork sirloin tip roast','pork tenderloin',
                    'pork tenderloins','roast pork','roasted pork'] = 'pork'
    ingredient_dict['turkey','roast turkey breast'] = 'turkey'
    ingredient_dict['lamb','lamb stew meat'] = 'lamb'
    ingredient_dict['duck','duck breast'] = 'duck'
    ingredient_dict['bacon','bacon bits','bacon rashers','bacon strips', 'cooked bacon','cooked bacon strips',
                    'thick-cut bacon','pan-fried bacon','turkey bacon'] = 'bacon'
    ingredient_dict['canadian bacon', 'cooked ham', 'deli ham', 'diced ham', 'ham','ham bone','ham steak'] = 'ham'
    ingredient_dict['mortadella', 'pancetta','pepperoni','prosciutto', 'salami'] = 'cured_meat'

    # Seafood
    ingredient_dict['tilapia','tilapia fillets','cod','cod filets','cod fillets','halibut','catfish fillets',
                    'squid','skate wings'] = 'mild_fish'
    ingredient_dict['swordfish','red snapper fillets'] = 'medium_fish'
    ingredient_dict['ahi tuna', 'ahi tuna steak', 'fresh tuna','salmon','salmon fillet','salmon fillets'] = 'strong_fish'
    ingredient_dict['raw shrimp','shrimp','prawns','canned crabmeat', 'crab meat','crabmeat', 'imitation crab meat',
                    'lump crab meat','lobster'] = 'crustacean'
    ingredient_dict['light tuna', 'tuna','water-packed tuna','anchovies', 'anchovies in olive oil', 'anchovy',
                    'anchovy fillets'] = 'canned_fish'
    ingredient_dict['fish'] = 'fish'
    ingredient_dict['clam juice'] = 'clam_juice'
    ingredient_dict['smoked salmon'] = 'smoked_salmon'


    # Herbs & Spices
    ingredient_dict['cumin','cumin powder','cumin seeds', 'ground cumin','ground cumin seed', 'whole cumin'] = 'cumin'
    ingredient_dict['curry leaves', 'curry powder', 'curry paste', 'red curry paste'] = 'curry'
    ingredient_dict['coarse salt', 'coarse sea salt', 'fleur de sel', 'kosher salt','salt','sea salt',
                    'sea-salt','table salt','seasoned salt','seasoning salt','uma pitada de sal'] = 'salt'
    ingredient_dict['cloves ground', 'ground cloves'] = 'clove'
    ingredient_dict['cilantro','cilantro leaves', 'fresh cilantro','fresh cilantro leaves'] = 'cilantro'
    ingredient_dict['celery salt','celery seed'] = 'ground_celery'

    ingredient_dict['caraway seeds'] = 'caraway'
    ingredient_dict['cardamom pods','cardamon','carom seeds', 'ground cardamom'] = 'cardamom'
    ingredient_dict['black pepper', 'black peppercorns', 'ground pepper', 'peppercorn','peppercorns','pepper',
                    'white pepper','whole peppercorns'] = 'black_pepper'
    ingredient_dict['black mustard seeds', 'dry mustard', 'ground mustard', 'mustard powder','mustard seeds',
                    'yellow mustard seed','yellow mustard seeds'] = 'ground_mustard'
    ingredient_dict['bay leaf','bay leaves', 'dried bay leaf'] = 'bay_leaf'
    ingredient_dict['basil','basil leaves'] = 'basil'
    ingredient_dict['allspice'] = 'allspice'
    ingredient_dict['black sesame seeds', 'sesame','sesame seed','sesame seeds','white sesame seeds'] = 'sesame'
    ingredient_dict['cinnamon','cinnamon stick','cinnamon sticks', 'ground cinnamon'] = 'cinnamon'
    ingredient_dict['star anise'] = 'star_anise'
    ingredient_dict['oregano','oregano leaves'] = 'oregano'
    ingredient_dict['tamari'] = 'tamari'
    ingredient_dict['tahini'] = 'tahini'
    ingredient_dict['poppy seed','poppy seeds'] = 'poppy seed'
    ingredient_dict['smoked paprika','paprika'] = 'paprika'
    ingredient_dict['saffron'] = 'saffron'
    ingredient_dict['lavender'] = 'lavender'
    ingredient_dict['lemon pepper seasoning'] = 'lemon_pepper'
    ingredient_dict['italian seasoning'] = 'italian_seasoning'
    ingredient_dict['herbes de provence'] = 'herbes_de_provence'
    ingredient_dict['ground turmeric', 'turmeric','turmeric powder'] = 'turmeric'
    ingredient_dict['ground all spice','ground allspice', 'whole allspice'] = 'allspice'
    ingredient_dict['ground ginger'] = 'ground_ginger'
    ingredient_dict['ground hazelnuts', 'hazelnuts'] = 'hazelnut'
    ingredient_dict['fennel seed', 'fennel seeds'] = 'fennel'
    ingredient_dict['fenugreek leaves','fenugreek seeds'] = 'fenugreek'
    ingredient_dict['dried basil'] = 'basil'
    ingredient_dict['dried chives'] = 'dried_chives'
    ingredient_dict['dried cilantro'] = 'dried_cilantro'
    ingredient_dict['dried garlic', 'garlic flakes','garlic granules','garlic powder', 'granulated garlic',
                    'garlic salt'] = 'ground_garlic'
    ingredient_dict['dried marjoram'] = 'dried_marjoram'
    ingredient_dict['dried onion', 'onion flakes','onion powder'] = 'dried_onion'
    ingredient_dict['dried parsley'] = 'dried_parsley'
    ingredient_dict['dried porcini mushrooms'] = 'dried_mushroom'
    ingredient_dict['dried rosemary'] = 'dried_rosemary'
    ingredient_dict['dried tarragon'] = 'dried_tarragon'
    ingredient_dict['dried thyme'] = 'dried_thyme'
    ingredient_dict['coriander','coriander powder','coriander seeds', 'ground coriander', 'whole coriander seeds'] = 'coriander'
    ingredient_dict['crystallized ginger'] = 'crystallized_ginger'
    ingredient_dict['ground nutmeg', 'nutmeg'] = 'nutmeg'
    ingredient_dict['kefir'] = 'kefir'
    ingredient_dict['hing'] = 'hing'
    ingredient_dict['harissa'] = 'harissa'
    ingredient_dict['garam masala'] = 'garam_masala'
    ingredient_dict['cajun seasoning'] = 'cajun seasoning'
    ingredient_dict['dill seed', 'dried dill','dried dill weed'] = 'dill'

    # Chilies
    ingredient_dict['anaheim chiles','poblano chile','poblano pepper','poblano peppers','green chiles','green chili',
                    'green chilies','green chilis','green chillies','chile peppers', 'chiles', 'chili', 'chilies',
                    'chillies', 'chili peppers','thai chili','thai chili pepper','thai chilis','canned green chiles'] = 'mild_chile'
    ingredient_dict['serrano chili pepper','jalapeno','jalapeno chiles','jalapeno pepper','jalapeno peppers',
                    'jalapenos'] = 'hot_chile'
    ingredient_dict['chile flakes','chili flakes','chilli flakes','chilli powder','chili powder','chile powder',
                    'chipotle','chipotle chili powder','crushed red pepper','dried chile pepper',
                    'ground chipotle chile pepper','red pepper','red pepper flake','red pepper flakes','red chili',
                    'red chili powder','cayenne','cayenne pepper','ground cayenne pepper','ancho chile',
                    'ancho chile powder', 'ancho chili powder', 'ground ancho chile'] = 'ground_chile'
    ingredient_dict['chile garlic sauce','chili oil','sweet chili sauce'] = 'chile_sauce'
    ingredient_dict['canned chipotle in adobo','chipotle chilies in adobo','chipotle in adobo',
                    'chipotle pepper in adobo','chipotle peppers','chipotle peppers in adobo',
                    'chipotle chile in adobo'] = 'chipotle_adobo'

    # Sweetners
    ingredient_dict['erythritol', 'liquid stevia', 'truvia','stevia','stevia extract','swerve sweetener',
                    'sukrin sweetener'] = 'erythritol'
    ingredient_dict['date palm sugar'] = 'date_sugar'
    ingredient_dict['corn syrup', 'golden syrup'] = 'corn_syrup'
    ingredient_dict['confectioners sugar',"confectioners' sugar", 'icing sugar', 'powdered sugar'] = 'powdered_sugar'
    ingredient_dict['coconut palm sugar','coconut sugar', 'gula melaka'] = 'coconut_sugar'
    ingredient_dict['cinnamon sugar'] = 'cinnamon_sugar'
    ingredient_dict['cane sugar', 'granulated sugar','natural cane sugar','raw sugar','sugar','sugar cubes',
                    'turbinado sugar','white sugar','xícara de de açúcar','simple syrup'] = 'sugar'
    ingredient_dict['brown sugar', 'dark brown sugar', 'demerara sugar', 'golden brown sugar', 'jaggery',
                    'light brown sugar'] = 'brown_sugar'
    ingredient_dict['agave', 'agave nectar', 'agave syrup'] = 'agave'
    ingredient_dict['black treacle', 'molasses', 'light muscovado sugar'] = 'molasses'
    ingredient_dict['clear honey', 'honey', 'raw honey'] = 'honey'

    # Veggies
    ingredient_dict['edamame'] = 'edamame'
    ingredient_dict['eggplant','eggplants'] = 'eggplant'
    ingredient_dict['fennel bulb', 'fennel bulbs'] = 'fennel_bulb'
    ingredient_dict['fire roasted canned tomatoes', 'fire roasted tomatoes', 'fire-roasted tomatoes'] = 'fire_roasted_tomato'
    ingredient_dict['green peas', 'pea pods','peas','petite peas','snow peas','sugar snap peas'] = 'pea'
    ingredient_dict['green tomatoes', 'tomatillos'] = 'green_tomato'
    ingredient_dict['jicama'] = 'jicama'
    ingredient_dict['leek','leeks'] = 'leek'
    ingredient_dict['lemon lime soda','squirt'] = 'citrus_soda'
    ingredient_dict['lemongrass'] = 'lemongrass'
    ingredient_dict['lima beans'] = 'lima_bean'
    ingredient_dict['sprouts'] = 'sprouts'
    ingredient_dict['radicchio'] = 'radicchio'
    ingredient_dict['spaghetti squash'] = 'spaghetti_squash'
    ingredient_dict['turnip', 'turnips'] = 'turnip'
    ingredient_dict['radishes'] = 'radish'
    ingredient_dict['okra'] = 'okra'
    ingredient_dict['rutabaga','rutabagas'] = 'rutabaga'
    ingredient_dict['sweet potato','sweet potatoes'] = 'sweet_potato'
    ingredient_dict['red onion','red onions'] = 'red_onion'
    ingredient_dict['shallot','shallots'] = 'shallot'
    ingredient_dict['oil packed sun dried tomatoes','sun-dried tomatoes','sundried tomatoes'] = 'sun_dried_tomato'
    ingredient_dict['onion','onions','sweet onion','sweet onions','vidalia onion','vidalia onions','white onion','white onions','yellow onion','yellow onions'] = 'onion'
    ingredient_dict['zucchini','zucchini noodles','zucchinis'] = 'zucchini'
    ingredient_dict['parsnips'] = 'parsnip'
    ingredient_dict['roasted red pepper','roasted red peppers'] = 'roasted_red_pepper'
    ingredient_dict['acorn squash'] = 'acorn_squash'
    ingredient_dict['canned corn','cobs corn','corn','corn kernels','ear of corn','ears corn','ears of corn',
                    'fresh corn','fresh corn kernels', 'frozen corn','whole kernel corn'] =  'corn'
    ingredient_dict['cabbage', 'green cabbage', 'napa cabbage','purple cabbage','red cabbage','savoy cabbage'] = 'cabbage'
    ingredient_dict['butternut squash'] = 'butternut_squash'
    ingredient_dict['broccoli carrot cauliflower mix', 'mixed veggies', 'root vegetables','vegetable','veggie mix'] = 'mixed_vege'
    ingredient_dict['broccoli','broccoli florets','broccoli rabe','broccolini'] = 'broccoli'
    ingredient_dict['bok choy'] = 'bok_choy'
    ingredient_dict['cos lettuce','boston lettuce', 'boston lettuce leaves', 'butter lettuce', 'iceberg lettuce',
                    'iceburg lettuce', 'hearts of romaine', 'lettuce','lettuce leaf','romaine lettuce','romaine lettuce leaves','salad greens','salad mix', 'spring mix'] = 'lettuce'
    ingredient_dict['black eyed peas', 'canned black eyed peas'] = 'black_eyed_pea'
    ingredient_dict['beet', 'beetroot','beets', 'canned beets'] = 'beet'
    ingredient_dict['beet greens'] = 'beet_greens'
    ingredient_dict['bell pepper', 'green bell pepper','green bell peppers', 'green peppers','orange bell pepper','red bell pepper','red bell peppers','yellow bell pepper','peppers'] = 'bell_pepper'
    ingredient_dict['bean sprouts'] = 'bean_sprouts'
    ingredient_dict['baby bella mushrooms', 'button mushrooms', 'crimini mushrooms', 'fresh mushrooms',
                    'mushroom','mushrooms', 'mixed mushrooms','portabella mushrooms','shiitake mushrooms',
                    'white mushrooms'] = 'mushroom'
    ingredient_dict['baby carrots', 'carrot','carrots'] = 'carrot'
    ingredient_dict['baby corn', 'baby corns'] = 'baby_corn'
    ingredient_dict['baby peas'] = 'peas'
    ingredient_dict['baby potatoes','creamer potatoes','fingerling potatoes','gold potatoes','new potatoes',
                    'potato','potatoes','red potato','red potatoes','russet potato','russet potatoes',
                    'white potatoes','yukon gold potatoes','tater tots','hash brown potatoes','hashbrowns','french fries'] = 'potato'
    ingredient_dict['baby spinach','baby spinach leaves', 'frozen spinach','spinach','spinach leaves'] = 'spinach'
    ingredient_dict['artichoke','artichoke bottoms','artichoke hearts','artichokes', 'frozen artichoke hearts',
                    'marinated artichoke'] = 'artichoke'
    ingredient_dict['arugula', 'baby arugula'] = 'arugula'
    ingredient_dict['asparagus','asparagus spears'] = 'asparagus'
    ingredient_dict['avocado','avocados', 'haas avocados'] = 'avocado'
    ingredient_dict['fresh dill', 'dill'] = 'fresh_dill'
    ingredient_dict['fresh ginger','fresh ginger root', 'ginger'] = 'ginger'
    ingredient_dict['fresh green beans', 'green beans', 'haricots verts'] = 'green_bean'
    ingredient_dict['fresh herbs'] = 'freshh_herbs'
    ingredient_dict['fresh mint','fresh mint leaves', 'mint', 'mint leaves'] = 'fresh_mint'
    ingredient_dict['fresh rosemary','fresh rosemary leaves', 'rosemary','rosemary leaves'] = 'rosemary'
    ingredient_dict['fresh sage','fresh sage leaves', 'ground sage', 'sage','sage leaves'] = 'sage'
    ingredient_dict['fresh tarragon', 'tarragon'] = 'tarragon'
    ingredient_dict['fresh thyme','fresh thyme leaves','thyme','thyme leaves','thyme sprigs'] = 'thyme'
    ingredient_dict['fresh basil','fresh basil leaves','fresh bay leaves', 'lemon basil'] = 'fresh_basil'
    ingredient_dict['fresh coriander','fresh coriander leaves'] = 'fresh_coriander'
    ingredient_dict['flat leaf parsley','flat leaf parsley leaves','flat-leaf parsley','fresh flat leaf parsley',
                    'fresh parsley', 'fresh parsley leaves', 'parsley','parsley leaves'] = 'parsley'
    ingredient_dict['cucumber', 'cucumbers', 'english cucumber'] = 'cucumber'
    ingredient_dict['coleslaw mix'] = 'coleslaw_mix'
    ingredient_dict['collard greens', 'greens', 'mustard greens', 'leafy greens', 'turnip greens','swiss chard',
                    'water spinach','watercress'] = 'greens'
    ingredient_dict['chive','chives', 'green onion','green onions', 'scallion','scallion greens','scallions',
                    'spring onions','tokyo negi'] = 'chive'
    ingredient_dict['cherry tomato','cherry tomatoes', 'grape tomatoes', 'plum tomato','plum tomatoes'] = 'sweet_tomato'
    ingredient_dict['celery','celery stalk','celery stalks','celery stick','celery leaves','celery root'] = 'celery'
    ingredient_dict['cauliflower','cauliflower florets','cauliflowerets'] = 'cauliflower'
    ingredient_dict['canned diced tomatoes', 'canned tomatoes', 'heirloom tomato', 'roma tomato','roma tomatoes',
                    'stewed tomatoes','tomatoes','tomatos', 'tomato', 'tomaoes','vine ripened tomatoes'] = 'tomato'
    ingredient_dict['capers'] = 'caper'
    ingredient_dict['kiwi','kiwis'] = 'kiwi'
    ingredient_dict['kale', 'lacinato kale'] = 'kale'
    ingredient_dict['horseradish'] = 'horseradish'
    ingredient_dict['green grams'] = 'mung_bean'
    ingredient_dict['ginger garlic paste','ginger paste','ginger-garlic paste'] = 'ginger_paste'
    ingredient_dict['garlic','garlic clove','garlic cloves', 'garlics', 'roasted garlic','whole garlic',
                    'whole garlic clove'] = 'garlic'
    ingredient_dict['bamboo shoots'] = 'bamboo_shoot'
    ingredient_dict['brussels sprouts']  = 'brussels_sprouts'
    ingredient_dict['galangal'] = 'galangal'
    ingredient_dict['creamed corn'] = 'creamed_corn'
    ingredient_dict['delicata squash', 'squash','summer squash','winter squash','yellow squash',
                    'yellow summer squash'] = 'squash'
    ingredient_dict['guacamole'] = 'guacamole'
    ingredient_dict['hominy'] = 'hominy'
    ingredient_dict['edible flowers','squash blossoms'] = 'edible_flowers'
    ingredient_dict['pepperoncini','pickled jalapenos','pickled ginger','pimentos'] = 'pickled_veg'
    ingredient_dict['dill pickle chips', 'dill pickles','pickle','pickles','dill pickle juice'] = 'dill_pickle'
    ingredient_dict['dill pickle relish','pickle relish','sweet pickle relish'] = 'pickle_relish'
    ingredient_dict['canned pumpkin', 'canned pumpkin puree','solid pack pumpkin','pumpkin','pumpkin pie mix',
                    'pumpkin puree'] = 'pumpkin'
    ingredient_dict['black olives', 'greek olives', 'green olives', 'kalamata olives', 'oil cured black olives',
                    'olives','pimento stuffed olives'] = 'olive'

    # Thickening Agents / Grains / Flours
    ingredient_dict['agar'] = 'agar'
    ingredient_dict['sorghum flour', 'teff flour','semolina flour', 'quinoa flakes','quinoa flour','soy flour',
                    'spelt','spelt flour'] = 'flour_sub'
    ingredient_dict['millet','millet flour'] = 'millet'
    ingredient_dict['corn flour'] = 'corn_flour'
    ingredient_dict['coconut flour'] = 'coconut_flour'
    ingredient_dict['bread flour'] = 'bread_flour'
    ingredient_dict['buckwheat flour'] = 'buckwheat_flour'
    ingredient_dict['brown rice flour', 'rice flour','sweet rice flour'] = 'rice_flour'
    ingredient_dict['besan flour', 'kadalai maavu'] = 'gram_flour'
    ingredient_dict['arrowroot','arrowroot powder'] = 'arrowroot'
    ingredient_dict['almond flour', 'almond meal', 'almond meal flour', 'blanched almond flour', 'ground almonds'] = 'almond_flour'
    ingredient_dict['alfredo pasta sauce', 'alfredo sauce'] = 'alfredo'
    ingredient_dict['all purpose flour', 'flour', 'unbleached all purpose flour','unbleached flour','plain flour',
                    'self-raising flour','white flour','white whole wheat flour','whole wheat flour',
                    'whole wheat white flour'] = 'ap_flour'
    ingredient_dict['corn meal', 'cornmeal', 'fine cornmeal', 'ground cornmeal', 'yellow cornmeal',] = 'cornmeal'
    ingredient_dict['corn starch', 'cornstarch'] = 'corn_starch'
    ingredient_dict['amaranth grain'] = 'amaranth_grain'
    ingredient_dict['brown rice', 'cooked brown rice']    = 'brown_rice'
    ingredient_dict['grain blend'] = 'grain_blend'
    ingredient_dict['quick cooking grits', 'oatmeal'] = 'hot_cereal'
    ingredient_dict['old fashioned oats','old fashioned rolled oats','old-fashioned oats','oats','quick cooking oats',
                    'rolled oats','steel cut oats'] = 'oats'
    ingredient_dict['tapioca','tapioca flour','tapioca starch','quick cooking tapioca'] = 'tapioca'
    ingredient_dict['whole wheat pastry flour','pastry flour','cake flour'] = 'pastry_flour'
    ingredient_dict['pearl barley','quick cooking barley'] = 'barley'
    ingredient_dict['potato starch','potato starch flour'] = 'potato_flour'
    ingredient_dict['oat bran','oat flour'] = 'oat_flour'
    ingredient_dict['wheat berries','wheat bran','wheat germ','vital wheat gluten'] = 'wheat'
    ingredient_dict['cooked couscous', 'dry couscous'] = 'couscous'
    ingredient_dict['cooked quinoa','quinoa'] = 'quinoa'
    ingredient_dict['arborio rice','risotto rice'] = 'arborio_rice'
    ingredient_dict['basmati rice'] = 'basmati_rice'
    ingredient_dict['cooked rice', 'cooked white rice', 'instant white rice', 'rice','white rice',
                    'ready-to-serve asian fried rice'] = 'rice'
    ingredient_dict['corn bread mix'] = 'corn_bread_mix'

    # Nuts & Seeds
    ingredient_dict['flax meal','flax seed','flaxmeal','ground flaxseed'] = 'flax'
    ingredient_dict['hemp seeds'] = 'hemp_seed'
    ingredient_dict['sunflower seeds'] = 'sunflower_seed'
    ingredient_dict['pine nuts'] = 'pine_nut'
    ingredient_dict['unsalted pistachios','pistachios'] = 'pistachio'
    ingredient_dict['raw pumpkin seeds','roasted pumpkin seeds','pepitas'] = 'pumpkin_seed'
    ingredient_dict['pecan','pecan pieces','pecans'] = 'pecan'
    ingredient_dict['almond', 'almonds','slivered almonds','almond extract'] = 'almond'
    ingredient_dict['dry roasted peanuts', 'peanut','peanuts','roasted peanuts','unsalted peanuts'] = 'peanut'
    ingredient_dict['creamy peanut butter', 'crunchy peanut butter', 'peanut butter','powdered peanut butter',
                    'smooth peanut butter'] = 'peanut_butter'
    ingredient_dict['cashews', 'roasted cashews','salted cashews','salted roasted cashews','raw cashews'] = 'cashew'
    ingredient_dict['almond butter', 'nut butter'] = 'almond_butter'
    ingredient_dict['chia seed','chia seeds'] = 'chia_seed'
    ingredient_dict['walnuts'] = 'walnut'

    # Beverages
    ingredient_dict['tequila'] = 'tequila'
    ingredient_dict['tea'] = 'tea'
    ingredient_dict['sake'] = 'sake'
    ingredient_dict['rose water'] = 'rose_water'
    ingredient_dict['vodka'] = 'vodka'
    ingredient_dict['whiskey'] = 'whiskey'
    ingredient_dict['matcha tea'] = 'matcha'
    ingredient_dict['lemonade'] = 'lemonade'
    ingredient_dict['kahlua'] = 'kahlua'
    ingredient_dict['gin'] = 'gin'
    ingredient_dict['fernet-branca'] = 'fernet'
    ingredient_dict['dessert wine'] = 'dessert_wine'
    ingredient_dict['dark rum','rum','rum extract','spiced rum'] = 'rum'
    ingredient_dict['crème de cacao'] = 'crème_de_cacao'
    ingredient_dict['club soda','seltzer water'] = 'club_soda'
    ingredient_dict['chardonnay', 'dry white wine', 'wine', 'white wine'] = 'white_wine'
    ingredient_dict['champagne', 'sparkling wine'] = 'sparkling_wine'
    ingredient_dict['bourbon'] = 'bourbon'
    ingredient_dict['brandy'] = 'brandy'
    ingredient_dict['beer', 'dark beer', 'guinness', 'lager', 'rye beer'] = 'beer'
    ingredient_dict['coca cola', 'coke', 'cola flavored carbonated beverage', 'diet soda', 'dr. pepper'] = 'cola'
    ingredient_dict['dry sherry'] = 'sherry'
    ingredient_dict['dry cider', 'stella artois cidre'] = 'cider'
    ingredient_dict['cabernet sauvignon', 'dry red wine', 'pinot noir', 'red wine'] = 'red_wine'
    ingredient_dict['amaretto'] = 'amaretto'
    ingredient_dict['espresso powder', 'instant espresso','instant espresso powder'] = 'espresso_powder'
    ingredient_dict['decaf coffee'] = 'decaf_coffee'
    ingredient_dict['coffee','coffee beans', 'strong coffee'] = 'coffee'
    ingredient_dict['coffee extract'] = 'coffee_extract'
    ingredient_dict['instant coffee','instant coffee granules'] = 'instant_coffee'
    ingredient_dict['ginger beer'] = 'ginger_beer'
    ingredient_dict['cointreau'] = 'cointreau'
    ingredient_dict['eggnog'] = 'eggnog'
    ingredient_dict['irish cream'] = 'irish_cream'

    # Dessert
    ingredient_dict['white chocolate','white chocolate chips'] = 'white_chocolate'
    ingredient_dict['toffee bar','toffee bits'] = 'toffee'
    ingredient_dict['peanut butter candies','peanut butter candy','peanut butter chips','pb cups','snickers'] = 'candy'
    ingredient_dict['mint extract','peppermint baking chips','peppermint extract','andes mints',
                    'crème de menthe baking chips'] = 'mint'
    ingredient_dict['marshmallow cream','marshmallow creme','marshmallow fluff','marshmallow peeps',
                    'marshmallows'] = 'marshmallow'
    ingredient_dict['lemon cake mix','spice cake mix','vanilla cake mix','white cake mix','yellow cake mix'] = 'cake_mix'
    ingredient_dict['jelly beans'] = 'jelly_beans'
    ingredient_dict['hot chocolate mix'] = 'hot_choc'
    ingredient_dict['graham cracker crumbs','graham cracker crust','graham cracker sheets','graham crackers'] = 'graham_cracker'
    ingredient_dict['ginger snap crumbs','ginger snaps','gingerbread','gingersnap crumbs'] = 'gingerbread'
    ingredient_dict['fat free cool whip', 'lightly sweetened whipped cream', 'whipped cream','whipped topping',
                    'nonfat cool whip'] = 'whipped_cream'
    ingredient_dict['dark chocolate','dark chocolate bar','dark chocolate candy bars', 'dark chocolate chips'] = "dark_chocolate"
    ingredient_dict['cream cheese frosting', 'cream cheese icing', 'icing'] = 'frosting'
    ingredient_dict['chocolate chip cookie', 'chocolate cookie crust', 'chocolate wafer cookies', 'cookie',
                    'cookie crumbs','cookie mix','cookies', 'ladyfingers','nilla wafers','oreo cookies','oreos',
                    'shortbread cookies','vanilla wafer cookies','vanilla wafers', 'scones'] = 'cookie'
    ingredient_dict['chocolate hazelnut spread', 'nutella'] = 'nutella'
    ingredient_dict['chocolate ice cream sauce', 'chocolate syrup', 'fudge ice cream topping','fudge topping',
                    'hot fudge sauce'] = 'chocolate_sauce'
    ingredient_dict['caramel','caramel sauce','caramel topping','caramels', 'dulce de leche'] = 'caramel'
    ingredient_dict['candy cane','candy canes'] = 'candy_cane'
    ingredient_dict['candy coating','candy melting wafers','candy melts'] = 'candymelt'
    ingredient_dict['baking chocolate', 'bittersweet chocolate', 'chocolate', 'cocoa', 'dutch process cocoa',
                    'dutch processed cocoa', 'german chocolate'] = 'chocolate'
    ingredient_dict['baking cocoa', 'cacao powder', 'cocoa powder', 'dutch processed cocoa powder',
                    'dutch process cocoa powder', 'unsweetened baking cocoa','unsweetened cocoa',
                    'unsweetened cocoa powder'] = 'cocoa_powder'
    ingredient_dict['allergy friendly chocolate chips', 'bittersweet chocolate chips', 'cacao nibs',
                    'chocolate chips', 'milk chocolate chips','semi sweet chocolate chips',
                    'semi sweet chocolate morsels','semi-sweet chocolate','semi-sweet chocolate baking chips',
                    'semisweet chocolate','semisweet chocolate chips','unsweetened chocolate'] = 'chocolate_chips'
    ingredient_dict['chocolate shavings', 'chocolate sprinkles','sprinkles','rainbow sprinkles'] = 'sprinkles'
    ingredient_dict['brownie mix'] = 'brownie_mix'
    ingredient_dict['angel food cake', 'lb cake', 'pound cake'] = 'sponge_cake'
    ingredient_dict['butterscotch chips'] = 'butterscotch_chips'
    ingredient_dict['butterfingers'] = 'butterfingers'
    ingredient_dict['gelatin'] = 'gelatin'
    ingredient_dict['ice cream', 'vanilla ice cream','sherbet'] = 'ice_cream'
    ingredient_dict['instant chocolate pudding mix', 'instant lemon pudding mix','instant vanilla pudding mix',
                    'lemon pie filling','lemon pudding mix', 'vanilla pudding mix'] = 'pudding'
    ingredient_dict["m & m's para decorar",'m&m candies','mini m&m', 'mnm minis'] = 'm&m'

    # Cheese
    ingredient_dict['romano cheese','pecorino romano cheese','parmesan cheese','swiss cheese','asiago cheese',
                    'parmigiano reggiano','pecorino','parmesan','sharp cheddar','extra sharp cheddar cheese',
                    'white cheddar cheese','sharp cheddar cheese'] = 'hard_cheese'
    ingredient_dict['provolone cheese','provolone','gouda','gouda cheese','gruyere','gruyere cheese','halloumi cheese'] = 'semi_hard_cheese'
    ingredient_dict['mozzarella','mozzarella cheese','part skim mozzarella','part-skim mozzarella',
                    'part-skim mozzarella cheese','skim milk mozzarella cheese','havarti cheese',
                    'pepperjack cheese','fontina cheese'] = 'semi_soft_cheese'
    ingredient_dict['ricotta','ricotta salata','feta','feta cheese','low fat ricotta cheese',
                    'skim milk ricotta cheese','part skim ricotta cheese','ricotta cheese','skim milk ricotta',
                    'cotija cheese','goat cheese','buffalo mozzarella', 'fresh mozzarella','fresh mozzarella ball',
                    'fresh mozzarella cheese','mascarpone','mascarpone cheese'] = 'soft_cheese'
    ingredient_dict['bleu cheese', 'blue cheese', 'blue cheese crumbles', 'gorgonzola','gorgonzola cheese'] = 'blue_cheese'
    ingredient_dict['processed american cheese','nacho cheese sauce','queso dip'] = 'processed_cheese'
    ingredient_dict['cheese','italian cheese blend','jack cheese','mexican cheese','monterey jack cheese',
                    'low fat cheese','shredded mexican cheese blend','shredded mozzarella',
                    'shredded mozzarella cheese','shredded cheddar','shredded cheddar cheese','shredded cheese',
                    'reduced fat shredded cheddar cheese','cheddar cheese','colby and monterey jack cheese',
                    'colby jack cheese'] = 'cheese'

    # Dairy
    ingredient_dict['low fat sour cream', 'mexican crema', 'sour cream','crème fraîche'] = 'sour_cream'
    ingredient_dict['cream', 'double cream', 'heavy cream','heavy whipping cream','half & half','half and half',
                    'half n half','half n half cream', 'whipping cream'] = 'cream'
    ingredient_dict['cream cheese', 'cream cheese block', 'light cream cheese', 'neufchatel cheese'] = 'cream_cheese'
    ingredient_dict['chocolate milk'] = 'chocolate_milk'
    ingredient_dict['buttermilk'] = 'buttermilk'
    ingredient_dict['evaporated milk', 'milk powder','skim evaporated milk','nonfat milk powder','skim milk powder'] = 'evaporated_milk'
    ingredient_dict['fat-free cottage cheese'] = 'cottage_cheese'
    ingredient_dict['fat-free milk', 'milk', 'low fat milk', 'whole milk','skimmed milk','nonfat milk'] = 'milk'
    ingredient_dict['full fat plain yogurt', 'low fat plain yogurt', 'low fat yogurt', 'low-fat yogurt',
                    'natural yogurt','plain yogurt','vanilla yogurt','yoghurt','yogourt','yogurt'] = 'yogurt'
    ingredient_dict['0% fat greek yogurt', 'greek yogurt', 'low fat greek yogurt', 'lowfat greek yoghurt',
                    'skim vanilla greek yogurt','plain greek yogurt','nonfat greek yogurt',
                    'non-fat greek yogurt'] = 'greek_yogurt'
    ingredient_dict['a 4 colheres de de leite condensado', 'condensed milk','sweetened condensed milk'] = 'condensed_milk'
    ingredient_dict['egg', 'eggs', 'whole egg','whole eggs'] = 'egg'
    ingredient_dict['egg white','egg white powder','egg whites'] = 'egg_white'
    ingredient_dict['egg yolk','egg yolks'] = 'egg_yolk'
    ingredient_dict['hard cooked eggs','hard-boiled eggs','hardboiled egg','hardboiled eggs'] = 'hard_boiled_egg'

    # Oils and Fats
    ingredient_dict['grape seed oil', 'grapeseed oil'] = 'grape_seed_oil'
    ingredient_dict['dark sesame oil', 'sesame oil'] = 'sesame_oil'
    ingredient_dict['coconut oil','coconut butter'] = 'coconut_oil'
    ingredient_dict['canola oil', 'cooking oil', 'oil','peanut oil','vegetable oil','palm oil','rapeseed oil',
                    'walnut oil'] = 'light_oil'
    ingredient_dict['avocado oil'] = 'avocado_oil'
    ingredient_dict['bacon fat', 'lard'] = 'animal_fat'
    ingredient_dict['butter', 'light butter', 'margarine', 'salted butter','unsalted butter','ghee'] = 'butter'
    ingredient_dict['butter flavored shortening', 'shortening','solid vegetable shortening','vegetable shortening'] = 'shortening'
    ingredient_dict['extra virgin olive oil','extra-virgin olive oil', 'light olive oil', 'olive oil'] = 'olive_oil'


    # Beans
    ingredient_dict['canned pinto beans', 'pinto beans'] = 'pinto_bean'
    ingredient_dict['canned kidney beans', 'canned red kidney beans', 'chili beans', 'dried kidney beans',
                    'kidney beans', 'red kidney beans'] = 'kidney_bean'
    ingredient_dict['canned garbanzo beans'] = 'garbanzo_bean'
    ingredient_dict['canned great northern beans', 'great northern beans'] = 'great_northern_bean'
    ingredient_dict['canned cannellini beans','canned white beans', 'canned white cannellini beans',
                    'cannellini beans', 'white beans'] = 'cannellini_beans'
    ingredient_dict['canned chickpeas', 'chickpeas'] = 'chickpeas'
    ingredient_dict['black beans', 'canned black beans', 'cooked black beans', 'refried beans'] = 'black_bean'
    ingredient_dict['mat beans'] = 'mat_bean'
    ingredient_dict['canned lentils', 'cooked red lentils', 'dried lentils', 'lentils','red lentils'] = 'lentil'

    # Breads & Pastas
    ingredient_dict['burger bun', 'hamburger buns', 'sandwich bun','sandwich buns','sandwich rolls',
                    'slider buns','sub buns','sub roll','sub rolls','whole wheat buns', 'poppyseed roll'] = 'bun'
    ingredient_dict['bread', 'multi grain bread','wholemeal bread', 'white sandwich bread','white bread',
                    'sourdough bread','pita','pita breads','wheat flatbreads','naan','naan bread','texas toast',
                    'hawaiian bread','pizza crust','pizza dough'] = 'bread'
    ingredient_dict['bread crumbs', 'breadcrumb', 'breadcrumbs', 'dry bread crumbs', 'dry breadcrumbs', 'italian seasoned bread crumbs', 'panko','panko bread crumbs','panko breadcrumbs','seasoned bread crumbs'] = 'breadcrumb'
    ingredient_dict['bread dough'] = 'bread_dough'
    ingredient_dict['blintzes -)', 'pancake mix'] = 'pancake'
    ingredient_dict['biscuits', 'buttermilk biscuits'] = 'biscuits'
    ingredient_dict['bagels'] = 'bagel'
    ingredient_dict['baguette','baguettes'] = 'baguette'
    ingredient_dict['brioche','brioche buns'] = 'brioche'
    ingredient_dict['ciabatta loaf','ciabatta rolls'] = 'ciabatta'
    ingredient_dict['crescent roll dough','crescent rolls', 'croissants', 'refrigerated crescent dinner rolls'] = 'croissant'
    ingredient_dict['crostini', 'croutons'] = 'croutons'
    ingredient_dict['filo dough','filo pastry', 'puff pastry','puff pastry dough','puff pastry sheets',
                    'puff pastry shells','shortcrust pastry','pastry dough','pie crust','pie shell','pie shells',
                    'refrigerated pie crust','refrigerated pie crusts'] = 'pastry_dough'
    ingredient_dict['english muffins'] = 'english_muffin'
    ingredient_dict['egg noodles'] = 'egg_noodles'
    ingredient_dict['crackers', 'cracker', 'ritz crackers','saltine crackers','saltines','pita chips',
                    'pretzels'] = 'crackers'
    ingredient_dict['angel hair', 'big shells', 'cavatappi pasta', 'cooked penne pasta', 'ditalini pasta',
                    'elbow macaroni','fettuccine','fettuccini', 'fusilli', 'linguine', 'lasagna noodles',
                    'long pasta', 'orzo','orzo pasta','pasta','pasta shells','penne','penne pasta','rigatoni',
                    'shells','ziti', 'whole wheat spaghetti','spaghetti','spaghetti noodles','spaghetti pasta',
                    'refrigerated spinach tortellini','noodles','rice noodles','soba noodles'] = 'pasta'
    ingredient_dict['flour tortillas', 'taco shells','tacos','whole wheat tortillas','tortillas',
                    'tortilla chips','corn tortillas','corn chips', 'corn tortilla chips'] = 'tortilla'
    ingredient_dict['gnocchi'] = 'gnocchi'

    # Alternatives
    ingredient_dict['soy buttery spread', 'vegan margarine'] = 'df_butter'
    ingredient_dict['quorn mince'] = 'meat_sub'
    ingredient_dict['egg replacer', 'ener-g egg replacer', 'chia eggs'] = 'egg_replacement'
    ingredient_dict['dairy free cheese', 'vegan cheese','marzipan'] = 'df_cheese'
    ingredient_dict['dairy free milk', 'non-dairy milk', 'unsweetened soy milk'] = 'df_milk'
    ingredient_dict['almond milk'] = 'almond_milk'
    ingredient_dict['extra firm tofu', 'tofu','tempeh','seitan'] = 'tofu'
    ingredient_dict['vegan chocolate chips'] = 'df_choc_chip'
    ingredient_dict['gf chocolate cake mix'] = 'gf_cake_mix'
    ingredient_dict['gluten free all purpose flour','gluten-free flour'] = 'gf_flour'
    ingredient_dict['dairy-free chocolate chips'] = 'df_choc_chips'

    # Stock
    ingredient_dict['chicken bouillon','chicken bouillon cube','chicken bouillon cubes','chicken broth',
                    'chicken stock','fat free chicken broth','low sodium chicken broth','low sodium chicken stock',
                    'low-salt chicken broth', 'stock','turkey stock', 'reduced sodium chicken broth'] = "chicken_stock"
    ingredient_dict['vegetable broth','vegetable stock'] = 'vege_stock'
    ingredient_dict['beef broth', 'beef consomme', 'beef stock', 'canned beef broth', 'low sodium beef broth'] = 'beef_stock'

    # Sauces
    ingredient_dict['ranch','ranch dressing','ranch dressing mix','ranch mix','ranch salad dressing',
                    'ranch salad dressing mix'] = 'ranch'
    ingredient_dict['ketchup'] = 'ketchup'
    ingredient_dict['hot sauce', 'sriracha','sriracha hot sauce','sriracha sauce','tabasco','tabasco sauce',
                    'pepper sauce','sambal oelek','buffalo sauce','buffalo wing sauce','chili paste',
                    'chili sauce'] = 'hot_sauce'
    ingredient_dict['hoisin sauce'] = 'hoisin'
    ingredient_dict['canned tomato sauce', 'marinara sauce','pasta sauce','pizza sauce','spaghetti sauce',
                    'tomato puree','tomato sauce', 'tomato juice','tomato paste'] = 'tomato_sauce'
    ingredient_dict['caesar dressing'] = 'caesar_dressing'
    ingredient_dict['browning sauce'] = 'browning_sauce'
    ingredient_dict['barbecue sauce', 'bbq sauce'] = 'bbq_sauce'
    ingredient_dict['basil pesto', 'pesto'] = 'pesto'
    ingredient_dict['adobo sauce'] = 'adobo'
    ingredient_dict['worcestershire sauce'] = 'worcestershire'
    ingredient_dict['tzatziki sauce'] = 'tzatziki'
    ingredient_dict['balsamic glaze','balsamic vinegar'] = 'balsamic'
    ingredient_dict['italian dressing','italian salad dressing mix'] = 'italian_dressing'
    ingredient_dict['fat free mayo', 'fat-free mayonnaise', 'low fat mayonnaise', 'mayo','mayonnaise',
                    'light mayonnaise', 'reduced fat mayo'] = 'mayo'
    ingredient_dict['dijon mustard', 'grainy mustard', 'mustard', 'spicy brown mustard','whole-grain mustard',
                    'yellow mustard'] = 'mustard'
    ingredient_dict['hummus'] = 'hummus'

    ingredient_dict['tomato ketchup'] = 'ketchup'
    ingredient_dict['pico de gallo','salsa'] = 'salsa'
    ingredient_dict['enchilada sauce', 'red enchilada sauce'] = 'enchilada_sauce'

    # Asian
    ingredient_dict['canned water chestnuts','water chestnuts'] = 'water_chestnut'
    ingredient_dict['dashi'] = 'dashi'
    ingredient_dict['fish sauce', 'oyster sauce'] = 'fish_sauce'
    ingredient_dict['mirin','shaoxing wine'] = 'mirin'
    ingredient_dict['miso soybean paste', 'yellow miso'] = 'miso'
    ingredient_dict['kombu'] = 'seaweed'
    ingredient_dict['wasabi paste'] = 'wasabi'
    ingredient_dict['won ton wrappers','wonton wrappers'] = 'wonton'
    ingredient_dict['tamarind'] = 'tamarind'
    ingredient_dict['light soy sauce','low sodium soy sauce','kecap manis','reduced sodium soy sauce','soy sauce',
                    'coconut aminos'] = 'soy_sauce'
    ingredient_dict['garlic oil'] = 'garlic_oil'
    ingredient_dict['coconut milk','coconut water','canned coconut milk','light coconut milk',
                    'unsweetened coconut milk'] = 'coconut_milk'

    remove_set = set(['as required', 'bake your own', 'condiments', 'cutters', 'each', 'enough', 'feeds', 'garnish',
                  'ground', 'guar gum', 'i swear', 'juice', 'just over', 'mason jars', 'mix', 'mixed peel',
                  'mixed spice', 'moist', 'meat','optional','see post above','saucepan','slow cooker','time',
                  'to','toppings','veined','salt & pepper','salt and pepper','omelette','nuts','seeds','wrap',
                  'xanthan gum','rub', 'taco seasoning','taco seasoning mix','steak seasoning','spice rub',
                  'seasoning','seasoning blend','seasoning mix','pumpkin pie spice','pumpkin spice mix',
                  'old bay seasoning','queso quesadilla','to 4 suman sa ibus','slit','steak sauce',
                  'apple pie spice','chicken seasoning', 'creole seasoning','fruit','salad dressing',
                  'slaw dressing'])

    feature_dict = dict([('dairy free', 'dairy_free'), ('fodmap friendly', 'fodmap_friendly'), ('gluten free', 'gluten_free'),
                         ('ketogenic', 'keto'), ('lacto ovo vegetarian', 'vegetarian'), ('paleolithic', 'paleo'),
                         ('pescatarian', 'pescatarian'), ('primal', 'primal'), ('vegan', 'vegan'), ('whole 30', 'whole_30'),
                         ('american', 'american'), ('asian', 'asian'), ('british', 'british'), ('caribbean', 'caribbean'),
                         ('central american', 'central_american'), ('chines', 'chinese'), ('english', 'english'),
                         ('european','european'),('french', 'french'), ('german', 'german'), ('greek', 'greek'),
                         ('indian', 'indian'), ('italian', 'italian'),('jewish', 'jewish'), ('mediterranean', 'mediterranean'),
                         ('mexican', 'mexican'), ('middl eastern', 'middle_eastern'),('scottish', 'scottish'),
                         ('southern', 'southern'), ('spanish', 'spanish'),('vietnames', 'vietnamese'), ('antipasti', 'appetizer'),
                         ('antipasto', 'appetizer'),('appetizer', 'appetizer'), ('batter', 'batter'), ('bread', 'bread'),
                         ('breakfast', 'breakfast'),('brunch', 'breakfast'), ('condiment', 'condiment'), ('dessert', 'dessert'),
                         ('dinner', 'dinner'), ('dip', 'dip'), ("hor d'oeuvre", 'appetizer'), ('lunch', 'lunch'),
                         ('main course', 'main_dish'),('main dish', 'main_dish'), ('morning meal', 'breakfast'),('salad', 'salad'),
                         ('sauce', 'condiment'),('side dish', 'side_dish'), ('snack', 'snack'),('soup', 'soup'),
                         ('spread', 'spread'), ('starter', 'appetizer'), ('african', 'african'), ('cajun', 'cajun'), ('creol', 'cajun'),
                         ('south american', 'south_american'), ('latin american', 'latin_american'), ('irish', 'irish'), ('thai', 'thai'),
                         ('bbq', 'bbq'), ('barbecu', 'bbq'), ('japanes', 'japenese'), ('scandinavian', 'eastern_european'),
                         ('nordic', 'eastern_european'), ('beverage', 'beverage'), ('drink', 'beverage'), ('frosting', 'dessert'),
                         ('icing', 'dessert'), ('crust', 'bread')])

    categorical_feat = []
    unbucketed_ingredients = []
    for recipe in recipes_json:
        feats = []

        for ingredient in recipe['extendedIngredients']:
            if ingredient['name'].lower() in remove_set:
                continue
            elif ingredient_dict.get(ingredient['name'].lower()) == None:
                unbucketed_ingredients.append(ingredient['name'].lower())
            else:
                feats.append(ingredient_dict.get(ingredient['name'].lower()))
        for diet in recipe['diets']:
            feats.append(feature_dict.get(diet.lower()))
        for dt in recipe['dishTypes']:
            feats.append(feature_dict.get(dt.lower()))
        for cuisine in recipe['cuisines']:
            feats.append(feature_dict.get(cuisine.lower()))
        categorical_feat.append(feats)

    return categorical_feat, unbucketed_ingredients
Пример #28
0
from os.path import join, exists

# change this variable to set a Skill name that does not sound strange in your used language:
SKILL_NAME = 'FH-SWF Raumbelegung'

VPIS_BASE_URL = 'https://vpis.fh-swf.de'
VPIS_CONTROL_URL = VPIS_BASE_URL + '/vpisapp.php'
# location = path after base url ;SEMESTER; is used here as a variable.
VPIS_COURSES_URL_LOCATION = '/;SEMESTER;/faecherangebotplanung.php3'

additionalRequestHeaders = {
    'User-Agent':
    'Mycroft FhSwfRoomQuerySkill (https://github.com/fhswf/mycroft-fhswf-raumbelegung-skill) [2021, Silvio Marra]'
}

fhswfLocationMap = multi_key_dict()
fhswfLocationMap['iserlohn', 'is', 'frauenstuhlweg', 'frauenstuhl weg',
                 'campus iserlohn'] = 'Iserlohn'
fhswfLocationMap['hagen', 'ha', 'haldener strasse', 'haldener straße',
                 'haldener str', 'campus hagen'] = 'Hagen'
fhswfLocationMap['lüdenscheid', 'luedenscheid', 'ls', 'bahnhofsallee',
                 'campus luedenscheid', 'campus lüdenscheid'] = 'Lüdenscheid'
fhswfLocationMap['meschede', 'me', 'lindenstrasse', 'lindenstraße',
                 'linden straße', 'linden strasse', 'linden str',
                 'campus meschede'] = 'Meschede'
fhswfLocationMap['soest', 'so', 'lübecker ring', 'luebecker ring',
                 'campus soest'] = 'Soest'
# location "Im Alten Holz" seems to be invalid for API
# fhswfLocationMap['im alten holz', 'hagen iah', 'ha iah', 'hagen im alten holz'] = 'Hagen IAH'

fhswfLocationVpisShortKey = {
Пример #29
0
def random_picture(request, keyword_for_picture):

    c = multi_key_dict()

    c['항공모함', '전투함'] = 'aircraft carrier.npy'
    c['비행기', '항공기', '공항', '여행', '해외', '해외여행', '여객기'] = 'airplane.npy'
    c['알람', '알람시계', '자명종'] = 'alarm clock.npy'
    c['구급차', '앰뷸런스', '엠뷸런스', '앰뷸란스', '이송', '코로나'] = 'ambulance.npy'
    c['천사', '앤젤', '요정'] = 'angel.npy'
    c['갈매기', '이주', '동물이동', '철새', '새떼'] = 'animal migration.npy'
    c['개미', '벌레', '곤충'] = 'ant.npy'
    c['모루'] = 'anvil.npy'
    c['팔', '팔뚝'] = 'arm.npy'
    c['아스파라거스'] = 'asparagus.npy'
    c['도끼', '흉기', '무기'] = 'axe.npy'
    c['가방', '베낭', '배낭', '백팩', '책가방'] = 'backpack.npy'
    c['바나나'] = 'banana.npy'
    c['밴드', '반창고', '흉터', '상처'] = 'bandage.npy'
    c['외양간'] = 'barn.npy'
    c['야구공', '야구', '야구장'] = 'baseball.npy'
    c['야구배트', '배트', '빠따', '야구빠따', '몽둥이', '방망이', '회초리'] = 'baseball bat.npy'
    c['바구니', '과일바구니'] = 'basket.npy'
    c['농구공', '농구'] = 'basketball.npy'
    c['박쥐', '배트맨'] = 'bat.npy'
    c['욕조', '욕실'] = 'bathtub.npy'
    c['해변', '해수욕장', '해변가', '해운대', '경포대'] = 'beach.npy'
    c['곰', '곰돌이'] = 'bear.npy'
    c['산적', '수염'] = 'beard.npy'
    c['침대', '침실', '잠', '꿈'] = 'bed.npy'
    c['벌', '꿀벌', '말벌', '장수말벌', '일벌', '벌침'] = 'bee.npy'
    c['벨트', '허리띠'] = 'belt.npy'
    c['벤치', '공원'] = 'bench.npy'
    c['두발자전거', '세발자전거', '자전거', '전기자전거', '따릉이', '카카오바이크'] = 'bicycle.npy'
    c['망원경'] = 'binoculars.npy'
    c['생일', '생일케이크', '파티', '생일파티', '축하', '기념일'] = 'birthday cake.npy'
    c['블랙베리', '복분자', '산딸기'] = 'blackberry.npy'
    c['블루베리', '열매'] = 'blueberry.npy'
    c['책', '독서', '공부', '교과서', '전공책', '글'] = 'book.npy'
    c['부메랑'] = 'boomerang.npy'
    c['병뚜껑', '뚜껑'] = 'bottlecap.npy'
    c['나비넥타이', '보타이', '보우타이', '리본'] = 'bowtie.npy'
    c['팔찌', '머리끈'] = 'bracelet.npy'
    c['뇌', '좌뇌', '우뇌', '천재', '뇌세포'] = 'brain.npy'
    c['빵', '뚜레주르', '파리바게트'] = 'bread.npy'
    c['대교', '한강대교'] = 'bridge.npy'
    c['브로콜리'] = 'broccoli.npy'
    c['빗자루', '청소'] = 'broom.npy'
    c['양동이', '버킷', '아이스버킷챌린지'] = 'bucket.npy'
    c['불도저', '스윙스'] = 'bulldozer.npy'
    c['버스', '고속버스', '일반버스', '대중교통', '만원버스', '시내버스', '마을버스'] = 'bus.npy'
    c['부쉬', '풀숲', '풀더미', '부시'] = 'bush.npy'
    c['나비', '나방'] = 'butterfly.npy'
    c['선인장'] = 'cactus.npy'
    c['케이크'] = 'cake.npy'
    c['계산기', '공학용계산기', '전자계산기'] = 'calculator.npy'
    c['달력', '일정', '캘린더'] = 'calendar.npy'
    c['낙타', '사막', '중동'] = 'camel.npy'
    c['카메라', '디카', '사진기', '사진'] = 'camera.npy'
    c['카모플라주', '군복', '밀리터리', '군대', '국방'] = 'camouflage.npy'
    c['캠프파이어', '모닥불', '불놀이'] = 'campfire.npy'
    c['양초', '캔들', '촛불', '촛농'] = 'candle.npy'
    c['대포', '바주카포', '박격포', '캐논'] = 'cannon.npy'
    c['카누', '조정', '나룻배'] = 'canoe.npy'
    c['당근'] = 'carrot.npy'
    c['성', '궁전', '캐슬'] = 'castle.npy'
    c['고양이', '집사', '냥이', '길냥이', '캣타워'] = 'cat.npy'
    c['천장선풍기', '천장장식'] = 'ceiling fan.npy'
    c['휴대전화', '스마트폰', '휴대폰', '폰', '핸드폰'] = 'cell phone.npy'
    c['첼로', '현악기'] = 'cello.npy'
    c['식탁의자', '의자', '걸상'] = 'chair.npy'
    c['샹들리에'] = 'chandelier.npy'
    c['교회', '기독교', '성경'] = 'church.npy'
    c['원', '동그라미', '공', '펄'] = 'circle.npy'
    c['클라리넷'] = 'clarinet.npy'
    c['시계', '시간'] = 'clock.npy'
    c['구름', '파마머리', '파마', '펌'] = 'cloud.npy'
    c['커피잔', '커피', '아메리카노', '녹차'] = 'coffee cup.npy'
    c['나침반', '방향'] = 'compass.npy'
    c['컴퓨터', '컴공', '과제', '밤샘', '데스크탑'] = 'computer.npy'
    c['쿠키'] = 'cookie.npy'
    c['쿨러'] = 'cooler.npy'
    c['소파'] = 'couch.npy'
    c['소', '젖소', '소고기', '암소', '한우'] = 'cow.npy'
    c['크레파스', '크레용'] = 'crayon.npy'
    c['악어', '라코스테', '크로커다일'] = 'crocodile.npy'
    c['여객선', '크루즈'] = 'cruise ship.npy'
    c['컵', '물컵'] = 'cup.npy'
    c['다이아몬드', '보석'] = 'diamond.npy'
    c['설거지', '식기세척기'] = 'dishwasher.npy'
    c['다이빙', '다이빙대'] = 'diving board.npy'
    c['개', '강아지', '푸들', '애견', '반려동물'] = 'dog.npy'
    c['돌고래', '돌핀'] = 'dolphin.npy'
    c['도넛', '던컨도너츠', '던킨', '간식', '도넛방석'] = 'donut.npy'
    c['문', '방문', '입구', '출입구'] = 'door.npy'
    c['용', '괴물'] = 'dragon.npy'
    c['수납장', '서랍장', '서랍'] = 'dresser.npy'
    c['드릴', '전기드릴'] = 'drill.npy'
    c['드럼', '북', '북치기'] = 'drums.npy'
    c['오리', '북경오리'] = 'duck.npy'
    c['덤벨', '아령', '헬스', '헬창', '운동'] = 'dumbbell.npy'
    c['귀'] = 'ear.npy'
    c['팔꿈치', '엘보우'] = 'elbow.npy'
    c['코끼리'] = 'elephant.npy'
    c['편지봉투', '편지', '편지지', '메일', '메일함', '이메일'] = 'envelope.npy'
    c['지우개'] = 'eraser.npy'
    c['얼굴', '면상', '와꾸', '표정'] = 'face.npy'
    c['선풍기', '휴대용선풍기'] = 'fan.npy'
    c['새털', '깃털', '털', '구스다운'] = 'feather.npy'
    c['울타리', '휀스', '담장', '펜스'] = 'fence.npy'
    c['손가락'] = 'finger.npy'
    c['소화전'] = 'fire hydrant.npy'
    c['난로', '벽난로'] = 'fireplace.npy'
    c['소방차', '소방서', '소방대원'] = 'firetruck.npy'
    c['물고기', '생선', '회', '어류'] = 'fish.npy'
    c['플라밍고', '학', '두루미'] = 'flamingo.npy'
    c['후레쉬', '후레시', '손전등', '라이트'] = 'flashlight.npy'
    c['쪼리', '플립플랍', '샌들'] = 'flip flops.npy'
    c['조명'] = 'floor lamp.npy'
    c['꽃', '꽃다발', '꽃집'] = 'flower.npy'
    c['유에프오', '미확인비행물체', '외계인'] = 'flying saucer.npy'
    c['발', '발바닥', '발등', '발뒤꿈치'] = 'foot.npy'
    c['포크', '삼지창', '포카락'] = 'fork.npy'
    c['개구리', '황소개구리', '두꺼비'] = 'frog.npy'
    c['후라이팬'] = 'frying pan.npy'
    c['호스', '소방호스', '정원호스'] = 'garden hose.npy'
    c['정원', '꽃밭', '가든'] = 'garden.npy'
    c['기린', '멀대', '이광수', '광수'] = 'giraffe.npy'
    c['염소수염', '염소'] = 'goatee.npy'
    c['골프', '골프장', '라운드', '필드', '골퍼', '골프공'] = 'golf club.npy'
    c['포도', '청포도', '거봉', '샤인머스캣', '샤인머스켓'] = 'grapes.npy'
    c['풀', '잔디', '자연'] = 'grass.npy'
    c['기타', '우쿠렐레', '베이스'] = 'guitar.npy'
    c['햄버거', '버거', '맘스터치', '맥도날드', '롯데리아', '버거킹', '카우버거'] = 'hamburger.npy'
    c['망치', '망치질'] = 'hammer.npy'
    c['손', '손등', '손바닥'] = 'hand.npy'
    c['하프'] = 'harp.npy'
    c['모자'] = 'hat.npy'
    c['헤드폰', '헤드셋'] = 'headphones.npy'
    c['고슴도치', '도치'] = 'hedgehog.npy'
    c['헬리콥터', '헬기'] = 'heliconpyer.npy'
    c['헬멧', '방탄헬멧', '보호장비', '공사'] = 'helmet.npy'
    c['육각형', '육각너트', '깨박이'] = 'hexagon.npy'
    c['하키퍽'] = 'hockey puck.npy'
    c['하키채'] = 'hockey stick.npy'
    c['말', '망아지', '말고기', '승마'] = 'horse.npy'
    c['병원', '의사', '환자', '병동'] = 'hospital.npy'
    c['열기구', '기구'] = 'hot air balloon.npy'
    c['핫도그', '명량핫도그'] = 'hot dog.npy'
    c['온탕', '열탕', '목욕탕'] = 'hot tub.npy'
    c['초시계', '모래시계'] = 'hourglass.npy'
    c['식물', '화초'] = 'house plant.npy'
    c['집', '본가'] = 'house.npy'
    c['허리케인', '태풍', '혼돈'] = 'hurricane.npy'
    c['아이스크림', '베스킨라빈스'] = 'ice cream.npy'
    c['자켓', '재킷', '마이', '정장'] = 'jacket.npy'
    c['범죄자', '감옥', '감방', '범죄'] = 'jail.npy'
    c['캥거루', '호주'] = 'kangaroo.npy'
    c['열쇠', '집열쇠', '집키'] = 'key.npy'
    c['키보드', '샷건'] = 'keyboard.npy'
    c['무릎', '니킥'] = 'knee.npy'
    c['칼', '과도', '식칼', '칼질'] = 'knife.npy'
    c['사다리', '사다리게임', '사다리타기'] = 'ladder.npy'
    c['랜턴', '램프'] = 'lantern.npy'
    c['노트북', '맥북', '그램'] = 'lanpyop.npy'
    c['깻잎', '잎', '잎새', '잎사귀', '낙엽', '이파리', '나뭇잎'] = 'leaf.npy'
    c['다리', '두다리', '하반신', '하체', '하의'] = 'leg.npy'
    c['전구', '에디슨', '꼬마전구'] = 'light bulb.npy'
    c['라이터'] = 'lighter.npy'
    c['등대'] = 'lighthouse.npy'
    c['번개', '천둥', '천둥번개'] = 'lighting.npy'
    c['선', '직선', '일자'] = 'line.npy'
    c['사자', '동물의왕국', '동물원'] = 'lion.npy'
    c['립스틱', '립글로즈', '립밤'] = 'lipstick.npy'
    c['랍스터', '가재', '랍스터구이', '랍스타', '바닷가재'] = 'lobster.npy'
    c['화이트데이', '사탕', '롤리팝', '막대사탕'] = 'lollipop.npy'
    c['우편함', '우체국', '우체통'] = 'mailbox.npy'
    c['지도', '맵'] = 'map.npy'
    c['보드마카', '마카'] = 'marker.npy'
    c['성냥', '성냥개비', '성냥팔이소녀'] = 'matches.npy'
    c['확성기'] = 'megaphone.npy'
    c['인어', '인어공주'] = 'mermaid.npy'
    c['가수', '마이크', '노래방', '코노', '코인노래방', '노래'] = 'microphone.npy'
    c['전자레인지', '전자렌지'] = 'microwave.npy'
    c['원숭이'] = 'monkey.npy'
    c['달', '초승달', '그믐달', '보름달', '달밤'] = 'moon.npy'
    c['모기'] = 'mosquito.npy'
    c['오토바이', '레이싱'] = 'motorbike.npy'
    c['산', '등산', '산맥', '정상'] = 'mountain.npy'
    c['마우스', '무선마우스'] = 'mouse.npy'
    c['콧수염', '프링글스', '내시수염', '면도'] = 'moustache.npy'
    c['입', '입술'] = 'mouth.npy'
    c['머그', '머그컵', '머그잔'] = 'mug.npy'
    c['버섯', '독버섯', '초코송이'] = 'mushroom.npy'
    c['못', '못박기'] = 'nail.npy'
    c['목걸이', '쥬얼리'] = 'necklace.npy'
    c['코', '콧구멍', '콧대', '콧물', '콧볼', '냄새'] = 'nose.npy'
    c['바다', '노을', '바닷가'] = 'ocean.npy'
    c['팔각형', '팔각정'] = 'octagon.npy'
    c['문어', '쭈꾸미', '주꾸미', '낙지', '해물'] = 'octopus.npy'
    c['양파'] = 'onion.npy'
    c['오븐구이', '오븐'] = 'oven.npy'
    c['부엉이', '올빼미'] = 'owl.npy'
    c['페인트통', '페인트'] = 'paint can.npy'
    c['페인트붓', '페인트칠'] = 'paintbrush.npy'
    c['야자수', '제주도', '제주', '하와이', '야자나무', '야자'] = 'palm tree.npy'
    c['판다', '팬더', '판다곰', '팬더곰'] = 'panda.npy'
    c['바지', '아랫도리', '청바지', '슬랙스', '면바지'] = 'pants.npy'
    c['옷핀', '클립'] = 'paper clip.npy'
    c['낙하산', '배그', '낙하'] = 'parachute.npy'
    c['앵무새'] = 'parrot.npy'
    c['여권'] = 'passport.npy'
    c['땅콩', '땅콩버터'] = 'peanut.npy'
    c['배'] = 'pear.npy'
    c['강낭콩', '콩'] = 'peas.npy'
    c['연필', '필기구', '필기', '쓰기'] = 'pencil.npy'
    c['펭귄', '남극', '북극', '펭수', '핑구'] = 'penguin.npy'
    c['피아노', '그랜드피아노', '악기'] = 'piano.npy'
    c['픽업트럭'] = 'pickup truck.npy'
    c['액자', '사진액자'] = 'picture frame.npy'
    c['돼지', '꿀꿀이', '먹보', '먹방'] = 'pig.npy'
    c['베개', '베개싸움'] = 'pillow.npy'
    c['파인애플'] = 'pineapple.npy'
    c['피자', '도미노피자', '피자스쿨'] = 'pizza.npy'
    c['펜치', '뻰찌', '뻰치'] = 'pliers.npy'
    c['경찰차', '경찰'] = 'police car.npy'
    c['연못'] = 'pond.npy'
    c['풀장', '수영장'] = 'pool.npy'
    c['하드', '아이스바'] = 'popsicle.npy'
    c['엽서', '엽서사진'] = 'postcard.npy'
    c['감자', '감자전', '찐감자', '왕감자'] = 'potato.npy'
    c['콘센트'] = 'power outlet.npy'
    c['지갑', '장지갑'] = 'purse.npy'
    c['토끼', '산토끼'] = 'rabbit.npy'
    c['라쿤', '너구리'] = 'raccoon.npy'
    c['라디오'] = 'radio.npy'
    c['비', '우박'] = 'rain.npy'
    c['무지개다리', '무지개'] = 'rainbow.npy'
    c['농기구'] = 'rake.npy'
    c['리모컨', '에어컨리모컨'] = 'remote control.npy'
    c['코뿔소'] = 'rhinoceros.npy'
    c['따발총', '총'] = 'rifle.npy'
    c['강', '한강', '강물'] = 'river.npy'
    c['롤러코스터', '놀이기구', '놀이동산', '놀이공원'] = 'roller coaster.npy'
    c['롤러스케이트', '스케이트', '롤러장'] = 'rollerskates.npy'
    c['돛단배'] = 'sailboat.npy'
    c['샌드위치', '서브웨이'] = 'sandwich.npy'
    c['톱질', '톱', '전기톱'] = 'saw.npy'
    c['색소폰'] = 'saxophone.npy'
    c['학교버스', '통학버스'] = 'school bus.npy'
    c['가위', '부엌가위', '가위질'] = 'scissors.npy'
    c['전갈', '스콜피온'] = 'scorpion.npy'
    c['드라이버'] = 'screwdriver.npy'
    c['거북이', '자라'] = 'sea turtle.npy'
    c['시소', '놀이터'] = 'see saw.npy'
    c['상어', '샤크', '죠스'] = 'shark.npy'
    c['양', '양떼', '목장', '양떼목장'] = 'sheep.npy'
    c['신발', '구두', '운동화', '스니커즈'] = 'shoe.npy'
    c['반바지'] = 'shorts.npy'
    c['삽', '야전삽', '삽질'] = 'shovel.npy'
    c['싱크대', '세면대'] = 'sink.npy'
    c['스케이트보드', '보드', '롱보드'] = 'skateboard.npy'
    c['해골', '해골바가지', '유령', '공포'] = 'skull.npy'
    c['마천루', '롯데타워', '부르즈칼리파', '초고층', '초고층빌딩'] = 'skyscraper.npy'
    c['침낭'] = 'sleeping bag.npy'
    c['미소', '웃는표정', '스마일', '기분'] = 'smiley face.npy'
    c['달팽이', '느림보'] = 'snail.npy'
    c['뱀', '뱀장어', '보아뱀', '구렁이'] = 'snake.npy'
    c['스노클링', '스노클', '잠수'] = 'snorkel.npy'
    c['눈보라', '서리'] = 'snowflake.npy'
    c['눈사람', '겨울'] = 'snowman.npy'
    c['골', '축구공', '축구', '축구선수'] = 'soccer ball.npy'
    c['양말', '발목양말'] = 'sock.npy'
    c['보트', '고속보트', '수상스키'] = 'speedboat.npy'
    c['거미', '스파이더맨'] = 'spider.npy'
    c['스푼', '숟가락', '원딜', '수저'] = 'spoon.npy'
    c['스프레드시트', '표', '엑셀'] = 'spreadsheet.npy'
    c['네모', '화면', '사각형'] = 'square.npy'
    c['꼬불꼬불', '곡선'] = 'squiggle.npy'
    c['다람쥐', '청설모'] = 'squirrel.npy'
    c['비상계단', '계단'] = 'stairs.npy'
    c['별', '별모양', '스타'] = 'star.npy'
    c['스테이크', '고기'] = 'steak.npy'
    c['스테레오', '카세트'] = 'stereo.npy'
    c['진단', '청진기'] = 'stethoscope.npy'
    c['바느질'] = 'stitches.npy'
    c['정지선', '정지', '그만'] = 'stop sign.npy'
    c['가스렌지', '가스레인지', '인덕션'] = 'stove.npy'
    c['딸기', '스트로베리'] = 'strawberry.npy'
    c['가로등', '거리불빛', '가로등불빛'] = 'streetlight.npy'
    c['완두콩'] = 'string bean.npy'
    c['잠수함', '잠수정'] = 'submarine.npy'
    c['손가방', '서류가방'] = 'suitcase.npy'
    c['해', '낮', '태양', '여름'] = 'sun.npy'
    c['백조'] = 'swan.npy'
    c['스웨터', '맨투맨', '니트', '상의', '롱슬리브'] = 'sweater.npy'
    c['그네', '그네놀이', '그네타기'] = 'swing set.npy'
    c['검', '대검'] = 'sword.npy'
    c['주사기', '주사', '주사바늘', '간호사', '감기'] = 'syringe.npy'
    c['티셔츠', '티', '반팔티', '반팔', '반팔티셔츠'] = 't-shirt.npy'
    c['테이블', '책상', '식탁'] = 'table.npy'
    c['주전자'] = 'teapot.npy'
    c['테디베어', '곰인형', '인형'] = 'teddy-bear.npy'
    c['벨소리', '전화기', '집전화', '전화'] = 'telephone.npy'
    c['티비', '텔레비전', '예능', '드라마'] = 'television.npy'
    c['테니스라켓', '라켓', '테니스채'] = 'tennis racquet.npy'
    c['텐트', '캠핑'] = 'tent.npy'
    c['만리장성', '중국'] = 'The Great Wall of China.npy'
    c['모나리자'] = 'The Mona Lisa.npy'
    c['호랑이', '짐승'] = 'tiger.npy'
    c['토스트', '토스트기계', '토스터기'] = 'toaster.npy'
    c['발가락', '발톱'] = 'toe.npy'
    c['화장실', '변기'] = 'toilet.npy'
    c['이빨', '이', '어금니', '사랑니', '앞니', '임플란트', '교정', '치아'] = 'tooth.npy'
    c['칫솔', '양치', '양치질'] = 'toothbrush.npy'
    c['치약'] = 'toothpaste.npy'
    c['토네이도', '돌풍', '강풍'] = 'tornado.npy'
    c['트랙터'] = 'tractor.npy'
    c['신호등', '신호', '신호위반', '초록불'] = 'traffic light.npy'
    c['기차', '열차', '지하철'] = 'train.npy'
    c['나무'] = 'tree.npy'
    c['삼각형', '삼각김밥'] = 'triangle.npy'
    c['트럼본'] = 'trombone.npy'
    c['트럭', '화물차', '포터'] = 'truck.npy'
    c['트럼펫'] = 'trumpet.npy'
    c['우산', '양산'] = 'umbrella.npy'
    c['속옷', '팬티'] = 'underwear.npy'
    c['밴', '승합차'] = 'van.npy'
    c['화분', '꽃병'] = 'vase.npy'
    c['바이올린'] = 'violin.npy'
    c['빨래', '세탁', '세탁기', '드럼세탁기'] = 'washing machine.npy'
    c['수박'] = 'watermelon.npy'
    c['워터파크', '미끄럼틀', '슬라이드'] = 'waterslide.npy'
    c['고래', '고래밥'] = 'whale.npy'
    c['사과'] = 'apple.npy'
    c['비둘기', '새', '참새'] = 'bird.npy'
    c['자동차', '차', '자가용', '쏘카', '드라이브'] = 'car.npy'
    c['게', '꽃게', '대게', '간장게장', '양념게장'] = 'crab.npy'
    c['왕관', '왕'] = 'crown.npy'
    c['눈', '눈알', '눈동자', '동공', '렌즈'] = 'eye.npy'
    c['선글라스', '안경'] = 'eyeglasses.npy'
    c['에펠탑', '송전탑', '기지국'] = 'The Eiffel Tower.npy'
    c['바퀴', '수레바퀴'] = 'wheel.npy'
    c['풍차', '네덜란드'] = 'windmill.npy'
    c['와인병', '와인'] = 'wine bottle.npy'
    c['와인잔'] = 'wine glass.npy'
    c['손목시계'] = 'wristwatch.npy'
    c['요가', '스트레칭'] = 'yoga.npy'
    c['얼룩말'] = 'zebra.npy'
    c['지그재그'] = 'zigzag.npy'

    category = {
        '사과': 'apple.npy',
        '자전거': 'bicycle.npy',
        '새': 'bird.npy',
        '자동차': 'car.npy',
        '게': 'crab.npy',
        '왕관': 'crown.npy',
        '눈': 'eye.npy',
        '안경': 'eyeglasses.npy',
        '포크': 'fork.npy',
        '에펠탑': 'the eiffel tower.npy',
        '바퀴': 'wheel.npy',
        '풍차': 'windmill.npy',
        '와인병': 'wine bottle.npy',
        '와인잔': 'wine glass.npy',
        '손목시계': 'wristwatch.npy',
        '요가': 'yoga.npy',
        '얼룩말': 'zebra.npy'
    }

    # value = category.get(keyword_for_picture)
    value = c.get(keyword_for_picture)
    # value = "sliced_npydata/" + value

    if value is None:
        print('There is no category of ' + keyword_for_picture)
        return Response('no Value')
    else:

        import random
        value = "sliced_npydata/" + value
        nparry = np.load(value)
        length = len(nparry)
        random_image = nparry[random.randint(0, length - 1)].reshape((28, 28))
        resize_img = cv2.resize(random_image, (0, 0),
                                fx=81,
                                fy=81,
                                interpolation=cv2.INTER_LANCZOS4)
        resize_img = cv2.bitwise_not(resize_img)

        matplotlib.image.imsave('./static/random.png', resize_img, cmap='gray')
        src = cv2.imread("./static/random.png", cv2.IMREAD_COLOR)
        ret, resize_img = cv2.threshold(resize_img, 120, 255,
                                        cv2.THRESH_BINARY)
        resize_img = cv2.resize(resize_img, (0, 0),
                                fx=0.3,
                                fy=0.3,
                                interpolation=cv2.INTER_AREA)
        ret, resize_img = cv2.threshold(resize_img, 120, 255,
                                        cv2.THRESH_BINARY)
        resize_img = cv2.resize(resize_img, (0, 0),
                                fx=0.3,
                                fy=0.3,
                                interpolation=cv2.INTER_AREA)
        matplotlib.image.imsave('./static/random.png', resize_img, cmap='gray')

        resize_img = cv2.imread('./static/random.png', cv2.IMREAD_COLOR)
        for x in range(0, 204):
            for y in range(0, 204):
                if resize_img[x][y][0] == 255 & resize_img[x][y][
                        1] == 255 & resize_img[x][y][2] == 255:
                    resize_img[x][y] = [214, 215, 219]

        matplotlib.image.imsave('./static/random.png', resize_img, cmap='gray')
        return FileResponse(open('./static/random.png', 'rb'))
import sys
import os
import re

from multi_key_dict import multi_key_dict


__all__ = []


VERSION_REGEX = (
    "version: "
    "(?P<major>\d+)-(?P<minor>\d+)-(?P<state>.+)-(?P<revision>\d+)")
STATE = multi_key_dict({
    ('a', '0'): "Alpha",
    ('b', '1'): "Beta",
    ('rc', '2'): "Release Candidate",
    ('r', '3'): "Release",
    })
args = multi_key_dict({
    ("-V", "--version-file", 0): "VERSION",
    ("-s", "--summary", 1): "summary.",
    })
TEMPLATE = """V{version}, {summary}

CHANGES:
    - none

BUG FIXES:
    - none
"""
Пример #31
0
import wx
import analyse #soundanalyse
import Layout as ly  # Layout code generated by wxGlade
import gettext # for localisation shit required by wxGlade
import numpy,time ,math
import alsaaudio 
import threading 
from multi_key_dict import multi_key_dict #this lib allow to point multiple keys to a value which is not realized in standart dictionary lib

#note_dict is a dictionary of midi key values which point to a note
note_dict = multi_key_dict()
note_dict[0,12,24,36,48,60,72,84,96,108,120] = "C"
note_dict[1,13,25,37,49,61,73,85,97,109,121] = "C#"
note_dict[2,14,26,38,50,62,74,86,98,110,122] = "D"
note_dict[3,15,27,39,51,63,75,87,99,111,123] = "D#"
note_dict[4,16,28,40,52,64,76,88,100,112,124]= "E"
note_dict[5,17,29,41,53,65,77,89,101,113,125]= "F"
note_dict[6,18,30,42,54,66,78,90,102,114,126]= "F#"
note_dict[7,19,31,43,55,67,79,91,103,115,127]= "G"
note_dict[8,20,32,44,56,68,80,92,104,116] =    "G#"
note_dict[9,21,33,45,57,69,81,93,105,117] =    "A"
note_dict[10,22,34,46,58,70,82,94,106,118]=    "A#"
note_dict[11,23,35,47,59,71,83,95,107,119]=    "B"



def set_input_list():
    input_devices_list = get_input_devices()
    for i in input_devices_list :
        frame.input_list.Append(i)
        
Пример #32
0
part = world.add_emitter(angle=[360, 360],
                         life=[1, 3],
                         colors=[
                             COLORS["aliceblue"], COLORS["cadetblue1"],
                             COLORS["darkslategray2"], COLORS["lightblue2"]
                         ])
#  add_body("d", (21, 45), (2, 1)),
#  add_body("d", (23, 45), (2, 1)),
#  add_body("d", (28, 45), (2, 1)),
player.set_phis(phis.player_body[0][0], phis.meter)
player.def_box2d_pos(world.height)
player_id = world.add_rect(player.get_rect(), COLORS["red"])
# phis.add_body("s", (0, 0), (50, 1), world.boxes)
# id2 = world.add_box()

KEY = multi_key_dict()
KEY[K_RIGHT, K_d] = (4, 0)
KEY[K_LEFT, K_a] = (-4, 0)
KEY[K_DOWN, K_s] = (0, 4)

menu(
    **{
        "img_DIR": IMG_DIR + "menu/",
        "fdir": FONTS_DIR,
        "theme_index": THEME,
        "save": save,
        "save_main": save_main
    })

clock = pygame.time.Clock()