<commit_before>
namespace :comparison do
  desc "report on differences in items tagged as reported by rummager and contentapi"
  task :run => :environment do
    require 'csv'

    # Generates 2 CSV files reporting differences between the contentapi and
    # rummager views on the content items tagged to a given topic or
    # mainstream_browse_page
    #
    # rumager-missing.csv will contain a list of content items that are present
    # for a tag in contentapi, but not in rummager, along with the tag in question.<commit_msg>Fix the comparison task<commit_after>
namespace :comparison do
  desc "report on differences in items tagged as reported by rummager and contentapi"
  task :run => :environment do
    require 'csv'
    require 'gds_api/content_api'
    CollectionsPublisher.services(:content_api, GdsApi::ContentApi.new(Plek.new.find('content_api')))

    # Generates 2 CSV files reporting differences between the contentapi and
    # rummager views on the content items tagged to a given topic or
    # mainstream_browse_page
    #
    # rumager-missing.csv will contain a list of content items that are present
    # for a tag in contentapi, but not in rummager, along with the tag in question.
{'fraction_non_alphanumeric': 0.05363036303630363, 'fraction_numerical': 0.0016501650165016502, 'mean_word_length': 3.8714859437751006, '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': '6777523', 'n_tokens_mistral': 335, 'n_tokens_neox': 318, 'n_words': 150}