Discuss Scratch

LeDerpy123
Scratcher
1000+ posts

How to analyze text?

How do I make it so that when I answer a question with the answer block it checks to make sure every word in the answer is in list X?
I tried and now I have a headache

My specs: Windows 8.1.2 - 3 GB RAM - Intel Core2 Quad - IE11
Wes64
Scratcher
500+ posts

How to analyze text?

you need a way to isolate every word in the sentence so you can check them to the list, right?

set [counter] to (1)
repeat until <(counter) > (length of (answer))>
set [word] to [] <-- there is no character inside the string input
repeat until <(letter (counter) of (answer)) = [ ]> <-- repeat until the letter equals space
set [word] to (join (word) (letter (counter) of (answer)))
change [counter] by (1)
end repeat
change [counter] by (1)
***at this point the (word) variable will be the word you can use***
end repeat

Using Firefox 46.0.1, Flash plugin version 21.0.0.242, and Windows 7 Professional.
A computer does what you tell it to do, not what you want it to do. - Murphy's Law
turkey3
Scratcher
1000+ posts

How to analyze text?

Click out the Scratch a wiki article Separating a String Into Words. After words are separated into a list, you have to check if the list if words contains each word.

drmcw
Scratcher
1000+ posts

How to analyze text?

Check the Eliza link in my signature, that does a lot of text processing which includes splitting sentences into words, checking for tokens etc.

@turkey3 I think that wiki article has an error the “replace item last of words” should be “replace item 1 of words”.

Last edited by drmcw (July 21, 2013 06:59:20)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
LeDerpy123
Scratcher
1000+ posts

How to analyze text?

Thanks everybody!!!

My specs: Windows 8.1.2 - 3 GB RAM - Intel Core2 Quad - IE11

Powered by DjangoBB

Standard | Mobile