I nte rna t io na l J o urna l o f   E lect rica l a nd   Co m pu t er   E ng ineering   ( I J E CE )   Vo l.   15 ,   No .   3 ,  J u n e   20 25 ,   p p .   3396 ~ 3 4 0 9   I SS N:  2088 - 8 7 0 8 ,   DOI :  1 0 . 1 1 5 9 1 /ijece. v 15 i 3 . pp 3 3 9 6 - 3 4 0 9           3396       J o ur na l ho m ep a g e :  h ttp : //ij ec e. ia esco r e. co m   Artif i cia l int e llig ence f o r au tom a tic  mo dera tion o f  te x tual  co ntent  in  o nline   cha ts and so cia l n etworks       So lo m iia   L ia s k o v s k a 1 ,   Rex   B a ca rr a 2 ,   Yev hen M a rt y n 3 ,   V o lo dy m y r   B a idy ch 4 ,    J a m il Abeda lra him   J a m il Al s a y a y deh 5   1 D e p a r t me n t   o f   A r t i f i c i a l   I n t e l l i g e n c e ,   Lv i v   P o l y t e c h n i c   N a t i o n a l   U n i v e r si t y ,   L v i v ,   U k r a i n e   2 D e p a r t me n t   o f   G e n e r a l   E d u c a t i o n   a n d   F o u n d a t i o n ,   R a b d a n   A c a d e m y ,   A b u   D h a b i ,   U n i t e d   A r a b   Em i r a t e s   3 D e p a r t me n t   o f   I n f o r mat i o n   Te c h n o l o g i e s a n d   E l e c t r o n i c   C o mm u n i c a t i o n s  S y st e ms,  Lv i v   S t a t e   U n i v e r si t y   o f   Li f e   S a f e t y   L v i v ,   U k r a i n e   4 D e p a r t me n t   I n f o r ma t i o n   Te c h n o l o g i e s Kh me l n y t sk y i   N a t i o n a l   U n i v e r si t y ,   K h me l n y t s k ,   U k r a i n e   5 D e p a r t me n t   o f   E n g i n e e r i n g   T e c h n o l o g y ,   F a k u l t i   Te k n o l o g i   D a n   K e j u r u t e r a a n   El e k t r o n i k   D a n   K o m p u t e r ,   U n i v e r s i t i   Te k n i k a l   M a l a y si a  M e l a k a ,   M e l a k a ,   M a l a y s i a       Art icle  I nfo     AB S T RAC T   A r ticle  his to r y:   R ec eiv ed   Ma r   1 1 ,   2 0 2 4   R ev is ed   Feb   1 7 ,   2 0 2 5   Acc ep ted   Ma r   5 ,   2 0 2 5       Th e   a rti c le  e x p lo re s  fu n d a m e n tal  tec h n iq u e s  fo r  c o n v e rti n g   tex t  in t o   n u m e rica l  d a ta  fo r  m a c h in e   lea rn in g   a lg o rit h m s.  It  m e ti c u l o u sl y   e x a m in e s  v a rio u s   m e th o d s,   in c l u d i n g   wo r d   v e c to r   re p re se n tati o n   v ia   n e u ra l   n e two r k s   li k e   Wo r d 2 Ve c ,   a n d   e x p lain s  t h e   p rin c ip les   b e h in d   li n e a r  m o d e l s  su c h   a s  lo g isti c   re g re ss io n   a n d   s u p p o rt   v e c to r  m a c h in e s.  C o n v o lu ti o n a l  n e u ra l   n e two rk s  (CNN )  a n d   l o n g   sh o rt - term   m e m o ry   (LS TM )  m e th o d s   a re   a lso   d isc u ss e d ,   c o v e rin g   th e ir   c o m p o n e n ts,   m e c h a n ism s,  a n d   train in g   p ro c e ss e s.  Th e   re se a rc h   e x ten d s  to   d e v e l o p i n g   a n d   tes ti n g   so ftwa re   f o r  s p a m   d e tec ti o n ,   h a te  sp e e c h   id e n t ifi c a ti o n ,   a n d   r e c o g n izin g   o ffe n siv e   la n g u a g e .   Us in g   tw o   d a tas e ts — o n e   fo r  lab e led   tex t  m e ss a g e s  a n d   a n o th e r  fo r  Twit ter  p o sts — th e   stu d y   a n a l y z e s  d a ta  to   a d d re ss   c h a ll e n g e s  li k e   imb a lan c e d   d a ta.  A  c o m p a ra ti v e   a n a l y sis  a m o n g   li n e a r  m o d e ls,   d e e p   n e u ra l  n e two rk s,   a n d   sin g le - lay e r  m o d e ls,   u si n g   p re - tr a in e d   b id irec ti o n a l   e n c o d e r   re p re se n tatio n s   fro m   tran sfo rm e rs  (BERT )   n e two rk ,   re v e a ls  p r o m isin g   re su lt s.  Th e   c o n v o lu ti o n a l  n e u ra l  n e two rk   sta n d s  o u t  wit h   a   re m a rk a b le  a c c u ra c y   o f   0 . 9 5 .   Th e   stu d y   a lso   a d a p ts   n e u ra l  n e two rk   a rc h i tec tu re s  fo r   h a te  s p e e c h   a n d   o ffe n siv e   la n g u a g e   c las sifica ti o n .   K ey w o r d s :   Ar tific ial  in tellig en ce   L an g u ag e   class if icatio n   Ma ch in e  lear n in g   alg o r ith m s   Neu r al  n etwo r k s   Sp am   d etec tio n   T h is i s  a n   o p e n   a c c e ss   a rticle   u n d e r th e   CC B Y - SA   li c e n se .     C o r r e s p o nd ing   A uth o r :   J am il Ab ed alr ah im   J am il Alsay ay d eh   Dep ar tm en t o f   E n g in ee r in g   T e ch n o lo g y ,   Fak u lti T e k n o lo g i  d an   Keju r u ter aa n   E lek tr o n ik   d a n   Ko m p u te r   ( FTKE K) ,   Un iv er s iti T ek n ik al   Ma lay s ia  Me lak a    7 6 1 0 0   Me lak a,   Ma lay s ia   E m ail: ja m il@ u tem . ed u . m y       1.   I NT RO D UCT I O N   Du e  to   th e  v ast  v o lu m e   o f   c o n ten t  cr ea ted   an d   d is tr ib u ted   o n   th e  I n ter n et,   it  h as  b ec o m e  in cr ea s in g ly   ch allen g in g   f o r   m o d er ato r s   to   p r o m p tl y   d etec t  an d   r em o v e  h ar m f u l  o r   o b jectio n ab l e  co n ten t  [ 1 ] – [ 3 ] .  Ad d itio n ally ,   th e  d y n am ic  n at u r e  o f   o n lin e  co n ten t  an d   u s er   in ter ac tio n s   m ak es  it  d if f icu lt  to   estab lis h   s ta tic   r u les  o r   g u id elin es  f o r   m o d er ato r s   to   ad h er e  to .   T h u s ,   th e  u tili za tio n   o f   ar tific ial  in tellig en ce   f o r   a u to m atic   m o d er atio n   p r esen ts   a  p er tin en t  an d   cr u cial  s o lu tio n   to   th is   is s u e.   Ou r   o b jectiv e   is   to   in v esti g ate  th e   ef f ec tiv en ess   o f   e m p lo y in g   n eu r al  n etwo r k s   f o r   r e g u latin g   tex t  co n ten t,   s p ec if ically   in   d etec tin g   s p am ,   h ate  s p ee ch ,   an d   ab u s iv e  lan g u ag e  u s in g   m ac h in e   lear n in g   alg o r ith m s .   T h is   in v o lv es  a n aly zin g   th e   f ea tu r es  o f   m ac h in e  lear n in g   m eth o d s   f o r   n atu r al   lan g u ag e  p r o ce s s in g   task s ,   s u ch   as  tex t   class if icatio n ,   d e v elo p in g   a   m o d el  f o r   id en tif y in g   s p am   m ess ag es  b ased   o n   d ee p   n eu r al  n etwo r k s ,   co m p ar in g   th e  r esu lts   o b tain ed   with   Evaluation Warning : The document was created with Spire.PDF for Python.
I n t J E lec  &   C o m p   E n g     I SS N:   2088 - 8 7 0 8         A r tifi cia l in tellig en ce   fo r   a u to ma tic  mo d era tio n   o f te xtu a l c o n ten t …   ( S o l o miia   Lia s ko vska )   3397   class ical  m ac h in e  lear n in g   m eth o d s ,   cr ea tin g   a  te x t  cla s s if icatio n   m o d el  f o r   d etec ti n g   h ate   s p ee ch   a n d   o f f en s iv e  lan g u ag e   b ased   o n   th e  tr ain ed   b id ir ec tio n al  en c o d er   r e p r esen tatio n s   f r o m   tr a n s f o r m er s   ( B E R T )   tr an s f o r m er   m o d el,   an d   an aly zin g   th e  ac cu r ac y   an d   e f f icien cy   o f   th e  d ev elo p ed   m o d el.   T o   ac co m p lis h   th is ,   we  p r o p o s e  th e  d ev elo p m en t o f   a  s o f twar e  im p lem en tatio n   o f   m ac h in e  lear n in g   alg o r ith m s   d esig n ed   to   d etec t   s p am   an d   h ate  s p ee ch   in   o n lin e  co m m u n icatio n .   Ou r   r esear ch   in teg r ates  m eth o d s   an d   alg o r ith m s   o f   n atu r a l   lan g u ag e  p r o ce s s in g   co m m o n l y   u tili ze d   f o r   tex t c lass if icatio n .   T h u s ,   i n   o r d e r   t o   u t i l i z e   t h e   m o s t   a p p r o p r i a t e   a n d   u p - to - d a t e   i n f o r m a t i o n ,   a s   w e l l   a s   e f f e c t i v e   m e t h o d s ,   it   i s   n e c e s s a r y   t o   v e r i f y   t h e   r e l e v a n c e   o f   t h e   d a t a   i n v o l v e d   i n   o u r   r e s e a r c h .   A m o n g   t h e   s u b j e c t   a r e a s   t o   w h i c h   s c i e n t i f i c   w o r k s   c o r r e l a t i n g   w i t h   o u r   c h o s e n   s c i e n t i f i c   d i r e c t i o n   c a n   b e l o n g   a r e   c o m p u t e r   s c i e n c e ,   e n g i n e e r i n g ,   a n d   m a t h e m a t i c s .   I t   i s   e v i d e n t   t h a t   t h e   c h o i c e   i s   q u i t e   o b v i o u s   a n d   a l i g n s   w i t h   o u r   s c i e n t i f i c   o b j e c t i v e s   t o   i n v e s t i g a t e   t h e   e f f e c t i v e n e s s   o f   u s i n g   n e u r a l   n e t w o r k s   t o   r e g u l a t e   t e x t u a l   c o n t e n t   u s i n g   m a c h i n e   l e a r n i n g   m e t h o d s .   W o r k s   [ 4 ] – [ 8 ]   d elv e  in to   th e   m eth o d s   an d   m ea n s   o f   d ete ctin g   s o cial  s p am ,   wh ich   en co m p ass es   illeg al  tex t  co n ten t  [ 9 ] – [ 1 3 ] ,   o f f en s iv e  lan g u ag e,   h ate  s p ee ch ,   cy b e r b u lly in g ,   an d   d is in f o r m atio n .   I n   [ 1 ] ,   th e   n ee d   f o r   th e   d e v elo p m e n t  o f   e f f ec tiv e  m eth o d s   f o r   d etec tin g   s o cial  s p am   is   em p h asized ,   w h er ein   th e   s u p p o r t  v ec to r   m eth o d   ( SVM) ,   r an d o m   f o r est,  an d   n aiv e   B ay esian   alg o r ith m   a r e  em p l o y ed   t o   a d d r ess   th is   cr u cial  s o cial  p r o b lem .   T h ey   p r o p o s e  a  co n ce p t  f o r   d ev elo p in g   m o r e  ac cu r ate  a n d   co n tex t - d ep en d en t  h o s tile  lan g u ag e   d etec tio n   s y s tem s   [ 1 4 ] .   Su c h   m ac h in e  lear n in g   a lg o r ith m s   as  th e  s u p p o r t   v ec t o r   m eth o d ,   r an d o m   f o r est,  B ay esian   class if ier ,   k - n ea r est  n eig h b o r ’ s   m eth o d ,   a n d   m u ltil ay er   p er ce p tr o n   ar e  e x p lo r ed   in   [ 3 ] .   I n   [ 4 ] ,  v ar io u s   s p ee ch   m o d els - tr an s f o r m er s   lik e  B E R T ,   XL Net,   an d   R o B E R T a  ar e  co m p ar ed   in   th eir   ef f icac y   in   d etec tin g   click b ait  h ea d lin es.   Ad d itio n ally ,   [ 6 ]   u n d er s co r e s   th e  n ec ess i ty   f o r   in ter d is cip lin ar y   co o p er atio n   am o n g   in f o r m atio n   tech n o lo g y   p r o f ess io n als,  s o cio lo g is ts ,   an d   leg al  ex p er ts   to   d ev is e  ef f ec tiv e  an d   eth ical  s o lu tio n s   to   th e  p r o b lem   o f   h a r m f u l c o n ten t.    Var io u s   wo r k s   o f f e r   s o lu tio n s   to   th e  s p am   p r o b lem .   I n   [ 5 ] ,   a  m o d el  b ased   o n   th e  c o n v o lu tio n al   n eu r al  n etwo r k   ( C NN)   ar ch itectu r e  is   p r o p o s ed .   R esear ch   [ 7 ]   claim s   th at  th e   d ee p   lear n in g   lo n g   s h o r t - ter m   m em o r y   ( L STM )   m o d el  o u tp er f o r m s   o th e r   m o d els  in   ter m s   o f   all  m etr ics:   ac cu r ac y ,   r el iab ilit y ,   r ec all,   an d   F1 - s co r e.   I n   [ 8 ] ,   th e  em p h asis   is   o n   th e  p r o b lem   o f   class if ic atio n   ac cu r ac y   o f   em o tio n al  co lo r in g   in   tex t  d ata,   an d   it is   f o u n d   th at  th e  b est m o d el  is   a  r an d o m   f o r est,  ac h ie v in g   an   ac cu r ac y   o f   o v e r   8 0 %.   R esear ch   [ 1 5 ] – [ 1 9 ]   u n d er s co r es  th e  im p o r tan ce   o f   class if icatio n   ac cu r ac y   an d   s p am   m ess ag e  d etec tio n   u s in g   tr an s f o r m er   m o d els  an d   e n s em b le  lear n i n g   [ 2 0 ] .   P r o p o s ed   tr an s f o r m er   m o d els,  i n clu d in g   B E R T   an d   eXtr em e  Gr ad ien t  B o o s tin g   ( XGBo o s t) ,   ar e  u tili ze d   f o r   s p am   class if icatio n   an d   d etec tio n .   An o th er   g r o u p   o f   wo r k s   p r o p o s es  d ir ec tio n s   an d   m eth o d s   f o r   s o lv in g   th e  s p am   p r o b lem   [ 2 0 ] – [ 2 4 ] .  T h e  au th o r s   o f   [ 1 6 ]   in tr o d u ce   a  n ew  a p p r o ac h   to   tex t  class if icatio n   b ased   o n   C NN  an d   B id ir ec tio n al  L STM   m o d els,  wh ich ,   in   th eir   o p in io n ,   b etter   ca p t u r e  s em an tic  in f o r m atio n   a n d   d e m o n s tr ate  in c r ea s ed   ac cu r ac y   f o r   twee t  clas s if icatio n .   T h e  wo r k   [ 2 5 ]   s u g g ests   an   ap p r o ac h   t h a t  co m b in es  a  p r e - tr ain e d   tr an s f o r m er   m o d el  with   a  C NN ,   wh ile  [ 2 1 ] ,   [ 2 2 ] ,   [ 2 6 ]   p r esen ts   a  s p am   d etec tio n   s y s tem   in   th e  T witter   n etwo r k   in   r ea l - tim e  alo n g s id e  s en tim en t  an aly s is   u s in g   m ac h in e  lear n in g   an d   d ee p   lear n i n g   m eth o d s .   T h e  au t h o r s   o f   [ 1 7 ]   p r o p o s es  a  n ew  ap p r o ac h   to   im p r o v in g   s p am   d etec tio n   u s in g   a  d ee p   r ec u r r en t  n eu r al  n etwo r k ,   w h ile  [ 1 8 ] – [ 2 0 ]   p r esen ts   a   b in ar y   class if ier   b ased   o n   m ac h in e  lear n in g .   I n   ar ticle   [ 9 ] ,   b ased   o n   a  c o m p r eh en s iv e   r ev i ew  o f   m eth o d s   an d   ev alu atio n   m etr ics  f o r   d etec ti n g   s o cially   u n ac ce p ta b le  s tatem en ts ,   it  is   co n clu d ed   th at  f u tu r e  r esear ch   s h o u ld   f o cu s   o n   d e v elo p in g   m o r e  r eliab le  an d   ac cu r ate  m eth o d s   c ap ab le  o f   co p in g   with   th e  d y n am ics  o f   te x t  d at a   f lo ws  o n   o n lin e   p latf o r m s   [ 2 7 ] ,   [ 2 8 ] .   On lin e  c o m m u n icatio n   ab u s e  tak es  m an y   f o r m s   –   it  ca n   b e   cy b er b u lly in g ,   m is in f o r m atio n ,   s p am ,   an d   m o r e.   On lin e  p r o p ag an d a  d eser v es  p ar ticu lar   atten tio n   –   th r o u g h   wid esp r ea d   u s e  o f   f ak e  ac co u n ts   o n   s o cial  m ed ia,   v ar io u s   p o liti ca l  o r   p u b lic  f ig u r es  an d   o r g an izatio n s   ca n   d is s em in ate  d esire d   in f o r m ati o n   to   s h ap e   p u b lic  o p in io n .   T h is   cr ea tes  a  ch allen g e  f o r   i n f o r m atio n   f ilter in g   an d   co n tr o l  [ 2 9 ] – [ 3 1 ] .   T y p ica lly ,   o wn er s   o f   v ar io u s   o n lin e   f o r u m s   o r   c h ats  u s e  p e o p le  to   m o n ito r   p u b lis h ed   co n ten t,  b u t  th is   m eth o d   h as  o b v io u s   d r awb ac k s   –   a  p er s o n   p h y s ically   ca n n o t  r ev iew  th e  co n ten t  o f   h u n d r e d s   o f   m ess ag es  p o s ted   in   a  s h o r t  p er io d ,   esp ec ially   d u r i n g   m as s   s p am   attac k s   o n   u s er s .   L ar g e  p latf o r m s   s u ch   as   T witter   [ 2 3 ] ,   [ 2 6 ]   o r   Face b o o k   u s e  s o f twar e   to o ls   to   d etec t  co n ten t  th at   v io lates  p latf o r m   r u les,  b u t   th ey   also   h av e  lim itatio n s   –   t h ese  to o ls   o f ten   d o   n o t   co n s id er   th e   m ess ag e  co n tex t  o r   th e   cu ltu r al   b ac k g r o u n d   o f   its   au th o r ,   th u s   th ey   f r eq u en tly   b lo ck   co n te n t  th at  d o es  n o t  v io late  co m m u n ity   g u id elin es  [ 1 4 ] ,   [ 1 8 ] ,   [ 2 0 ] ,   [ 2 2 ] .  T h is   is s u e  is   h ig h ly   r elev an t  f o r   s o cial  n etwo r k   I n s tag r am .   T h er ef o r e,   m o d e r n   au to m ated   co n ten t  m o d er atio n   to o ls   ar e  n o t f lawless ,   an d   d esp ite  ex is tin g   s o lu tio n s   th at  u s e  ar tific ial  in tellig en ce   to   d etec t  illi cit  co n ten t,   th is   ar ea   r eq u ir es f u r th er   r esear ch   [ 3 2 ] – [ 3 7 ] .       2.   M E T H O D    I n   th is   s cien tific   wo r k ,   a u t h o r s   s o lv e  th e  task   o f   tex t   class if icatio n   u s in g   m ac h in e  lear n in g   alg o r ith m s   [ 3 8 ] – [ 4 0 ] .   Su ch   al g o r ith m s   ar e  n o t  ab le  to   wo r k   d ir ec tly   with   tex t  d ata,   f o r   th is   th ey   n ee d   to   b e   co n v er ted   in to   a  n u m er ical   f o r m at  -   v ec to r s .   T h er ef o r e,   we   a n aly ze d   t h e  m ain   m eth o d s   [ 4 1 ] – [ 4 3 ]   o f   tex t   d ata   r ep r esen tatio n   [ 4 4 ] :  o n e - h o t  v ec to r ,   b ag   o f   wo r d s ,   ter m   f r eq u en cy – in v er s e  d o cu m en t  f r eq u en cy   ( T F - I DF) ,    Evaluation Warning : The document was created with Spire.PDF for Python.
                      I SS N :   2 0 8 8 - 8 7 0 8   I n t J E lec  &   C o m p   E n g ,   Vo l.   15 ,   No .   3 ,  J u n e   20 25 :   3 3 9 6 - 3 4 0 9   3398   n - g r am s ,   as  well  as  v ec to r   r ep r esen tatio n   o f   wo r d s   an d   i ts   im p lem en tatio n   th r o u g h   t h e  wo r d 2 v ec   m o d el    [ 4 5 ] – [ 4 8 ] .   I n   p ar ticu lar ,   two   m o d el  ar c h itectu r es  ar e   in v o lv ed   in   th e   r esear ch   [ 4 9 ] – [ 5 2 ] :   C o n tin u o u s   b ag   o f   wo r d s   ( C B OW )   an d   Sk ip - g r a m ,   lin ea r   m ac h in e   lear n in g   al g o r ith m s   an d   n eu r al  n etwo r k s .   T h er e   ar e  s ev e r al  m eth o d s ,   th e  m o s t  co m m o n   o f   wh ich   is   “b ag   o f   wo r d s . ”  T h e  b ag   o f   wo r d s   m ar k s   th e  p r esen ce   o f   a  wo r d   in   in p u t  d o cu m e n ts   co m p ar ed   to   all  wo r d s   in   t h e  d ataset.   T h er ef o r e,   its   im p lem en tatio n   r eq u ir es  a  d ictio n a r y   o f   all  u s ed   wo r d s   an d   a n   i n d icat o r   o f   w o r d   p r esen ce   [ 5 3 ] ,   [ 5 4 ] .   All  d ata  in p u tted   in to   m ac h in e  lear n in g   m o d els  will th u s   b e  r ep r esen ted   as n u m er ical  v ec to r s   ( 1 ) :     [ 1 , 2 , 3 … ] ,     ( 1 )     T h e  p r e v io u s   m eth o d   ca n   b e  i m p r o v e d   b y   r ep r esen tin g   ea ch   wo r d   in   t h e  v ec to r   n o t  ju s t  as   0   o r   1 ,   b u t  r ath er   b y   its   co u n t  in   th e  d o cu m en t   o r   its   f r eq u e n cy   r elativ e  to   t h e  to tal  n u m b er   o f   wo r d s   in   th e  tex t.  T h e  m ai n   d r awb ac k   o f   th is   ap p r o ac h   is   th at  wo r d s   ap p ea r in g   in   ev er y   d o cu m e n t  will  h av e  th e  h ig h est  f r eq u en cy   an d   cr ea te  in f o r m atio n al  n o is e.   T o   ad d r ess   th is   is s u e,   ter m   f r eq u en cy – in v er s e  d o cu m e n t  f r eq u en cy   ( T F - I DF)   ex is ts   –   a  m etr ic  t h at  d eter m i n es  th e  s ig n if ican ce   o f   a  wo r d   f o r   a  s p ec if ic   d o c u m en t   ag a in s t  its   s ig n if ican ce   f o r   th e  e n tire   co r p u s .   I t  is   lo g i ca l  to   ass u m e  th at  a  wo r d   a p p ea r in g   in   all  in p u t  d ata  will  h a v e  a  lo w  v alu e  f o r   a   s p ec if ic  d o cu m en t,  wh er ea s   a  wo r d   ap p ea r i n g   in   o n l y   o n e  d o cu m e n t  will  b etter   d escr ib e  it.  T F - I DF  i s   ca lcu lated   f o r   ea ch   wo r d ,   a n d   th e  h ig h e r   th e  v alu e  o f   th e   m etr ic,   th e  m o r e  s ig n i f ican t  th e  wo r d   is   f o r   th e   d o cu m e n t.  T h e  f o r m u la  f o r   th e  m etr ic  is   as ( 2 ) :      −  =  ∗ l og ⁡ ( )     ( 2 )        –   ter m   f r eq u e n cy ,     –   to tal  n u m b er   o f   d o cu m en ts ,     –   n u m b er   o f   d o cu m en ts   co n tain in g   th e  wo r d .   T h e  ess en ce   o f   o u r   r esear ch   is   th e  u s e  o f   m ac h i n e  lear n in g   alg o r ith m s   to   d etec t sp am .     Den s e  v ec to r s   o r   co n tex t  v ec t o r s   ar e  v ec to r s   u s ed   to   d escr ib e  a  wo r d   b ased   o n   its   r elatio n s h ip s   with   o th er   wo r d s .   Giv en   a  s en ten ce ,   we  ca n   tak e  a   s p ec if ic  win d o w  ar o u n d   th e  c h o s en   wo r d   with   a  s ize  o f   n   wo r d s   to   r ep r esen t  its   co n tex t.  W o r d s   th at  h a v e  s im ilar   c o n tex ts   –   m ea n in g   th ey   s h ar e   th e  s am e   s u r r o u n d in g   wo r d s   as  wo r d   x ,   will  b e   co n s id er e d   s y n o n y m s   o r   s em an tically   s im ilar   to   wo r d   y .   T h en ,   f o r   t h e  c h o s en   wo r d ,   we  ca n   f o r m   a  v ec t o r   [ 1 , 2 , 3 … ] ⁡ wh er e  ea c h   v a r iab le  r ep r esen ts   th e  f r eq u e n cy   o f   ea ch   wo r d ' s   o cc u r r en ce   in   t h e   co r p u s   with in   th e  v icin ity   o f   th e  ch o s en   wo r d .   Sin ce   wo r d s   ar e  r ep r esen ted   as  v ec to r s ,   we  ca n   m ea s u r e  th e   s im ilar ity   b etwe en   wo r d s   u s in g   th e  f o r m u la  o f   th e  d o t p r o d u ct,   s p ec if ically   f in d in g   th e  co s in e  s im ilar ity   ( 3 ) :     c os = ⁡ ∗ | | ∗ | |     ( 3 )     wh er e  a   an d   b   a r e  v ec to r   r ep r esen tatio n s   o f   wo r d s .   W o r d 2 v ec   is   a  two - lay er   n e u r al  n et wo r k   th at  p r o ce s s es  tex t  b y   “v ec to r izin g ”  wo r d s .   I t  tak es  a  tex tu al  co r p u s   as  in p u t  an d   p r o d u ce s   a  s et  o f   d en s e  v ec t o r s   r ep r esen tin g   wo r d s   in   th at  c o r p u s .   T h er e  a r e  two   m ain   ar ch it ec tu r es: C B O W   an d   s k ip - g r a m .   Au th o r s   u s ed   Py th o n   p r o g r a m m in g   lan g u ag e,   lib r a r ies  f o r   m ac h in e  lear n in g ,   n atu r al   lan g u ag e   p r o ce s s in g   an d   d ata  v is u aliza tio n   NL T K ,   s k lear n ,   m atp l o tlib . p y p l o t,  s ea b o r n ,   n ea ttex t  as  to o ls   f o r   r esear ch .   As  a  d ev elo p m en t  e n v ir o n m e n t,  Go o g le  C o lab   was  u s ed   a n   in ter ac tiv e  o n lin e  en v i r o n m en t  f o r   p er f o r m in g   d ata  an aly s is   an d   v is u aliza tio n   task s ,   wh ich   allo ws  y o u   to   b r ea k   th e  c o d e  i n to   s ep ar ate  p ar ts ,   r u n   th em   in d ep en d en tly   o f   ea ch   o t h er ,   v is u alize s   th e  p r o ce s s   o f   co d e  e x ec u tio n   in   r ea l tim e  an d   g iv e s   th e  o p p o r tu n ity   to   im m ed iately   s ee   th e  r esu lt  ex ec u tio n   o f   th e  d esire d   p a r t  o f   th e  p r o g r am ,   wh ich   g r ea tly   s im p lifie s   th eir   wr itin g   an d   d e b u g g i n g .     2 . 1 .     Cla s s if ier  o f   lin ea r  m o d els,  L S T M ,   s pa m   ba s ed  CN N  a nd   B E RT   2 . 1 . 1 .   Da t a   a na ly s is   a nd   pre - pro ce s s ing   T h e  d ataset  u s ed   f o r   m o d el   tr ain in g   c o n s is ts   o f   5 , 5 7 4   tex t   m ess ag es,  wh ich   ar e   lab eled   a s   s p am   an d   non - s p am .   Fig u r e  1   p r esen ts   an   o v er v iew  o f   th e  d ataset,   in clu d in g   g en e r al  s tatis tic s   s u ch   as  wo r d   f r eq u en cy   an d   class   d is tr ib u tio n .   T h is   v i s u aliza tio n   h elp s   to   u n d er s tan d   th e  n atu r e   o f   th e   d ata  an d   its   b alan ce ,   wh ich   is   cr itical  f o r   tr ain in g   ef f ec tiv e  cl ass if icatio n   m o d els.   Sto p - wo r d s   ar e   wo r d s   th at   ar e  p r esen t  in   th e  tex t,   b u t  b y   th em s elv es  d o   n o t  m ak e   s en s e,   s u ch   as   co n ju n ctio n s ,   p r ep o s itio n s ,   o t h er   o f f icial  p ar ts   o f   s p ee ch ,   a n d   ex clam atio n s .   Als o ,   s to p   wo r d s   u s u ally   in clu d e  wo r d s   th at  ar e  f o u n d   in   alm o s t  all  co r p o r a  o f   a  ce r tain   lan g u ag e.   B y   th r o win g   th em   o u t ,   y o u   ca n   g et  r id   o f   u n n ec ess ar y   n o is e  an d   g i v e  m o r e  weig h t   to   wo r d s   t h at  ar e   m o r e  im p o r tan t   an d   h a v e  a   s ig n if ican t  im p ac t  o n   th e  co n ten t  o f   th e  d o cu m e n t.  T h e  NL T K   lib r ar y   co n tain s   a  b u ilt - in   lis t o f   s to p   wo r d s   f o r   ea ch   lan g u a g e.       Evaluation Warning : The document was created with Spire.PDF for Python.
