private static void cleanHeaders ( Element e ) { for ( int headerIndex = 1 ; headerIndex < 7 ; headerIndex ++ ) { Elements headers = getElementsByTag ( e , "h" + headerIndex ) ; for ( Element header : headers ) { if ( getClassWeight ( header ) < 0 || getLinkDensity ( header ) > 0.33f ) { header . remove ( ) ; } } } }
Clean out spurious headers from an Element . Checks things like classnames and link density .