beweinreich commited on
Commit
b0e080a
1 Parent(s): df3751f

fix name of heterogeneous

Browse files
Files changed (1) hide show
  1. algo.py +9 -9
algo.py CHANGED
@@ -114,7 +114,7 @@ class Algo:
114
 
115
  # look up the dictionary values for each mapping
116
  # find the wweia category
117
- # if all mappings have the same wweia category, return "homogenous", else "heterogenous"
118
  # if is_food is False for any mappings, return "Non-Food Item" as dictionary word
119
  for mapping in mappings:
120
  if mapping['is_food'] == False:
@@ -146,24 +146,24 @@ class Algo:
146
  'food_nonfood_score': None
147
  }
148
 
149
- # check if "Heterogenous" is in the wweia category of any of the mappings
150
  # otherwise we find the mapping with the lowest DMC value, and return that as the dictionary word, dmc, wc, and leakage values
151
- heterogenous_exists = False
152
  most_conservative_mapping = None
153
  for mapping in mappings:
154
- if mapping['wweia_category'] == "Heterogenous":
155
- heterogenous_exists = True
156
  break
157
  else:
158
  if most_conservative_mapping is None or mapping['dry_matter_content'] < most_conservative_mapping['dry_matter_content']:
159
  most_conservative_mapping = mapping
160
 
161
  mixture_data = {}
162
- if heterogenous_exists:
163
  mixture_data = {
164
- 'matching_word': 'Heterogenous Mixture',
165
- 'dictionary_word': 'Heterogenous Mixture',
166
- 'wweia_category': 'Heterogenous Mixture',
167
  'dry_matter_content': 0.27,
168
  'water_content': 0.73,
169
  'leakage': 0.1
 
114
 
115
  # look up the dictionary values for each mapping
116
  # find the wweia category
117
+ # if all mappings have the same wweia category, return "homogenous", else "heterogeneous"
118
  # if is_food is False for any mappings, return "Non-Food Item" as dictionary word
119
  for mapping in mappings:
120
  if mapping['is_food'] == False:
 
146
  'food_nonfood_score': None
147
  }
148
 
149
+ # check if "heterogeneous" is in the wweia category of any of the mappings
150
  # otherwise we find the mapping with the lowest DMC value, and return that as the dictionary word, dmc, wc, and leakage values
151
+ heterogeneous_exists = False
152
  most_conservative_mapping = None
153
  for mapping in mappings:
154
+ if mapping['wweia_category'] == "Heterogeneous Mixture":
155
+ heterogeneous_exists = True
156
  break
157
  else:
158
  if most_conservative_mapping is None or mapping['dry_matter_content'] < most_conservative_mapping['dry_matter_content']:
159
  most_conservative_mapping = mapping
160
 
161
  mixture_data = {}
162
+ if heterogeneous_exists:
163
  mixture_data = {
164
+ 'matching_word': 'Heterogeneous Mixture',
165
+ 'dictionary_word': 'Heterogeneous Mixture',
166
+ 'wweia_category': 'Heterogeneous Mixture',
167
  'dry_matter_content': 0.27,
168
  'water_content': 0.73,
169
  'leakage': 0.1