I n t J E lec  &   C o m p   E n g     I SS N:   2088 - 8 7 0 8         A r tifi cia l in tellig en ce   fo r   a u to ma tic  mo d era tio n   o f te xtu a l c o n ten t …   ( S o l o miia   Lia s ko vska )   3399       Fig u r e  1 .   Descr ip tio n   an d   v is u aliza tio n   o f   th e  d ata  s et        Sin ce   th e  s p ec if ic   m ea n in g   o f   wo r d s   is   r elativ ely   u n im p o r ta n t  f o r   s p am   d etec tio n ,   s tem m i n g   ca n   b e  u s ed .   I t  is   m u ch   f aster   an d   ea s ier   to   im p lem en t.  T h er e  ar e  s ev er al  s tem m in g   im p lem en ta tio n s   in   th e  NL T K   lib r ar y .   T h e  tar g et  v ar iab le  in   th e  d ataset  tak es  t wo   s tr in g   v alu es.  Sin ce   th e  m o d els  ca n   o n ly   wo r k   d ir ec tly   with   n u m er ical  d ata,   we  e n c o d e  th e  v al u e  o f   t h e  tar g et  v ar iab le  ac co r d in g   to   th e  b i n ar y   class if icatio n   p r o b lem .   Usi n g   th e   b u ilt - in   tr a in _ test _ s p lit()   f u n ctio n   o f   t h e   s k lear n   lib r a r y ,   we  s p lit  th e  d ata  s et  in to   tr ain in g   an d   test   s am p les.  T o k e n izatio n   is   th e   p r o ce s s   o f   d iv id in g   a   d o c u m en t   in to   wo r d   co m p o n en ts   -   to k en s ,   a f te r   to k en izatio n ,   we  will  co n v er t   d o cu m en ts   in to   n u m er ical  v ec to r s   u s in g   th e  m eth o d s   o f   “b ag   o f   wo r d s ”,   n - g r am s   an d   TF - I DF .   T o   d o   th i s ,   we  will  u s e  th e  s k lear n   lib r ar y   p ac k ag e  f o r   e x tr ac tin g   f ea tu r es  f r o m   tex t  d ata   an d   class es  f o r   v ec to r izatio n .   L et's  in v o lv e  in s tan ce s   o f   th e  C o u n tVec to r izer   an d   T f id f T r a n s f o r m er   class es  to   cr ea te  n ew  d atasets   f o r   ea c h   f ea tu r e  ex tr ac tio n   m et h o d .   Fo r   ea ch   o f   th e   d ata  s ets,  we  t r ain   two   lin ea r   m o d els:   lo g is tic  r eg r ess io n   an d   th e   s u p p o r t v ec to r   m eth o d .   W e  will u s e  th e  f o llo win g   m etr ics to   e v alu ate  th e  m o d els:   −   Acc u r ac y - s co r e  –   th e  r atio   o f   th e  n u m b er   o f   c o r r ec tly   p r e d icted   class es  to   th e  n u m b er   o f   all  p r e d icted   d ata,   ch ar ac ter izes th e  ac c u r ac y   o f   th e   m o d el;   −   Pre cisi o n - s co r e  –   th e   r atio   o f   th e  n u m b er   o f   c o r r ec tly   p r ed i cted   p o s itiv e  ( y =1 )   d ata  to   th e  n u m b er   o f   all   p r ed icted   p o s itiv e  d ata,   wh ic h   ch ar ac ter izes  th e   er r o r   with   wh ich   th e   m o d el  ca n   ac c ep t   d ata  m ar k ed   as  n eg ativ e  as p o s itiv e;   −   R ec all  –   th e  r atio   o f   t h e  n u m b er   o f   c o r r ec tly   p r ed icted   p o s itiv e  d ata  to   th e   s u m   o f   th e  n u m b er   o f   co r r ec tly   p r ed icted   p o s itiv e  an d   f alsely   p r ed icted   n eg ativ e  d ata,   c h ar ac ter izes  th e  m o d el' s   ab il i ty   to   d eter m in e   p o s itiv e  d ata;   −   F1 - s co r e  –   a  m etr ic  u s ed   to   ca lcu late  th e  r atio   o f   th e  p r o p o r tio n   o f   o b jects  th at  wer e  class if ied   b y   th e   m o d el  as  p o s itiv e  an d   r ea lly   wer e  p o s itiv e  to   th e   p r o p o r tio n   o f   f o u n d   p o s itiv e  d ata  f r o m   all  p o s itiv e  d ata   in   th e  s et,   ca lcu lated   b y   th e  f o r m u la:     = 2 + 1 ∗  ∗  2  ∗        wh er e  β  –   is   th e  weig h t f o r   m e tr ics.   Af ter   tr ain in g   th e   m o d el  a n d   t esti n g   th e  m o d el,   t h e  f o llo win g   m etr ics we r e  o b tain e d :   −   Acc u r ac y - s co r e= 0 . 9 5 2 ,   p r ec is io n - s co r e= 0 . 9 7 ,   r ec all=0 . 9 3 ,   f 1 - p o in t=0 . 9 5   f o r   lo g is tic  r eg r ess io n   tr ain ed   o n   “b ag   o f   wo r d s ”;   −   Acc u r ac y - s co r e= 0 . 9 4 ,   p r ec is io n - s co r e= 0 . 9 6 4 ,   r ec all=0 . 9 1 ,   f 1 - p o in t=0 . 9 3 6   f o r   th e   m et h o d   o f   s u p p o r t  v ec to r s   tr ain ed   o n   th e  “ b ag   o f   wo r d s ”;   −   Acc u r ac y - s co r e= 0 . 9 4 ,   p r ec is io n - s co r e= 0 . 9 8 8   r ec all=0 . 8 9 ,   f 1 - s co r e= 0 . 9 3   f o r   lo g is tic  r eg r ess io n   tr ain ed   o n   th e  “b ag   o f   u n ig r am   a n d   b ig r a m ”;   −   Acc u r ac y - s co r e= 0 . 9 4 7 ,   p r ec i s io n - s co r e= 0 . 9 8 8 ,   r ec all=0 . 9 ,   f 1 - s co r e= 0 . 9 4   f o r   th e  m eth o d   o f   s u p p o r t   v ec to r s   tr ain ed   o n   th e  “ b ag   o f   u n ig r am   a n d   b ig r am ”;   −   Acc u r ac y - s co r e= 0 . 9 5 ,   p r ec is io n - s co r e= 0 . 9 7 6 ,   r ec all=0 . 9 2 2 ,   f 1 - s co r e= 0 . 9 5   f o r   lo g is tic  r e g r ess io n   tr ain ed   on  TF - I DF   v ec to r s ;   −   Acc u r ac y - s co r e= 0 . 9 6 7 9 1 4 4 3 8 5 0 2 6 7 3 8 ,   p r ec is io n - s co r e= 0 . 9 8 ,   r ec all=0 . 9 5 5 ,   f 1 - s co r e= 0 . 9 6 6   f o r   th e  s u p p o r t v ec t o r   m eth o d   tr ai n ed   o n   TF - I DF   v ec to r s .   T o   v is u alize   th e  q u ality   o f   t h e  m o d els,  we  will  o u tp u t  t h e   er r o r   m atr ix   f o r   ea ch   d ata  s e t  f o r   ea ch   m o d el.   Fig u r e  2   d em o n s tr ates  wh er e  Fig u r e  2 ( a)   s h o ws  er r o r   m atr ices  f o r   lo g is tic  r eg r ess i o n   an d   Fig u r e  2 ( b )   s h o ws  th e  s u p p o r t  v ec to r   m et h o d   th at   we  ca n   s ee   th at   b o th   m o d els  f o r   b ag - of - w o r d s   d ata   ar e  eq u ally   g o o d   at  id en tify in g   n o n - s p am   m ess ag e s .   B u t th e  lin ea r   r eg r ess io n   m e th o d   is   b etter   at  d ir ec tl y   class if y in g   s p am   its elf .     Fig u r e  3   d em o n s tr ates  th at  th e  ab o v e  m atr ices  an d   we  ca n   co n clu d e  th at  f o r   d ata  s ets  c o n tain in g   u n ig r am   a n d   b i g r am .   Fig u r e  3 ( a)   s h o ws  er r o r   m atr ices  f o r   lo g is tic  r eg r ess io n   ( lef t) .   Fig u r e  3 ( b )   s h o ws  th e   s u p p o r t v ec t o r   m eth o d   th e   m o d els g iv e  alm o s t id en tical  r esu lts ,   b u t in   tu r n   p r ed ict  less   f alse p o s itiv e  d ata.     W e  ca n   co n clu d e  th at  th e  d eter m in atio n   o f   th e  m ess ag e  lab e l  as  s p am   o r   n o t  s p am   d o es  n o t  im p r o v e   m u ch   wh e n   tak i n g   in t o   ac co u n t  th e  a d d itio n al  c o n tex t.   B ec au s e  wh en   u s in g   th e   n - g r am s   d ataset,   th e  o v e r all  ac cu r ac y   o f   th e  m o d el  d id   n o t   im p r o v e,   it  ev en   d ec r ea s ed   s lig h tly ,   b u t  at  th e  s am e  tim e  th e  m o d el  d o es  less   Evaluation Warning : The document was created with Spire.PDF for Python.
                      I SS N :   2 0 8 8 - 8 7 0 8   I n t J E lec  &   C o m p   E n g ,   Vo l.   15 ,   No .   3 ,  J u n e   20 25 :   3 3 9 6 - 3 4 0 9   3400   s p am   d etec tio n   er r o r s .   Fewer   f alse - p o s itiv e  d ata  a n d   th e   lo west  ac cu r ac y   a r e  d em o n s tr at ed   b y   m o d els  tr ain e d   o n   d ata  in   th e  TF - I DF   in d icato r   f o r m at.   Fo r   T F - I DF  f o r m at  d ata  in   F ig u r e  4   d em o n s tr ates  th at  th e  s u p p o r t  v ec to r   m et h o d   b etter   class if ie s   m ess ag es  co n tain in g   s p am ,   wh ile  allo win g   f ewe r   er r o r s   th an   lo g is tic  r eg r ess io n .   Fig u r e  4 ( a)   s h o ws  er r o r   m atr ices f o r   lo g is tic  r eg r ess io n .   Fig u r e  4 ( b )   s h o ws th e  s u p p o r t v ec to r   m eth o d .           ( a)   ( b )     Fig u r e  2 .   E r r o r   m atr ices f o r   l o g is tic  r eg r ess io n   ( a)   an d   th e  s u p p o r t  v ec to r   m et h o d   a n d     ( b )   f o r   th e  “ b ag   o f   wo r d s ”  d at a  s et           ( a)   ( b )     Fig u r e  3 .   E r r o r   m atr ices f o r   l o g is tic  r eg r ess io n   ( lef t)   ( a)   an d   th e  s u p p o r t  v ec to r   m eth o d   an d     ( b )   ( r ig h t)   f o r   t h e  “b ag   o f   wo r d s ”  d ata  s et           ( a)   ( b )     Fig u r e  4 .   E r r o r   m atr ices f o r   l o g is tic  r eg r ess io n   ( a)   an d   th e  s u p p o r t  v ec to r   m et h o d   ( b )   f o r   t h e  TF - I DF   d ataset     Evaluation Warning : The document was created with Spire.PDF for Python.
