Jump to content

Recommended Posts

Posted

i have a list of bad words in .txt format and a list of spell check words in .txt format also

 

how can i remove through the bad words list .txt file words from a 200k spell check .txt file

Posted (edited)

its 2 text files with 1 column each one of them has 200k+ rows the other around 400+ (bad words)

any ideas?

Edited by face
Posted (edited)

200 ... thousand?  Oy ... ok, look up

FileOpen()

FileReadLine()

While/WEnd

and

For/Next

Edit:

Also, I'd write the results to a new file with FileWriteLine()

Sure ... it's not going to win any awards for speed, but it'll brute-force the job.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Posted

; 2013-10-10_161603
; blanket sanitizer

Local $str, $sFile = @ScriptDir & '\test.txt'
If FileExists($sFile) Then
    $str = FileRead($sFile)
    $str = StringRegExpReplace($str, '(?is)( word1 )|( word2 )|( word3 )', ' ### ')
    FileWrite(@ScriptDir & '\test_result.txt', $str)
EndIf

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Posted (edited)

Use ripdad's regexp.  If there are not leading and trailing spaces separating the words, then use word boundaries wrapping the 'curse' words instead.  Lookup stringregexp in the helpfile.  He already provided the example.

You can loop through the curse words list, and combine them in the format that ripdad provided, to dynamically create the regexp.  I've already shown you similar string concats, and loops before.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...