How do you choose a sentence that only contains a few words?

Hii, I need help. Is it possible to make a blocks to take sentences from a few words? Like pictures on below?

Split the set of sentences to a list
Use the:

image

or

image

to find the sentences in your list that match the "contains"

Output the selected sentences to a label

You want to list the shortest sentences?

By character count,or by word count?

Are you attempting to make a Text Adventure game like the classic Zork?
If so, there is some code in Runtime Error, Yet My Teacher Can't Figure It Out, Either. Help! that might be useful and what you hope to do.

by character count

  • replace all . with .\n
  • replace all? with ?\n
  • Split at \n to get a list of sentences
  • Use the advanced list blocks to...
  • Create a table of sentence, length of sentence
  • Sort the table by column 2
  • Extract column 1

Never heard that game but thanks for the suggestion!

@ABG Sorry I don't understand:(

Sorry, I followed your thread title, which asked for something different than your example.

Follow @TIMAI2 's advice.

Ah I see, I guess that's because my English bad :sweat_smile:. Thank you tho.

Can you please explain more...

Explain what?

If I input some song like:
Three blind mice, three blind mice
See how they run, see how they run
They all ran after the farmer's wife
She cut off their tails with a carving knife
Did you ever see such a sight in your life as three blind mice?

Then I input a pieces of word/letter from the song: ife

From this song that contains ife is just 3 sentences
Three blind mice, three blind mice
See how they run, see how they run
They all ran after the farmer's wife
She cut off their tails with a carving knife
Did you ever see such a sight in your life as three blind mice?

Then the output will only show:
They all ran after the farmer's wife
She cut off their tails with a carving knife
Did you ever see such a sight in your life as three blind mice?

(is that explaining :sweat_smile:?)

image


search.aia (2.0 KB)

1 Like

Another way

that preserves the punctuation. :slight_smile:

1 Like

@ABG @SteveJG OMG. Thank you guys!! :star: