<commit_before>require 'pathname'

module Vim
  module Flavor
    class FlavorFile
      # repo_name -> flavor
      def flavor_table
        @flavor_table ||= {}
      end

      def default_groups
        @default_groups ||= [:runtime]
      end

      def default_group
        default_groups.last
      end

      def self.load_or_new(flavorfile_path)
        ff = new()
        ff.load(flavorfile_path) if File.exists?(flavorfile_path)
        ff
      end<commit_msg>Warn from also FlavorFile::load_or_new<commit_after>require 'pathname'

module Vim
  module Flavor
    class FlavorFile
      # repo_name -> flavor
      def flavor_table
        @flavor_table ||= {}
      end

      def default_groups
        @default_groups ||= [:runtime]
      end

      def default_group
        default_groups.last
      end

      def self.load_or_new(flavorfile_path)
        # Note that flavorfile_path is assumed to be new name.
        new_path = Pathname.new(flavorfile_path).relative_path_from(Pathname.getwd())
        old_path = new_path.dirname() / 'VimFlavor'

        ff = new()

        if FileTest.file?(new_path)
          if FileTest.file?(old_path)
            Console::warn "Delete #{old_path}.  #{new_path} is being read instead."
          end
          ff.load(new_path.to_s)
        elsif if FileTest.file?(old_path)
          Console::warn "Rename #{old_path} to #{new_path}.  #{old_path} wll be ignored in future version."
          ff.load(old_path.to_s)
        else
          # Do nothing.  Assume no dependencies.
        end

        ff
      end
{'fraction_non_alphanumeric': 0.0852959898154042, 'fraction_numerical': 0.0, 'mean_word_length': 2.094488188976378, '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': '788794', 'n_tokens_mistral': 501, 'n_tokens_neox': 491, 'n_words': 114}