hartmut Posted December 11, 2011 Posted December 11, 2011 Hello I have a situation that I would like to make a calculation to pick a random word in a sentence of varying length change it to a "_______" and paste in the field "missing word" . I don't know if this is possible because of the length of the sentence being variable . Also since this will be used for an english drill I would be looking for words longer than 4 letters. This may be too difficult. But thanks for answers Ps If the word didn't look like the best choice to restore to original sentence and try again. More Thanks
LaRetta Posted December 11, 2011 Posted December 11, 2011 Hello journeyman, It sounds like you want the Substitute() function. Assume your text is in a field called Text and you use a global text field called gString where you type in the phrase or words you wish to find in the text. Then calculation (result is text) would be: Substitute ( Text ; gString ; "missing word" ) I didn't get the underline part. Maybe an example will help us pin down a calculation for you. :-)
hartmut Posted December 13, 2011 Author Posted December 13, 2011 Thank you so much. That is exactly what I am looking for. But I would like to have the "_______" to show up without the last letter. I can't figure it out . _______ instead of ______s etc. Thanks so much Is it possible the calculation could overlook certain words if I could put in a list? Like "the" "be" "Matthew" etc?
LaRetta Posted December 13, 2011 Posted December 13, 2011 Comment's file works perfectly for me. Can you post the calculation you are using?
hartmut Posted December 13, 2011 Author Posted December 13, 2011 I am using the calc that comment posted because it works so well with the exceptions I just mentioned. Thanks I hope comment will amend the calc so I can get rid of the last letter on the "________" (blank)
comment Posted December 13, 2011 Posted December 13, 2011 Please post an example of a sentence and word number that produce the problem.
hartmut Posted December 13, 2011 Author Posted December 13, 2011 I am so sorry - My sentences had quotations around them and that caused the problem. I still wish there was a way to use your file but not use certain words that i could make a list of that would become random.
Raybaudi Posted December 13, 2011 Posted December 13, 2011 try to add: and IsEmpty ( FilterValues ( ValueListItems ( Get ( FileName ) ; "YourValueList" ) ; MiddleWords ( Sentences::Sentence ; $n ; 1 ) ) ) to the calculation for the Exit Loop If [ ] script step. P.S.: YourValueList is the name of the value list of the exceptions.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now