|
|
@ -105,7 +105,6 @@ export default function RecipeElement(props: RecipeElementProps) {
|
|
|
|
return categories[0];
|
|
|
|
return categories[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log("LA LISTE DES CATEGORY : " + categories)
|
|
|
|
|
|
|
|
let bestMatch = { category: '', similarity: 0 };
|
|
|
|
let bestMatch = { category: '', similarity: 0 };
|
|
|
|
|
|
|
|
|
|
|
|
for (const [name, categoriesList] of Object.entries(categoryMappings)) {
|
|
|
|
for (const [name, categoriesList] of Object.entries(categoryMappings)) {
|
|
|
@ -122,20 +121,15 @@ export default function RecipeElement(props: RecipeElementProps) {
|
|
|
|
|
|
|
|
|
|
|
|
function getImageForRecipe(recipeName: string) {
|
|
|
|
function getImageForRecipe(recipeName: string) {
|
|
|
|
const categories = [];
|
|
|
|
const categories = [];
|
|
|
|
console.log("NAAAAAME : " + recipeName)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const [category, words] of Object.entries(imagesDictionary)) {
|
|
|
|
for (const [category, words] of Object.entries(imagesDictionary)) {
|
|
|
|
const matchedWords = words.filter((word) => recipeName.toLowerCase().includes(word));
|
|
|
|
const matchedWords = words.filter((word) => recipeName.toLowerCase().includes(word));
|
|
|
|
console.log("Matched Word : " + matchedWords)
|
|
|
|
|
|
|
|
if (matchedWords.length > 0) {
|
|
|
|
if (matchedWords.length > 0) {
|
|
|
|
categories.push(category);
|
|
|
|
categories.push(category);
|
|
|
|
console.log(category)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log("ON ENTRE DANS LA 2EME FONCTION");
|
|
|
|
|
|
|
|
const categoryName = getCategoryFromList(categories);
|
|
|
|
const categoryName = getCategoryFromList(categories);
|
|
|
|
console.log("CategoryName à la fin : " + categoryName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (categoryName) {
|
|
|
|
switch (categoryName) {
|
|
|
|
case 'meat':
|
|
|
|
case 'meat':
|
|
|
|