I n t J E lec  &   C o m p   E n g     I SS N:   2088 - 8 7 0 8         A r tifi cia l in tellig en ce   fo r   a u to ma tic  mo d era tio n   o f te xtu a l c o n ten t …   ( S o l o miia   Lia s ko vska )   3401   3.   RE SU L T S AN D  D I SCU SS I O N    T h is   s ec tio n   d escr ib es  u s in g   C NN  an d   L STM   n eu r al  n etwo r k   ar c h itectu r es  f o r   s p am   cla s s if icatio n .   I n   o r d er   to   tr ain   n e u r al  n etwo r k s   o n   o u r   d ata,   it  is   n ec ess ar y   to   b r in g   all  v ec to r s ,   th at  is ,   all  d o cu m en ts ,   to   a  f ix ed   len g th .   As  th e   d im e n s io n   v alu e   o f   th e  v ec to r s ,   a u th o r s   tak e  th e   len g th   o f   th e  lar g est  d o cu m e n t.  Au th o r s   ch an g e  th e  d im en s io n ality   o f   th e  v ec to r s   u s in g   th e  p ad _ s eq u en ce s ( )   f u n ctio n   o f   th e   K er as  lib r ar y ,   th e  p ad d in g =  ar g u m e n t  will  h av e  th e  v alu e  “p o s t”,   wh ich   in d ica tes  th e  ze r o   v alu es  o f   th e  f u n c tio n ,   d u e  to   wh ich   we  ex p an d   t h e  v ec to r   an d   ad d   th em   to   th e  e n d .     3 . 1 .     Descript io n o f   t he  net w o rk   a r chit ec t ure   E m b ed d in g   lay er :  in p u t  d ata   to   th e   n etwo r k   is   a   s eq u e n ce   o f   wo r d s ,   wh ich   ar e  r ep r esen ted   as   in teg er s   wo r d   in d e x es  in   th e  d ictio n ar y .   T h e  E m b ed d in g   L a y er   tr a n s f o r m s   th ese  i n teg er s   i n to   v ec t o r s   o f   g iv e n   d im en s io n   c o n tain in g   th e  r e p r esen tatio n   o f   th e  wo r d   th r o u g h   its   co n tex tu al  r elatio n s h ip   w ith   o th er   wo r d s .   8 0   is   th e  s ize  o f   th e  len g th   o f   th e   in p u t v ec to r   o f   to k en s ,   a n d   th e   d im en s io n   o f   d e n s e  v ec to r s   is   1 0 0 ;   −   L STM :  A  lay er   o f   an   L STM   n etwo r k   th at  ca n   s to r e  lo n g - ter m   d ep en d e n cies  in   s eq u en tial  d ata.   I t  co n s is ts   o f   n eu r o n s   f o r   p r o ce s s in g   s eq u en tial  in p u t  d ata  an d   s av i n g   in f o r m atio n   ab o u t  th e  s tate  o f   th e  n eu r al  n etwo r k ;   −   Glo b alM ax Po o lin g 1 D:  a  lay er   ac tin g   as  a  f ilter   f o r   f ea t u r es  g en er ated   b y   L STM ,   it s   o u tp u t  is   th e  m ax im u m   v alu e  f r o m   ea ch   v e cto r   o f   f ea tu r es;   −   Dr o p o u t   an d   b atch   n o r m aliza t io n :  a  d r o p o u t  lay e r   is   ap p lied   af ter   th e   L STM   lay er   t o   f ilter   th e  n u m b er   o f   f ir in g   n eu r o n s   to   p r ev en t  o v er tr ain in g .   Af ter   th at,   b atch   n o r m aliza tio n   is   ap p lied   to   s tan d ar d ize  th e  in p u t   d ata  to   th e  p r ev io u s   lay e r ;   −   Den s e:  a  f u lly   c o n n ec ted   lay e r   ac ce p ts   L STM   o u t p u t  d ata   a f ter   p r o ce s s in g   b y   s ev er al  lay er s ,   co n tain s   8 0   n eu r o n s ,   f o r   n o n lin ea r   tr a n s f o r m atio n   o f   th e  in p u t  d ata  b y   th e  r ec tifie d   lin ea r   u n it  ( R eL U )   ac tiv atio n   f u n ctio n ;   −   Dr o p o u t: r e p ea ted   r e m o v al  o f   a  p ar t o f   n eu r o n s ;   −   Den s e:  an   o u tp u t  d e n s e  lay er   with   o n e  n eu r o n   an d   a  s ig m o id   ac tiv atio n   f u n ctio n ,   u s ed   to   ca lcu late  th e   o u tp u t  p r o b a b ilit y   th at  an   o b je ct  b elo n g s   to   a  class .   Fig u r e  5   p r esen ts   th e   p er f o r m an ce   o f   th e   L STM - b ased   n etwo r k .   Fig u r e  5 ( a)   s h o ws  th e  ac cu r ac y   cu r v e  f o r   b o th   tr ain i n g   an d   v alid atio n   s ets,  in d icatin g   co n s is ten t  im p r o v em en t  an d   g o o d   g en er aliza tio n .   Fig u r e  5 ( b )   illu s tr ates  th e  lo s s   cu r v e,   wh ich   s tead ily   d ec r e ases ,   s u g g esti n g   th at  th e  m o d el  is   n o t  o v er f itti n g   an d   is   lear n in g   ef f ec tiv ely   o v e r   tim e.           ( a)   ( b )     Fig u r e  5 .   Gr a p h   o f   n etwo r k   lo s s es a n d   ac cu r ac y   b ased   o n   L STM   m o d el  ( a)   ac c u r ac y   p lo t  an d   ( b )   lo s s   p lo t       Fro m   th e  g iv en   g r ap h s ,   we  ca n   s ay   th at  th e  n etwo r k   is   n o t  o v er tr ain ed ,   b ec a u s e  th e  lo s s es  o n   th e   v alid atio n   d ata  ar e  co n s tan t ly   d ec r ea s in g .   W e  in itialize   th e  co n v o lu tio n al  n e u r al  n etwo r k .   Fig u r e  6   d em o n s tr ates th e  ar ch itectu r e  o f   a  co n v o lu tio n al  n eu r al  n etw o r k .   L et's p er f o r m   t h e  f o llo win g   d e s cr ip tio n   o f   th e   n etwo r k   ar ch it ec tu r e:   −   E m b ed d in g   lay er :   th e  lay er   v ec to r izes  th e  in p u t   d ata  in to   d en s e  co n tex t  v ec to r s .   T h e  s ize  o f   th e   in p u t   v ec to r s   is   8 0 ,   a n d   th e  d im en s io n   o f   t h e  d e n s e  v ec to r s   is   5 0 .   C o n v o lu tio n al  lay er :  A  c o n v o lu tio n al  lay e r   co n tain in g   6 4   f ilter s   is   ap p lied ,   with   a  o n e - d im e n s io n al  k e r n el  o f   d im e n s io n   3   an d   a  R eL U  ac tiv atio n   f u n ctio n .   T h is   lay e r   p e r f o r m s   a  co n v o lu tio n   o p e r atio n   o n   th e  in p u t   s eq u en ce   th u s   f o r m in g   a  f ea t u r e  m ap   f o r   th e  v ec t o r .   Glo b alM ax Po o lin g 1 D:  T h e  in p u t  d ata  ar e  f e atu r e  m ap s   f r o m   th e  co n v o lu t io n al  lay er ,   th e   cu r r en t  lay er   in   tu r n   s elec ts   t h e  m ax im u m   v alu e  f r o m   ea c h   f ea tu r e  m ap ,   th u s   r ed u cin g   th e  d ata  v o lu m e  an d   h ig h lig h tin g   th e  m o s t  im p o r tan t  in f o r m atio n .   Dr o p o u t  a n d   B atch   No r m aliza tio n :  r em o v in g   p a r t  o f   t h e   n eu r o n s   an d   s tan d ar d izin g   th e  in p u t  d ata  to   s p ee d   u p   an d   r eg u late  th e  n etwo r k .   Den s e:  th e  o u tp u t  d ata  Evaluation Warning : The document was created with Spire.PDF for Python.
                      I SS N :   2 0 8 8 - 8 7 0 8   I n t J E lec  &   C o m p   E n g ,   Vo l.   15 ,   No .   3 ,  J u n e   20 25 :   3 3 9 6 - 3 4 0 9   3402   af ter   “scr ee n in g ”  an d   s tan d ar d izatio n   p ass es  th r o u g h   a  f u ll y   co n n ec te d   d en s e  lay er   with   2 5 6   n e u r o n s   an d   R eL U  ac tiv atio n   f u n ctio n .   T h is   lay er   p er f o r m s   a  n o n - lin ea r   tr an s f o r m atio n   o f   th e  in p u t  d at a,   en ab lin g   th e   n etwo r k   t o   lear n   co m p lex   d at a  r elatio n s h ip s .   Dr o p o u t  an d   b atch   n o r m aliza tio n :   r ep ea ted l y   r em o v in g   p a r t  o f   th e  n e u r o n s   an d   s tan d a r d izin g   th e  in p u t  d ata  to   s p ee d   u p   a n d   r e g u late  th e  n etwo r k .   Fig u r e   7 ( a)   d em o n s tr ates  th at  p lo t   th e  a cc u r ac y   a n d   Fig u r e  7 ( b )   d e m o n s tr ates   th at  lo s s es  o f   th e  co n v o lu tio n al  n etwo r k .     T h is   m o d el  is   also   n o t  o v e r tr ain ed ;  o n e  ca n   s ay   th at  th e  a cc u r ac y   v al u es  f o r   th e   tr ain in g   d ata  ar e   r elev an t  f o r   th e   en tire   d ataset  s in ce   th ey   c o in cid e   with   th e  m o d el' s   ac cu r ac y   f o r   th e  v alid atio n   d ata.   T h e   ac cu r ac y   o f   th e   co n v o lu tio n al   n eu r al  n etwo r k   ex ce ed s   t h e  a cc u r ac y   o f   th e   lo n g   s h o r t - ter m   m em o r y   n etwo r k .   Fig u r e  8   d em o n s tr ates a   co m p r eh en s iv e  co m p ar is o n ,   let' s   o u tp u t th e  co n f u s io n   m atr ices f o r   th e  d ee p   n etwo r k s   an d   ca lcu late  th e  k ey   m etr ics.           Fig u r e  6 .   Ar c h itectu r e  o f   a  co n v o lu tio n al  n eu r al  n etwo r k           ( a)   ( b )     Fig u r e  7 .   Plo t o f   ac cu r ac y   an d   lo s s   f o r   a  co n v o lu tio n al  n eu r a l n etwo r k   ( a )   ac cu r ac y   an d   ( b )   lo s s           ( a)   ( b )     Fig u r e  8 .   T h e  co n f u s io n   m atr ices f o r   ( a)   L STM   an d   ( b )   C NN    Evaluation Warning : The document was created with Spire.PDF for Python.
