<commit_before>module OntologyHelper

  def assay_type_select_tag form, element_id, selected_uri,html_options={}
    ontology_select_tag form, "assay",element_id, selected_uri,html_options
  end

  def technology_type_select_tag form, element_id, selected_uri,html_options={}
    ontology_select_tag form, "technology",element_id,selected_uri,html_options
  end


  def ontology_select_tag form,type,element_id,selected_uri,html_options={}
    reader = reader_for_type(type)
    classes = reader.class_hierarchy
    options = render_ontology_class_options classes
    form.select element_id,options,{:selected=>selected_uri},html_options
  end

  def render_ontology_class_options clz,depth=0
    result = [["--"*depth+clz.label,clz.uri.to_s]]
    clz.subclasses.each do |c|
      result += render_ontology_class_options(c,depth+1)
    end
    result

  end

  def reader_for_type type
    "Seek::Ontologies::#{type.capitalize}TypeReader".constantize.new
  end

end<commit_msg>fixed initialisation of ontology reader in ontology_helper, due to change to singleton<commit_after>module OntologyHelper

  def assay_type_select_tag form, element_id, selected_uri,html_options={}
    ontology_select_tag form, "assay",element_id, selected_uri,html_options
  end

  def technology_type_select_tag form, element_id, selected_uri,html_options={}
    ontology_select_tag form, "technology",element_id,selected_uri,html_options
  end


  def ontology_select_tag form,type,element_id,selected_uri,html_options={}
    reader = reader_for_type(type)
    classes = reader.class_hierarchy
    options = render_ontology_class_options classes
    form.select element_id,options,{:selected=>selected_uri},html_options
  end

  def render_ontology_class_options clz,depth=0
    result = [["--"*depth+clz.label,clz.uri.to_s]]
    clz.subclasses.each do |c|
      result += render_ontology_class_options(c,depth+1)
    end
    result

  end

  def reader_for_type type
    "Seek::Ontologies::#{type.capitalize}TypeReader".constantize.instance
  end

end
{'fraction_non_alphanumeric': 0.08710629921259842, 'fraction_numerical': 0.001968503937007874, 'mean_word_length': 5.643790849673203, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1052853', 'n_tokens_mistral': 689, 'n_tokens_neox': 659, 'n_words': 116}