🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #232253

regEx scoring is too simple for me, it can't sort like this ..

#232253
From: Jeffâ–˛Relf
Date: Sun, 05 Apr 2009 20:38
91 lines
4849 bytes
“ You should learn more about score-files. ”,
you told yourself, using me as a proxy for you.

regEx scoring is too simple for me, it can't sort like this:

  A. Direct and inDirect ( up to 5 levels away ) unRead replies to me.
     No one is ever plonked, I see  All  replies to me.
     
  B. Posts from nyms that have unRead posts
     ( posts are grouped by nym ).

  C. Posts from “ Watched ” nyms ( again, posts are grouped by nym ).
     Only Watched nyms aren't muffled;
     muffled nyms can't have more than 3 unRead posts.
     
     I keep no more than 33 “ wasRead ” posts per nym.

  D. Posts from nyms with the highest XRank; e.g. posts from
     those who “ the watchedNyms and I ” replied to the most.
     xRanking is explained at my webSite, “ www.JeffRelf.F-M.FM ”.

To sort as outlined above, you need code like this:
[ from “ www.JeffRelf.F-M.FM/X.CPP ”, Visual C++ 9 ]

//  “ Case ” is the post that's being scored;
//  “ Vs ” is the post “ Case ” is being compared against.
//  Lower numbers ( e.g. larger negative numbers ) come first.
inline double Cmp( LsP  Case, LsP  Vs ) {

  //  There are 3 Catagories ( Cat ): “ Top·0, Middle·1, Bottom·2 ”.
  //  “ Top ” has replies to me, “ Bottom ” has posts I made;
  //  the rest are in “ Middle ”.
  if ( Case->Cat != Vs->Cat )
    //  “ Case ” goes up the list ( e.g. has a larger negative number )
    //  when “ Vs ” has a higher “ Cat ”.
    return  Case->Cat - Vs->Cat ;
    
  NymT & caseNym = * Case->Nym, & vsNym = * Vs->Nym ;
  if ( Case->Cat == Cat_Mid && & caseNym != & vsNym ) {
    //  Both Case and Vs are in Cat_Mid and
    //  they don't have the same nym.
    
    if ( !vsNym.cnt·unReads != !caseNym.cnt·unReads )
      //  Case goes up the list when it has unReads and Vs doesn't.
      return  !caseNym.cnt·unReads - !vsNym.cnt·unReads ;

    if ( caseNym.XRank == vsNym.XRank )

      //  Case and Vs have the same xRank.
      //  Case goes up the list when Vs' nym hasn't posted as recently.
    
      //  This groups posts by nym because
      //  no two nyms have the same xRank  And  the same DaysAgoLatest.
      //  DaysAgoLatest is a float with a one second resolution.
      return  caseNym.DaysAgoLatest - vsNym.DaysAgoLatest ;
      
    //  Case goes up when it has a higher xRank.
    return  vsNym.XRank - caseNym.XRank ;
  }
  
  if ( Case->Cat == Cat_Bot )

    //  Case and Vs are in Cat_Bot ( i.e. they're posts I've made ).
    //  Sort by oldest first,
    //  so my most recent post is at the very bottom.

    //  Case goes up when it's older.
    return Vs->AgeDays - Case->AgeDays ;
    
  //  Case and Vs either “ have the same nym and are in Cat_Mid ”
  //  or they're both in Cat_Top, possibly with differnt nyms.

  if ( Case->wasRead != Vs->wasRead )

    //  Both are in Cat_Mid, with the same nym,
    //  because Cat_Top has no wasReads.
    //  Case goes up when it's unRead and Vs isn't.
    return  Case->wasRead - Vs->wasRead ;
    
  //  Sort by youngest first, Case goes up when Vs is older.
  return  Case->AgeDays - Vs->AgeDays ;  }

//  This “ Quick Sorts ” posts using Cmp() ( above ).
ByCatXRankNymVistdAge( LsA _B,  LsA _E ) {  if ( _E <= _B ) return;
  LsA  BB = _B - 1, EE = _E + 1 ;  LsP  Std = _B [ ( _E - _B ) / 2 ] ;
  LOOP {
    while ( Cmp( * ++ BB , Std ) < 0. );
    while ( EE >= BB && Cmp( * -- EE , Std ) > 0. );
    if ( EE <= BB ) break;  LsP T = * BB ; * BB = * EE ; * EE = T ;  }
  ByCatXRankNymVistdAge ( _B, EE < _E ? EE : -- EE );  
  ByCatXRankNymVistdAge ( EE + 1, _E ); }
Technical Details
Message-ID: <Jeff_Relf@Seattle.2009_Apr.5|1.38pm|a>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <MPG.244206e0f37bfa79989747@news.individual.net> <Jeff_Relf@Seattle.2009_Apr.5|6.12am|T> <Jeff_Relf@Seattle.2009_Apr.5|6.21am|T> <slrngthdhn.83q.catwheezel@ID-107770.user.individual.net> <Jeff_Relf@Seattle.2009_Apr.5|8.18am|h> <slrngthmb3.83q.catwheezel@ID-107770.user.individual.net>

Show Full Headers
Complete Article Headers
Message-ID: <Jeff_Relf@Seattle.2009_Apr.5|1.38pm|a>
Subject: regEx scoring is too simple for me, it can't sort like this ..
Date: Sun, 05 Apr 2009 20:38:32 +0000
From: Jeffâ–˛Relf <Jeff_Relf@Seattle.inValid>
References: <MPG.244206e0f37bfa79989747@news.individual.net> <Jeff_Relf@Seattle.2009_Apr.5|6.12am|T> <Jeff_Relf@Seattle.2009_Apr.5|6.21am|T> <slrngthdhn.83q.catwheezel@ID-107770.user.individual.net> <Jeff_Relf@Seattle.2009_Apr.5|8.18am|h> <slrngthmb3.83q.catwheezel@ID-107770.user.individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Lines: 91
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 3wkDFv1LMHGRMN5GCz5UigxSe0g8qv2yukLrtvYTxB2pqYDmDn
Cancel-Lock: sha1:RPg0n3jk/gnMMKwAXGazLcZh8D0=
User-Agent: JeffRelf.F-M.FM/X.ZIP