Finds the experts in a Lotus Domino forum.
It ranks posters by the number of posts and preferrentially for responses to threads that they didn't start. The theory is that experts aren't going to post root level threads so often but will be highly present in responses to other's threads. It only displays the top ten percent of the authors,
use strict; use warnings; use Notes::OLE; use List::Util qw( max min ); use vars qw( %AUTHORS %PARENTS %FROM ); $| = 1; main( @ARGV ); exit 0; sub main { my $db = $S->GetDatabase( $_[0] || 'Notes1/NotesWeb', $_[1] || 'ei +forum' ); my $count = 0; dc_all( $db->AllDocuments, sub { my $doc = shift; my $unid = $doc->UniversalID; my $from = abbrev( $doc->{'From'}[0] ); $FROM{ $unid } = $from; { my $children = $doc->Responses; if ( $children->Count ) { dc_all( $children, sub { my $parent = $_[0]->{'$REF'}[0]; $PARENTS{ $_[0]->UniversalID } = $parent } ); } } push @{ $AUTHORS{ $from } }, $unid; } ); my %author_scores; for my $author ( keys %AUTHORS ) { my $score = 0; for my $node ( @{ $AUTHORS{ $author } } ) { $score += ( root_node( $node ) eq $node ? 2 : 1 ); } $author_scores{ $author } = $score; } for my $author ( reverse +( sort { $author_scores{$a} <=> $author_scores{$b} } keys %author_scores )[ keys( %author_scores ) +* .9 .. keys( %author_scores ) +- 1 ] ) { printf "% 4d $author\n", $author_scores{ $author }; } 0; } sub root_node { my $unid = shift; while ( exists $PARENTS{ $unid } ) { $unid = $PARENTS{ $unid }; } $unid; } sub abbrev { my $name = shift; $name =~ s/(?<!\w)(?:CN|OU?)=//g; $name; }
In reply to Compute "experts" on Lotus Domino forums by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |