<commit_before>class Repositext
  class RFile

    # Contains code that is specific to Content AT files
    module ContentAtMixin

      def compute_similarity_with_corresponding_primary_file
        Kramdown::TreeStructuralSimilarity.new(
          corresponding_primary_file.kramdown_doc,
          kramdown_doc
        ).compute
      end

      def corresponding_subtitle_markers_csv_file
        self.class.new(
          File.read(corresponding_subtitle_markers_csv_filename),
          language,
          corresponding_subtitle_markers_csv_filename,
          repository
        )
      end

      def corresponding_subtitle_markers_csv_filename
        filename.sub(/\.at\z/, '.subtitle_markers.csv')
      end

      def kramdown_doc
        Kramdown::Document.new(
          contents,
          is_primary_repositext_file: is_primary_repo,
          input: 'KramdownVgr',
          line_width: 100000, # set to very large value so that each para is on a single line
        )
      end

      # Returns subtitles
      # @return [Array<Subtitle>]
      def subtitles
        Repositext::Subtitle::ExtractFromStmCsvFile.new(
          corresponding_subtitle_markers_csv_file
        ).extract
      end

    end
  end
end<commit_msg>Updated RFile#corresponding_subtitle_markers_csv_file to return nil if it doesn’t exist. This allows us to return an empty array for RFile#subtitles.<commit_after>class Repositext
  class RFile

    # Contains code that is specific to Content AT files
    module ContentAtMixin

      def compute_similarity_with_corresponding_primary_file
        Kramdown::TreeStructuralSimilarity.new(
          corresponding_primary_file.kramdown_doc,
          kramdown_doc
        ).compute
      end

      # Returns the corresponding subtitle markers csv file or nil if it
      # doesn't exist
      def corresponding_subtitle_markers_csv_file
        return nil  if !File.exist?(corresponding_subtitle_markers_csv_filename)
        self.class.new(
          File.read(corresponding_subtitle_markers_csv_filename),
          language,
          corresponding_subtitle_markers_csv_filename,
          repository
        )
      end

      def corresponding_subtitle_markers_csv_filename
        filename.sub(/\.at\z/, '.subtitle_markers.csv')
      end

      def kramdown_doc
        Kramdown::Document.new(
          contents,
          is_primary_repositext_file: is_primary_repo,
          input: 'KramdownVgr',
          line_width: 100000, # set to very large value so that each para is on a single line
        )
      end

      # Returns subtitles
      # @return [Array<Subtitle>]
      def subtitles
        return []  if (csmcf = corresponding_subtitle_markers_csv_file).nil?
        Repositext::Subtitle::ExtractFromStmCsvFile.new(csmcf).extract
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.053172633817795106, 'fraction_numerical': 0.004253810705423609, 'mean_word_length': 2.518703241895262, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3618423', 'n_tokens_mistral': 848, 'n_tokens_neox': 799, 'n_words': 182}