Jump to content

remove bad words from txt file word list


face
 Share

Recommended Posts

Load the file, find each bad words which you have loaded to an array and replace it with whatever you want.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Maybe...

Global $text1 = "C:\list.doc" ; your list location here
Global $text2 = "C:\spellcheck.doc" ; your spell check location here
 
$list = FileRead($text1)
$list = StringSplit($list, ",") ; for comma delimited text file
For $x = 1 To $list[0] - 1
 If StringInStr($list[$x], $text2) Then
  MsgBox(0, "Found", $list[$x])
  ; do something else here?
 EndIf
Next

 

NOT TESTED

8)

NEWHeader1.png

Link to comment
Share on other sites

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

Link to comment
Share on other sites

; 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

Link to comment
Share on other sites

What you really ought to be doing is looking into using a database.

200,000 lines is probably not what .txt files were designed for.

The comment about speed from Blue_Drache is an understatement to say the least.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...