|
|
@@ -0,0 +1,54 @@
|
|
|
+module Docs
|
|
|
+ class ScikitLearn
|
|
|
+ class EntriesFilter < Docs::EntriesFilter
|
|
|
+ def get_name
|
|
|
+ # Classes, functions and methods
|
|
|
+ if subpath.start_with?('modules/generated')
|
|
|
+ name = at_css('dt').content.strip
|
|
|
+ name.sub! %r{\(.*}, '()' # Remove function arguments
|
|
|
+ name.remove! %r{[\=\[].*} # Remove [source] anchor
|
|
|
+ # name.remove! %r{\s=.*} # Remove the occasional '=' in class names
|
|
|
+ name.remove! %r{\A(class(method)?) (sklearn\.)?}
|
|
|
+ else
|
|
|
+ # User guide
|
|
|
+ name = at_css('h1').content.strip
|
|
|
+ end
|
|
|
+
|
|
|
+ name.remove! "\u{00B6}"
|
|
|
+ name
|
|
|
+ end
|
|
|
+
|
|
|
+ def get_type
|
|
|
+ # Classes, functions and methods
|
|
|
+ if subpath.start_with?('modules/generated')
|
|
|
+ type = at_css('dt > .descclassname').content.strip
|
|
|
+ type.remove! 'sklearn.'
|
|
|
+ type.remove! '.'
|
|
|
+ type
|
|
|
+ else
|
|
|
+ 'Guide'
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ def additional_entries
|
|
|
+ entries = []
|
|
|
+
|
|
|
+ css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node|
|
|
|
+ entries << [node['id'].remove('sklearn.'), node['id']]
|
|
|
+ end
|
|
|
+
|
|
|
+ css('.data > dt[id]').each do |node|
|
|
|
+ if node['id'].split('.').last.upcase! # skip constants
|
|
|
+ entries << [node['id'].remove('sklearn.'), node['id']]
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node|
|
|
|
+ entries << [node['id'].remove('sklearn.') + '()', node['id']]
|
|
|
+ end
|
|
|
+
|
|
|
+ entries
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|