You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assets/recipes_generation.ru.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,7 +319,7 @@ _<small>➔ вывод:</small>_
319
319
> instructions: Toss ingredients lightly and spoon into a buttered baking dish. Top with additional crushed cracker crumbs, and brush with melted butter. Bake in a preheated at 350 degrees oven for 25 to 30 minutes or until delicately browned.
320
320
> ```
321
321
322
-
Let's count the total number of examples after we merged the files:
322
+
Давайте посчитаем общее количество рецептов после слияния файлов с данными:
323
323
324
324
```python
325
325
print('Total number of raw examples: ', len(dataset_raw))
@@ -331,13 +331,11 @@ _<small>➔ вывод:</small>_
331
331
> Total number of raw examples: 125164
332
332
> ```
333
333
334
-
## Preprocessing the dataset
334
+
## Предварительная обработка набора данных
335
335
336
-
### Filtering out incomplete examples
336
+
### Отфильтровываем неполные рецепты
337
337
338
-
It is possible that some recipes don't have some required fields (_name_, _ingredients_ or _instructions_). We need to clean our dataset from those incomplete examples.
339
-
340
-
The following function will help us filter out recipes which don't have either title or ingredients or instructions:
338
+
Возможно, что некоторые рецепты не имеют обязательных полей (_name_, _ingredients_ или _instructions_). Нам необходимо очистить наш набор данных от этих неполных рецептов. Следующая функция поможет нам это сделать:
Let's do the filtering now using `recipe_validate_required_fields()`function:
357
+
Теперь воспользуемся функцией `recipe_validate_required_fields()`для фильтрации неполных рецептов:
360
358
361
359
```python
362
360
dataset_validated = [recipe for recipe in dataset_raw if recipe_validate_required_fields(recipe)]
@@ -374,13 +372,13 @@ _<small>➔ вывод:</small>_
374
372
> Number of incomplete recipes 2226
375
373
> ```
376
374
377
-
As you may see among `125164` recipes we had `2226` somehow incomplete.
375
+
Как вы можете увидеть, из `125164` рецептов `2226` были неполными.
378
376
379
-
### Converting recipes objects into strings
377
+
### Конвертирование рецептов из объектов в строки
380
378
381
-
RNN doesn't understand objects. Therefore, we need to convert recipes objects to string and then to numbers (indices). Let's start with converting recipes objects to strings.
379
+
RNN не умеет работать с объектами, она понимает только числа. Поэтому нам нужно сначала преобразовывать наши рецепты из объектов в строки, а затем в числа (индексы). Начнем с преобразования рецептов в строки.
382
380
383
-
To help our RNN learn the structure of the text faster let's add 3 "landmarks" to it. We will use these unique "title", "ingredients" and "instruction" landmarks to separate the logic sections of each recipe.
381
+
Чтобы RNN было легче распознать секции (имя, ингредиенты и шаги приготовления) в тексте рецептов, мы можем расставить уникальные "маячки" или "ориентиры", которые будут разделять эти секции.
dataset_stringified = [recipe_to_string(recipe) for recipe in dataset_validated]
@@ -428,7 +428,7 @@ _<small>➔ вывод:</small>_
428
428
> Stringified dataset size: 122938
429
429
> ```
430
430
431
-
Let's preview first several recipes:
431
+
Давайте выведем первые несколько рецептов:
432
432
433
433
```python
434
434
for recipe_index, recipe_string in enumerate(dataset_stringified[:3]):
@@ -502,7 +502,7 @@ _<small>➔ вывод:</small>_
502
502
> ▪︎ Bake in preheated oven for 1 hour or until juices are clear.
503
503
> ```
504
504
505
-
Just out of curiosity let's preview the recipe somewhere from the middle of the dataset to see that it has expected data structure:
505
+
Исключительно из любопытства давайте просмотрим на рецепт где-то из середины набора данных, чтобы увидеть, что он имеет ожидаемую структуру:
506
506
507
507
```python
508
508
print(dataset_stringified[50000])
@@ -542,7 +542,7 @@ _<small>➔ вывод:</small>_
542
542
> ▪︎ Add white beans and stock and simmer, covered, stirring occasionally, 10 minutes. Add haricots verts and edamame and simmer, uncovered, until heated through, 2 to 3 minutes. Add butter, parsley, and chervil (if using) and stir gently until butter is melted. Discard bay leaf and rosemary sprigs.
543
543
> ```
544
544
545
-
### Filtering out large recipes
545
+
### Отфильтровываем большие рецепты
546
546
547
547
Recipes have different lengths. We need to have one _hard-coded sequence length_ limit before feeding recipe sequences to RNN. We need to find out what recipe length will cover most of the recipe use-cases and at the same time we want to keep it as small as possible to speed up the training process.
0 commit comments