How to identify a word from the paragraph

I want to make an app in which I will provide few words to the user and user has to make paragraph by using those words. Once he completes his paragraph, I have to check whether he used the given words in the paragraph or not. However, I am unable to understand which code to use for the same. I tried to code with mentioned below blocks but failed the get the expected result. Kindly help me for the same.

1 Like

screen
Just an example to guide you

3 Likes

Welcome to Thunkable.

The approach you have taken is correct but the blocks you have chosen are not. When you loop through a paragraph ( a stream of text) you are actually taking the paragraph character by character.

To convert the paragraph word by word you will need to use the list block
image
With this block you will make a list of all the words in the paragraph. You need to change the last (pink) option from a comma to a space.

Now, you can use the blocks that @mimostel demonstrated to get the words of the paragraph one at a time and compare them by your key words.
image

Happy Thunking!

3 Likes

By taking reference of both the replies I tried the following code but it is still not working.

1 Like

Thanks for the help. However when I run it, even though I use all the words, it still says not all words used.

1 Like

The logic is the other way round. Just swap the messages and it should work ok.

However, this method will only tell you if the word is used or not. It will not give you the count and it will not give you how many of your key words are used.

1 Like

Ok thanks for the advice. In order to know about number of words used, shall I use for loop (1 to length of para_list)?

That was the only request :blush:

Now:

1 Like

I clubbed both the advices and come up with the following code:-

However, it is showing score 1 only. What should I do?

It works when I preview your project. But the words will only match if the case matches. So you need to check to see if the words are lowercase, Sentence Case, or UPPERCASE.

1 Like

It worked. Thanks for all the help i got from here. It is finally giving me the exact expected result. :smiley: :smiley: :smiley:

2 Likes

You’re welcome. I was going to suggest using the to lower case block but it sounds like you figured it out.

2 Likes

Thanks for that. It was thoughtful. :slight_smile:

2 Likes

I don’t see any difference between do and else… no point to do that if you just want to congratulate for using x words… just set and show alert message without any IF… IF is useful only if you want to give points for a condition. (for example if all words are used).
And my bad… forgot about sensitive case… thank you @tatiang :hugs:

3 Likes

don’t you want to include punctuation marks (like ?,.;:’"!) in your delimiters? so you can parse out the words correctly from a sentence like (you mean, he didn’t say “Fire!”?).
if you use only space as delimiter you would get unexpected “words”!

1 Like

This was just for testing so that’s why if else have similar code. I changed it later on as per my requirement. Thanks for your code it made my work very easy. :slight_smile:

I replaced all the punctuations with space in my paragraph and then converted it into list. Since this was specimen therefore not all code is mentioned here. Thanks for your consideration. :slight_smile: :slight_smile: