nl_tokens: Returns a group with the top verbs . activities - All activities count - How many verbs to show Returns a list of top verbs plus other
pl_tokens: function topVerbs ( activities , <mask> ) { var counts = { } , list = [ ] , top ; for ( var i in activities ) { var verb = activities [ i ] . verb ; counts [ verb ] = ( counts [ verb ] || 0 ) + 1 ; } for ( key in counts ) list . push ( { key : key , values : counts [ key ] } ) ; top = list . sort ( function ( a , b ) { return b . values - a . values } ) . slice ( 0 , count ) . map ( function ( verb ) { return verb . key } ) . concat ( "other" ) ; // Make sure all verbs are showing by default. verbsShowing = top . reduce ( function ( showing , verb ) { showing [ verb . key ] = verbsShowing [ verb ] ; if ( showing [ verb ] == undefined ) showing [ verb ] = true ; return showing ; } , { } ) ; return top ; }