I n t J E lec  &   C o m p   E n g     I SS N:   2088 - 8 7 0 8         A r tifi cia l in tellig en ce   fo r   a u to ma tic  mo d era tio n   o f te xtu a l c o n ten t …   ( S o l o miia   Lia s ko vska )   3403   Me tr ics f o r   th e  m o d els:   Acc u r ac y   Sco r e:  0 . 9 2 ,   Pre cisi o n   Sco r e:  0 . 8 8 ,   R ec all: 0 . 9 8 ,   F1 - Sco r e:  0 . 9 2 8   f o r   L STM .   Acc u r ac y   Sco r e:  0 . 9 5 ,   Pre cisi o n   Sco r e:  0 . 9 6 ,   R ec all: 0 . 9 4 ,   F1 - Sco r e:  0 . 9 5   f o r   C NN.     3 . 2 .     P a ra m et er s   a na ly s is ,   a nd   re s ults    B E R T   i s   a   l a n g u a g e   r e p r e s e n t a t i o n   m o d e l   d e s i g n e d   t o   c r e a t e   b i d i r e c t i o n al   r e p r e s e n ta t i o n s   f o r   d e e p   n e u r a l   n e t w o r k s   o n   r a w ,   u n a n n o t a t e d   t e x t   b y   c o m b i n i n g   l e f t  a n d   r i g h t   c o n te x t s   i n   al l  l a y e r s .   Al l   m o d el s   i n   t h e  B E R T   f a m i l y   u s e   a   p a r t i a l   i m p l e m e n t a ti o n   o f   t r a n s f o r m e r   m o d e l s ,   n a m e l y   e n c o d e r s ,   a s   t h e   n e t w o r k ' s   o u t p u t   i s   a  l a n g u a g e   m o d e l .   B E R T   is   p r e - t r a i n e d   o n   “ d i r t y ”   t e x t   d a t a ,   s o   t h e r e   i s   n o   n e e d   t o   p e r f o r m   p r e p r o c e s s i n g   t h a t   w as  u s e d   f o r   li n e a r   m o d e ls   a n d   n e u r a l   n e t w o r k s .   De n s e  l a y e r :  A  f u l l y   c o n n e c t e d   l a y e r   c o n s is t i n g   o f   o n e   n e u r o n   a n d   a  l o g i s ti c   a ct i v a ti o n   f u n c t i o n   t o   r e t u r n   t h e   p r o b a b i l it y   o f   a n   o b j e c t   b el o n g i n g   t o   a   cl a s s .   N e x t  s t e p   i s   t o   t r ai n   t h e  m o d e l   a n d   o u t p u t   t h e   c o n f u s i o n   m a t r i x   F i g u r e   9   d e m o n s tr a t e s   l o s s   a n d   a c c u r ac y   p l o ts   s i m il a r l y   t o   d e e p   n e t w o r k s .           Fig u r e  9 .   T h e  lo s s   an d   ac c u r ac y   p lo t f o r   th e  B E R T - b ased   m o d el       B E R T   i s   tr ain ed   u s in g   m ask ed   to k en   p r e d ictio n   an d   n e x t  s en ten ce   p r ed ictio n .   T h r o u g h   t h is   tr ain in g   p r o ce s s ,   B E R T   ac q u ir es  co n tex tu al,   laten t  r ep r esen tatio n s   o f   to k en s   b ased   o n   th eir   co n tex t.  Fig u r e  1 0   d em o n s tr ates th e  lo s s   an d   ac c u r ac y   p l o t f o r   th e  B E R T - b ased   m o d el.               Fig u r e  1 0 .   T h e  lo s s   an d   ac cu r a cy   p lo t f o r   th e  B E R T - b ased   m o d el       3 . 3 .     Co m pa riso n a nd   dis cus s io n   Fo r   class if icatio n ,   we  will  u s e   th e  ar ch itectu r es  o f   m o d els  f o r   s p am   class if icatio n ,   b u t  s in ce   we  h av e   th r ee   class es   in   th e  d ataset,   f o r   ea ch   o f   th e  n etwo r k s ,   we  n ee d   to   ch an g e  th e  o u tp u t  lay er   an d   th e  lo s s   f u n ctio n .   As  th e  o u t p u t  lay e r ,   we  u s ed   a  d en s e  co n n ec ted   lay er   with   o n e  n e u r o n   an d   a   lo g is tic  ac tiv atio n   f u n ctio n ,   t h u s   o b tain in g   th e  p r o b ab ilit y   o f   a n   o b ject  b el o n g i n g   to   th e  tar g et  class .   Af ter   m ak in g   ch a n g es to   th e   ar ch itectu r e,   we  will  tr ain   d e ep   lear n in g   m o d els  an d   d em o n s tr ate  th e  lo s s   an d   ac cu r ac y   g r ap h .   Fig u r e  1 1   d em o n s tr ates  ac cu r ac y   a n d   lo s s   p lo t  f o r   th e  L STM - b ased   m o d el.   Fig u r e  1 2   d em o n s tr ate s   ac cu r ac y   an d   lo s s   p lo t f o r   th e  C NN - b ased   m o d el   Evaluation Warning : The document was created with Spire.PDF for Python.
                      I SS N :   2 0 8 8 - 8 7 0 8   I n t J E lec  &   C o m p   E n g ,   Vo l.   15 ,   No .   3 ,  J u n e   20 25 :   3 3 9 6 - 3 4 0 9   3404       Fig u r e  1 1 .   Acc u r ac y   an d   l o s s   p lo t f o r   th e  L STM - b ased   m o d el           Fig u r e  1 2 .   Acc u r ac y   an d   l o s s   p lo t f o r   th e  C NN - b ased   m o d el       T o   an aly ze   th e   ac cu r ac y   o f   th e  m o d els,  we   will  ap p ly   a  c o n f u s io n   m atr ix .   Fig u r e   1 3   d e m o n s tr ates  co n f u s io n   m atr ices  f o r   L ST M  Fig u r e  1 3 ( a )   an d   C NN  Fi g u r e  1 3 ( b ) .   T h e  r esu lts   o f   th e  co n f u s io n   m atr ices  allo w  u s   to   u n d er s tan d   th e  p e r f o r m a n ce   o f   th e  m o d els.  B o th   m o d els  m ak e  th e  m o s t  er r o r s   wh en   class if y in g   h ate  s p ee ch ,   o f ten   m is tak in g   it  f o r   o f f en s iv e  lan g u ag e.   Sp ec if ically ,   th e  ac cu r ac y   in   class if y in g   p o s ts   co n tain in g   h ate  s p ee ch   is   lo wer   th an   th e   ac cu r ac y   in   cla s s if y in g   p o s ts   co n tain in g   o f f en s iv e  lan g u a g e  o r   “n o r m al”   p o s ts .   T h e   m o d els  p er f o r m   b est  at  d is tin g u is h in g   o f f e n s iv e  lan g u ag e   f r o m   r eg u lar   p o s ts .   Ov er all,   co n s id er in g   all  er r o r   v alu es,  it  ca n   b e  co n clu d ed   th at  th is   im p lem en tatio n   o f   th e  c o n v o lu ti o n al  n eu r al  n etwo r k   h an d les th e  task   b etter   th a n   th e  lo n g   s h o r t - ter m   m e m o r y   n et wo r k .           ( a)   ( b )     Fig u r e  1 3 .   C o n f u s io n   m atr ices f o r   ( a )   L STM   an d   ( b )   C NN      Evaluation Warning : The document was created with Spire.PDF for Python.
