<commit_before>#!/usr/bin/ruby
require File.dirname(__FILE__)+'/../lib/rubyss'
ds=RubySS::CSV.read(File.dirname(__FILE__)+"/sample_test.csv")

fp=File.new(File.dirname(__FILE__)+"/item_analysis/Analisis.html","w")

[['general', (1..23)], ['word',(24..61)], ['excel',(62..82)], ['pp',(83..92)],['internet',(93..101)]].each{|dim,range|
ds2={}

    fp.puts("<h1>Dimension: #{dim}</h1>")
    
    range.each {|v|

    ds2["p"+v.to_s]=ds['p'+v.to_s].recode{|c|
        c.nil? ? nil : c.to_f
    }
    ds2["p"+v.to_s].type=:scale
}

a= RubySS::Reliability::ItemAnalysis.new(ds2.to_dataset)

fp.puts(a.html_summary)
a.svggraph_item_characteristic_curve(File.dirname(__FILE__) + "/item_analysis",dim)
range.each{|v|
    fp.puts("<p><img src='#{dim}_p#{v}.svg' /></p>\n")
}
}

fp.close
<commit_msg>Create directory for item_analysis on demo<commit_after>#!/usr/bin/ruby
require File.dirname(__FILE__)+'/../lib/rubyss'
require 'fileutils.rb'
ds=RubySS::CSV.read(File.dirname(__FILE__)+"/sample_test.csv")
FileUtils::mkdir_p(File.dirname(__FILE__)+"/item_analysis")
fp=File.new(File.dirname(__FILE__)+"/item_analysis/Analisis.html","w")

[['general', (1..23)], ['word',(24..61)], ['excel',(62..82)], ['pp',(83..92)],['internet',(93..101)]].each{|dim,range|
ds2={}

    fp.puts("<h1>Dimension: #{dim}</h1>")
    
    range.each {|v|

    ds2["p"+v.to_s]=ds['p'+v.to_s].recode{|c|
        c.nil? ? nil : c.to_f
    }
    ds2["p"+v.to_s].type=:scale
}

a= RubySS::Reliability::ItemAnalysis.new(ds2.to_dataset)

fp.puts(a.html_summary)
a.svggraph_item_characteristic_curve(File.dirname(__FILE__) + "/item_analysis",dim)
range.each{|v|
    fp.puts("<p><img src='#{dim}_p#{v}.svg' /></p>\n")
}
}

fp.close

{'fraction_non_alphanumeric': 0.2616933096506809, 'fraction_numerical': 0.03078744819419775, 'mean_word_length': 5.057347670250896, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5681821', 'n_tokens_mistral': 775, 'n_tokens_neox': 724, 'n_words': 68}