# RepeatAfterMe Process Flow

## Identify What to Repeat?

Once Aryan Triggers the **RepeatAfterMe** flow, then it asks his Human Friend on What to Repeat?

The raw response without any transformation is captured for repeating., Now next step is to identify on how many times to repeat. For this **countofRepeat** flow is executed.

```python
PrintText(aifriend,"Okay, What to Repeat?")
SpeakText(aifriend,"Okay, What to Repeat?")

repeatspeech = RawSpeechRecognization(aifriend)
countofRepeat(repeatspeech,aifriend)
```

## Identify How Many Times to Repeat?

Aryan requests Human to provide the count on how many times do the identified phrase needs to be repeated.

Let's say Human says "5 times" or "5" or "56 number of times", Aryan captures the raw speech and thereafter captures the first string (Currently code works this way, we can optimize it further)

Now Next step is to identify if the first string "x" captured was a numeric number or not,&#x20;

* If string x captured is numeric then code proceed further and a while loop numbers for the x number of times
* If not Aryan call the function to request human again to provide the number of times the word needs to be repeated and then the same flow to identify the number of times is performed.

```python
PrintText(aifriend,"How many times you want me to repeat?")
SpeakText(aifriend, "How many times you want me to repeat?")


'''Logic to get just the first word from user input, say user says 5 times, then we just take 5 as output'''

CountofRepeat = RawSpeechRecognization(aifriend).split()[0]


'''Conditional logic to check if the user input is numeric then only we proceed with repeat speech, 
else we request again to user to provide us the count'''

i = 1

if CountofRepeat.isnumeric():
    while int(CountofRepeat)>=i:

        PrintText(aifriend,repeatspeech)
        SpeakText(aifriend,repeatspeech)

        i = i + 1

    NextStep(aifriend)

else:
    callCountAgain(repeatspeech,aifriend)
```

Thereafter, Control is passed to **NextStep** for further actions.
