<commit_before># Configuration module
module Biotags
  # Update @config
  def biotags_update
    # Fetch twitter description and grab its biotags
    if match_data = user.description.match(/@_dbooks/i)
      config match_data.post_match
    end
  end

  # Create an OpenStruct from parsing input string, if one is given
  def config(biotag_string = nil)
    # Return config if no string is given, or if string is identical to last one.
    # If config isn't defined, re-call this method with an empty string.
    return @config || config('') if biotag_string.nil?
    return @config if biotag_string == @biotag_string_previous

    # Save string for comparison next time
    @biotag_string_previous = biotag_string

    # Parse it.
    @config = biotags_parse "#{CONFIG_DEFAULT} #{@initialization_config} #{biotag_string}"
  end

  # Parses uris out of user descriptions, if there are any
  def biotags_parse_uri(text)
    # Return unless this is actually a string.
    return text unless text.is_a? String

    # Return unless user stuff is available
    return text unless user.is_a? Twitter::User
    return text unless user.description_uris?

    # Loop through uris we know about
    user.description_uris.each do |uri|
      text = text.gsub uri.url.to_s, uri.expanded_url.to_s
    end

    text
  end

  # Parse a biotag string into a openstruct.
  def biotags_parse(tag_string)
    # Create new openstruct
    ostruct = OpenStruct.new
    # Create a tags array to hold tags for now
    tags_array = []

    tag_string.split(' ').each do |item|<commit_msg>Removed unnecessary check<commit_after># Configuration module
module Biotags
  # Update @config
  def biotags_update
    # Fetch twitter description and grab its biotags
    if match_data = user.description.match(/@_dbooks/i)
      config match_data.post_match
    end
  end

  # Create an OpenStruct from parsing input string, if one is given
  def config(biotag_string = nil)
    # Return config if no string is given, or if string is identical to last one.
    # If config isn't defined, re-call this method with an empty string.
    return @config || config('') if biotag_string.nil?
    return @config if biotag_string == @biotag_string_previous

    # Save string for comparison next time
    @biotag_string_previous = biotag_string

    # Parse it.
    @config = biotags_parse "#{CONFIG_DEFAULT} #{@initialization_config} #{biotag_string}"
  end

  # Parses uris out of user descriptions, if there are any
  def biotags_parse_uri(text)
    # Return unless this is actually a string.
    return text unless text.is_a? String

    # Return unless user stuff is available
    return text unless user.is_a? Twitter::User

    # Loop through uris we know about
    user.description_uris.each do |uri|
      text = text.gsub uri.url.to_s, uri.expanded_url.to_s
    end

    text
  end

  # Parse a biotag string into a openstruct.
  def biotags_parse(tag_string)
    # Create new openstruct
    ostruct = OpenStruct.new
    # Create a tags array to hold tags for now
    tags_array = []

    tag_string.split(' ').each do |item|
{'fraction_non_alphanumeric': 0.0685640362225097, 'fraction_numerical': 0.0, 'mean_word_length': 3.2958333333333334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2795027', 'n_tokens_mistral': 964, 'n_tokens_neox': 934, 'n_words': 341}