Jump to content
UBot Underground

Remove length sentence


Recommended Posts

hello guys i need your help.

 

i have list there are :

 

best skin care

best skin care products

best skin care products for men

best skin care products for women

 

and then i will remove sentence less than 1, 2, 3, or 4. the example is if i will remove sentence less than 4 sentence. so it will be :

 

best skin care products for men

best skin care products for women

 

what is the command to do it ?

 

thanks for your help

Link to post
Share on other sites

You could add each line to a list individually.  Use a space as the list seperator.  Then do a comparison if the list total is less than 4, clear the list and loop to the next.  If it is over 4 add them to a success list.

 

There's probably an easier way to do this, but it's what I can think of off the top of my head.

 

May try and post up some example code when I get back to my computer.

Link to post
Share on other sites

You would approach that exactly as a2mateit said, I think that the easiest way...

 

There is no UBot command/function that would do that for you out of the box.

Link to post
Share on other sites

I would consider doing the reverse of what a2mateit said and just add the words to a list

This may stop it failing when other characters are included in the text

clear list(%input)
clear list(%output)
add list to list(%input, $list from text("best skin care
best skin care products
best skin care products for men
best skin care products for women", $new line), "Delete", "Global")
loop while($comparison($list total(%input), ">", 0)) {
    set(#currentitem, $trim($list item(%input, 0)), "Global")
    add list to list(%check, $find regular expression(#currentitem, "\\b\\w+\\b"), "Don\'t Delete", "Global")
    if($comparison($list total(%check), ">=", 5)) {
        then {
            add item to list(%output, #currentitem, "Delete", "Global")
        }
        else {
        }
    }
    remove from list(%input, 0)
    clear list(%check)
}
set(#currentitem, $nothing, "Global")
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...