I n t J E lec  &   C o m p   E n g     I SS N:   2088 - 8 7 0 8         A r tifi cia l in tellig en ce   fo r   a u to ma tic  mo d era tio n   o f te xtu a l c o n ten t …   ( S o l o miia   Lia s ko vska )   3405   L e t' s   c o m p u t e   t h e   m et r i cs   o f   th e   m o d e l s   f o r   e a c h   c l a s s   f o r   c o m p a r i s o n ,   a n d   w e   c a n   s e e   t h e   r e s u l ts   i n   T a b l e s   1   a n d   2 .   T h es e   t a b l es  p r e s e n t  t h e   p e r f o r m a n c e  o f   th e   L S T M  a n d   C N N  m o d e l s   a c r o s s   h a t e  s p e e c h ,   o f f e n s i v e   l a n g u a g e ,   a n d   r e g u la r   p o s t s .   T a b l e   3   f u r t h e r   d e m o n s t r a t es   t h e   cl as s i f i c a ti o n   m et r i c s   f o r   t h e   B E R T - b a s e d   m o d e l ,   a ll o w i n g   f o r   a   c o m p r e h e n s i v e   c o m p a r i s o n   a m o n g   a l l   t h r e e   a p p r o a c h e s .   T a b l e   1   s h o w s   m et r i cs   f o r   e a c h   c l as s   o f   p u b l i c at i o n   f o r   t h e   L S T M   m o d e l .   T a b l e   2   s h o ws  f o r   e a c h   c l a s s   f o r   p u b l i c a ti o n   f o r   t h e   C NN   m o d e l .       T ab le  1 .   Me tr ics f o r   ea ch   class   o f   p u b licatio n s   f o r   th e  L STM   m o d el     A c c u r a c y - sc o r e   P r e c i s i o n - sc o r e   R e c a l l   F1 - sc o r e   H a t e   sp e e c h   0 . 7 5   0 . 7 8   0 . 6 2   0 . 6 9   O f f e n si v e   l a n g u a g e   0 . 7 5   0 . 8   0 . 7 1   0 . 7 5   R e g u l a r   p o st s   0 . 7 5   0 . 8   0 . 7 4 5   0 . 7 7       T ab le  2 .   Me tr ics f o r   ea ch   class   o f   p u b licatio n s   f o r   th e  C NN  m o d el     A c c u r a c y - sc o r e   P r e c i s i o n - sc o r e   R e c a l l   F1 - sc o r e   H a t e   sp e e c h   0 . 7 6   0 . 7 2   0 . 6 8   0 . 7 0   O f f e n si v e   l a n g u a g e   0 . 7 6   0 . 8 2   0 . 7 4   0 . 7 8   R e g u l a r   p o st s   0 . 7 6   0 . 8 1   0 . 8 1   0 . 8 1       T ab le  3 .   Me tr ics f o r   ea ch   class   o f   p u b licatio n s   f o r   th e  m o d el  b ased   o n   B E R T     A c c u r a c y - S c o r e   P r e c i s i o n - sc o r e   R e c a l l   F1 - sc o r e   H a t e   sp e e c h   0 . 3   0 . 3 3   0 . 3   0 . 3 1   O f f e n si v e   l a n g u a g e   0 . 3   0 . 3 5   0 . 3 2   0 . 3 3   R e g u l a r   p o st s   0 . 3   0 . 3 2   0 . 3 3   0 . 3 2       T h e  p r o p o s ed   ar ch itectu r e   b a s ed   o n   B E R T   f ield s   r at h er   p o o r   r esu lts .   W e  ca n   ass u m e  t h at  th is   is   r elate d   to   th e   n o n lin ea r ity   o f   d ep en d e n cies  in   tex tu al   d ata  s in ce   o u r   n etwo r k   is   ess en tially   eq u iv alen t   to   a   lin ea r   m o d el  with   a  s in g le  E m b ed d in g   lay er .   I n   th e  co n tex t  o f   s p am   d etec tio n ,   a  c o m p ar ativ e  s tu d y   was  co n d u cte d   f o r   lin ea r   m o d els,   d ee p   n eu r al  n etwo r k s ,   a n d   s in g le - lay er   m o d els  u s in g   th e   p r e - tr ain e d   B E R T   n etwo r k .   A d d itio n al  d atasets   wer e  cr ea ted   f o r   d if f er en t   tex t   r ep r esen tatio n   tech n iq u es,  n a m ely   b ag - of - w o r d s ,   n - g r am s ,   a n d   TF - I DF .   As  a  r e s u lt,  th r ee   p air s   o f   lo g is tic  r eg r ess io n   an d   s u p p o r t  v ec to r   m a ch in e  m o d els  wer e   tr ain ed .   All  m o d els  ac h iev ed   r ea s o n ab ly   h ig h   o v er all  ac c u r ac y ,   with   lo g is tic  r eg r ess io n   p er f o r m in g   b etter   in   id en tify in g   s p am   f o r   th e  s tan d ar d   b ag - of - w o r d s ,   wh ile  th e  s u p p o r t  v ec to r   m ac h i n e  h ad   h ig h er   m etr ics  f o r     TF - I DF .   T h e  lo west  o v er all  ac cu r ac y   was  o b s er v e d   f o r   th e  TF - I DF   d ata  f o r m at,   alth o u g h   t h e  g ap   i n   all  m etr ics  f o r   th e  th r ee   d atasets   is   n o t  s ig n if ican t.  Dee p   m o d el s   an d   th e  B E R T - b ased   m o d el  wer e  th en   tr ain ed .   T h e  co n v o lu tio n al  n eu r al  n etwo r k   m o d el  d em o n s tr ated   th e  h i g h est ac cu r ac y   with   a   v alu e  o f   0 . 9 5 .   Fo r   th e  class if icatio n   o f   h ate   s p ee ch   an d   o f f en s iv e  lan g u ag e,   we  u s ed   th e  s am e  n eu r al  n etwo r k   ar ch itectu r es  as  f o r   s p am ,   a d ap tin g   th eir   o u tp u t  lay e r   f o r   m u lti - class   class if icat io n   task s .   Ag ain ,   th e  co n v o l u tio n al  n e u r al  n etwo r k   ac h iev ed   t h e  h ig h est  ac cu r ac y   -   0 . 7 6 ,   wh ile  th e  B E R T - b a s ed   m o d el  s h o wed   v er y   lo w  r esu lts   -   0 . 3 .       4.   CO NCLU SI O N   T h e  m ain   tech n iq u es  f o r   r ep r e s en tin g   tex t  in   n u m er ical  f o r m at  f o r   m ac h in e  lear n in g   alg o r it h m s   wer e  in v esti g ated ,   an aly zin g   th eir   c h ar ac ter is tics ,   wo r k in g   p r in ci p les,  ad v an tag es,  a n d   d is ad v a n tag es.  T h e  m eth o d   o f   wo r d   v ec to r   r e p r esen tatio n   u s in g   n e u r al  n etwo r k s ,   ex em p lifie d   b y   th e   wo r d 2 v ec   m o d el,   was  d etailed .   Fo r   th e  ch o s en   lin ea r   m o d els — lo g is tic  r eg r ess io n   an d   s u p p o r t  v ec to r   m ac h in es — an   ex p lan at io n   o f   th eir   wo r k i n g   p r in cip les  an d   m ath em atica l  f o u n d atio n s   was  p r o v id e d .   T h e   d escr ip tio n   o f   co n v o lu tio n al  n eu r al  n etwo r k s   an d   th e  lo n g   s h o r t - ter m   m e m o r y   m eth o d   in clu d ed   th ei r   b asic  ar ch itectu r al  co m p o n e n ts ,   o p er atio n al  p r in ci p les,   an d   tr ain in g   p r o ce s s es.  T h e  s p ec if icity   o f   u s in g   c o n v o lu tio n a l la y er s   f o r   tex t u al  d ata  was a ls o   d is cu s s ed .   A  d ataset  was  s elec ted   f o r   ea ch   class if icatio n   task .   T h e  r ese ar ch   wo r k   in clu d es  a  d etailed   d escr ip tio n   o f   th e   d ata   p r ep r o ce s s in g   an d   f ea tu r e  e x tr ac tio n   p r o ce s s   u s in g   v ar io u s   m eth o d s .   C o r r esp o n d in g   im p lem en tatio n s   o f   m ac h in e   lear n in g   alg o r ith m s   wer e  tr ain ed   f o r   ea c h   d ataset,   an d   m o d el  p er f o r m a n ce   r esu lts   wer e  d em o n s tr ated .   I t   was  f o u n d   th at  lo g is tic  r eg r ess io n   an d   s u p p o r t  v ec to r   m a ch in es  ca n   class if y   s p am   with   h ig h   ac c u r ac y ,   an d   d if f er e n t  d ata  r ep r esen tatio n s   m in im ally   af f ec t  th e   m o d el  r esu lts .   Fro m   th e  r esear ch   f in d in g s ,   it  was  co n clu d ed   th at  d etec tin g   s p am   in   m ess ag es  is   wea k ly   d ep en d e n t  o n   th e  s em an tic   co n ten t o f   th e  tex t; f r eq u e n tly   u s ed   wo r d s   ca n   b e  cr u cial  i n d i ca to r s   o f   s p am .       Evaluation Warning : The document was created with Spire.PDF for Python.