AutoHotkey Community

It is currently May 27th, 2012, 12:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: October 14th, 2008, 5:04 am 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Just something I'm working on...

Code:
; Function :: ConsecutiveSpam
;
; Params   ::
;             String :: String to check for spam
;             Level  :: Level of spam. Level := Occurances/3
ConsecutiveSpam(String, Level = 5) {
   Loop, Parse, String
      pAsc := Asc(A_LoopField),x := (pAsc = hAsc-1 || pAsc = hAsc+1) ? x+1 : 0,hAsc := pAsc
   Return x/3 >= Level ? 1 : 0
}

; Function :: RepeatingSpam
;
; Params   ::
;             String :: String to check for spam
;             Level  :: Level of spam. Level := Occurances/3
RepeatingSpam(String, Level = 5) {
   Loop, Parse, String
      pChar := A_LoopField,x := (pChar = hChar) ? x+1 : 0,hChar := pChar
   Return x/3 >= Level ? 1 : 0
}

MsgBox % (ConsecutiveSpam("abcdefghijklmnopqrstuvwxyz") ? "Possible consecutive spam" : "Not spam") . "`n"
       . (ConsecutiveSpam("This string is not spam and therefore will not be picked up as spam.") ? "Possible random spam" : "Not spam") . "`n"
       . "`n"
       . (RepeatingSpam("aaaaaaaAaaaaaAaaaAaaaaaaa") ? "Possible repeating spam" : "Not spam") . "`n"
       . (RepeatingSpam("This string is not spam and therefore will not be picked up as spam.") ? "Possible repeating spam" : "Not spam")

_________________
Religion is false. >_>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 14th, 2008, 9:46 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Real spam detection algorithms are complex and have adaptive filters based on previous scans. This is a good start though.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group