<commit_before>use v6;

use NativeCall;

my class X::InvalidAudioFile is Exception {
	has $.file;
	has $.text;
	method message() {
		"Failed to parse file $.file: $.text"
	}
}

my constant taglib = 'libtag_c';

class Audio::Taglib::Simple {
	has $.file is readonly;
	has $.taglib-file is readonly;
	has $!taglib-tag;
	has $!taglib-audio;

	has Str $!title;
	has Str $.artist is readonly;
	has Str $.album is readonly;
	has Str $.comment is readonly;
	has Str $.genre is readonly;
	has Int $.year is readonly;
	has Int $.track is readonly;
	has Duration $.length is readonly;
	has Int $.bitrate is readonly;
	has Int $.samplerate is readonly;
	has Int $.channels is readonly;

	#= Open the provided file to read its tags.
	multi method new(Str $file) {
		self.new(file => $file.IO);
	}

	#= Open the provided file to read its tags.<commit_msg>The NativeCall no longer needs the prefix and prefers a version<commit_after>use v6;

use NativeCall;

my class X::InvalidAudioFile is Exception {
	has $.file;
	has $.text;
	method message() {
		"Failed to parse file $.file: $.text"
	}
}

my constant taglib = ('tag_c', v0);

class Audio::Taglib::Simple {
	has $.file is readonly;
	has $.taglib-file is readonly;
	has $!taglib-tag;
	has $!taglib-audio;

	has Str $!title;
	has Str $.artist is readonly;
	has Str $.album is readonly;
	has Str $.comment is readonly;
	has Str $.genre is readonly;
	has Int $.year is readonly;
	has Int $.track is readonly;
	has Duration $.length is readonly;
	has Int $.bitrate is readonly;
	has Int $.samplerate is readonly;
	has Int $.channels is readonly;

	#= Open the provided file to read its tags.
	multi method new(Str $file) {
		self.new(file => $file.IO);
	}

	#= Open the provided file to read its tags.
{'fraction_non_alphanumeric': 0.11917098445595854, 'fraction_numerical': 0.0017271157167530224, 'mean_word_length': 3.6470588235294117, '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': '7119057', 'n_tokens_mistral': 594, 'n_tokens_neox': 580, 'n_words': 238}