<commit_before>/*
 * CPSegmentedControl.j
 * AppKit
 *
 * Created by <NAME>.
 * Copyright 2008, 280 North, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

import <Foundation/CPArray.j>

import "CPControl.j"

/*
    @global
    @group CPSegmentSwitchTracking
*/
CPSegmentSwitchTrackingSelectOne = 0;
/*
    @global
    @group CPSegmentSwitchTracking
*/
CPSegmentSwitchTrackingSelectAny = 1;
/*
    @global
    @group CPSegmentSwitchTracking
*/
CPSegmentSwitchTrackingMomentary = 2;

/*
    This class is a horizontal button with multiple
    segments.
*/
@implementation CPSegmentedControl : CPControl
{
    unsigned                _segmentCount;
    
    CPArray                 _segments;
    CPArray                 _selectedSegment;
    
    CPSegmentSwitchTracking _trackingMode;
    unsigned                _trackingSegment;
    BOOL                    _trackingHighlighted;
}

- (id)initWithFrame:(CGRect)aRect
{
    self = [super initWithFrame:aRect];
    
    if (self)
    {
        _segments = [];
        _selectedSegment = -1;
        
        _segmentCount = 0;
        
        _trackingMode = CPSegmentSwitchTrackingSelectOne;
    }
    
    return self;
}

/*
    Returns the tag of the selected segment.
*/
- (int)selectedTag
{
    return _segments[_selectedSegment].tag;
}

// Specifying the number of segments
/*
    Sets the number of segments in the button.
    @param aCount the number of segments on
    the button
*/
- (void)setSegmentCount:(unsigned)aCount
{
    if (_segmentCount == aCount)
        return;
        
    var height = CGRectGetHeight([self bounds]);
    
    if (_segmentCount < aCount)
    {
        var index = _segmentCount;
        
        for (; index < aCount; ++index)
        {
            _segments[index] = _CPSegmentMake();
            _segments[index].frame.size.height = height;
        }
    }
    else if (aCount < _segmentCount)
    {
        var index = aCount;
        
        for (; index < _segmentCount; ++index)
        {
            [_segments[index].imageView removeFromSuperview];
            [_segments[index].labelView removeFromSuperview];
            
            _segments[index] = nil;
        }
    }
    
    _segmentCount = aCount;
    
    if (_selectedSegment < _segmentCount)
        _selectedSegment = -1;
    
    [self tileWithChangedSegment:0];
}

/*
    Returns the number of segments in the button.
*/
- (unsigned)segmentCount
{
    return _segmentCount;
}

// Specifying Selected Segment
/*
    Selects a segment.
    @param aSegment the segment to select
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setSelectedSegment:(unsigned)aSegment
{
    // setSelected:forSegment throws the exception for us (if necessary)
    [self setSelected:YES forSegment:aSegment];
}

/*
    Returns the selected segment.
*/
- (unsigned)selectedSegment
{
    return _selectedSegment;
}

/*
    Selects the button segment with the
    specified tag.
*/
- (BOOL)selectSegmentWithTag:(int)aTag
{
    var index = 0;
    
    for (; index < _segmentCount; ++index)
        if (_segments[index].tag == aTag)
        {
            [self setSelectedSegment:index];
            
            return YES;
        }
    
    return NO;
}

// Specifying Tracking Mode

- (BOOL)isTracking
{

}

- (void)setTrackingMode:(CPSegmentSwitchTracking)aTrackingMode
{
    if (_trackingMode == aTrackingMode)
        return;
        
    _trackingMode = aTrackingMode;
    
    if (_trackingMode == CPSegmentSwitchTrackingSelectOne)
    {
        var index = 0,
            selected = NO;
        
        for (; index < _segmentCount; ++index)
            if (_segments[index].selected)
                if (selected)
                    [self setSelected:NO forSegment:index];
                else
                    selected = YES;
    }
    
    else if (_trackingMode == CPSegmentSwitchTrackingMomentary)
    {
        var index = 0;
        
        for (; index < _segmentCount; ++index)
            if (_segments[index].selected)
                [self setSelected:NO forSegment:index];
    }
}

/*
    Returns the control's tracking mode.
*/
- (CPSegmentSwitchTracking)trackingMode
{
    return _trackingMode;
}

// Working with Individual Segments
/*
    Sets the width of the specified segment.
    @param aWidth the new width for the segment
    @param aSegment the segment to set the width for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setWidth:(float)aWidth forSegment:(unsigned)aSegment
{
    _segments[aSegment].width = aWidth;
    
    [self tileWithChangedSegment:aSegment];
}

/*
    Returns the width for the specified segment.
    @param aSegment the segment to get the width for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (float)widthForSegment:(unsigned)aSegment
{
    return _segments[aSegment].width;
}

/*
    Sets the image for the specified segment.
    @param anImage the image for the segment
    @param aSegment the segment to set the image on
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setImage:(CPImage)anImage forSegment:(unsigned)aSegment
{
    var segment = _segments[aSegment];
    
    if (!anImage)
    {
        [segment.imageView removeFromSuperview];
        
        segment.imageView = nil;
    }
    
    else
    {
        if (!segment.imageView)
        {
            segment.imageView = [[CPImageView alloc] initWithFrame:CGRectMakeZero()];
            
            [self addSubview:segment.imageView];
        }
        
        [segment.imageView setImage:anImage];
        [segment.imageView setFrameSize:CGSizeMakeCopy([anImage size])];
    }
    
    segment.image = anImage;

    if (segment.width)
        [self drawSegment:aSegment highlight:NO];
    else
        [self tileWithChangedSegment:aSegment];
}

/*
    Returns the image for the specified segment
    @param aSegment the segment to obtain the image for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (CPImage)imageForSegment:(unsigned)aSegment
{
    return _segments[aSegment].image;
}

/*
    Sets the label for the specified segment
    @param aLabel the label for the segment
    @param aSegment the segment to label
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setLabel:(CPString)aLabel forSegment:(unsigned)aSegment
{
    var segment = _segments[aSegment];
    
    if (!aLabel || !aLabel.length)
    {
        [segment.labelView removeFromSuperview];
        
        segment.labelView = nil;
    }
    
    else
    {
        if (!segment.labelView)
        {
            segment.labelView = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
            
            [segment.labelView setFont:[self font]];
            
            [self addSubview:segment.labelView];
        }
        
        [segment.labelView setStringValue:aLabel];
        [segment.labelView sizeToFit];
    }
    
    _segments[aSegment].label = aLabel;
    
    if (segment.width)
        [self drawSegment:aSegment highlight:NO];
    else
        [self tileWithChangedSegment:aSegment];
}

/*
    Returns the label for the specified segment
    @param the segment to obtain the label for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (CPString)labelForSegment:(unsigned)aSegment
{
    return _segments[aSegment].label;
}

/*
    Sets the menu for the specified segment
    @param aMenu the menu to set
    @param aSegment the segment to set the menu on
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setMenu:(CPMenu)aMenu forSegment:(unsigned)aSegment
{
    _segments[aSegment].menu = aMenu;
}

/*
    Returns the menu for the specified segment.
    @param aSegment the segment to obtain the menu for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (CPMenu)menuForSegment:(unsigned)aSegment
{
    return _segments[aSegment].menu;
}

/*
    Sets the selection for the specified segment. If only one segment
    can be selected at a time, any other segment will be deselected.
    @param isSelected <code>YES</code> selects the segment. <code>NO</code> deselects it.
    @param aSegment the segment to set the selection for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setSelected:(BOOL)isSelected forSegment:(unsigned)aSegment
{
    var segment = _segments[aSegment];
    
    // If we're already in this state, bail.
    if (segment.selected == isSelected)
        return;
    
    segment.selected = isSelected;

    // We need to do some cleanup if we only allow one selection.
    if (isSelected)
    {
        var oldSelectedSegment = _selectedSegment;
        
        _selectedSegment = aSegment;
        
        if (_trackingMode == CPSegmentSwitchTrackingSelectOne && oldSelectedSegment != aSegment && oldSelectedSegment != -1)
        {
            _segments[oldSelectedSegment].selected = NO;

            [self drawSegmentBezel:oldSelectedSegment highlight:NO];
        }
    }
    
    if (_trackingMode != CPSegmentSwitchTrackingMomentary)
        [self drawSegmentBezel:aSegment highlight:NO];
}

/*
    Returns <code>YES</code> if the specified segment is selected.
    @param aSegment the segment to check for selection
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (BOOL)isSelectedForSegment:(unsigned)aSegment
{
    return _segments[aSegment].selected;
}

/*
    Enables/diables the specified segment.
    @param isEnabled <code>YES</code> enables the segment
    @param aSegment the segment to enable/disble
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setEnabled:(BOOL)isEnabled forSegment:(unsigned)aSegment
{
    _segments[aSegment].enabled = isEnabled;
}

/*
    Returns <code>YES</code> if the specified segment is enabled.
    @param aSegment the segment to check
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (BOOL)isEnabledForSegment:(unsigned)aSegment
{
    return _segments[aSegment].enabled;
}

/*
    Sets a tag for the specified segment.
    @param aTag the tag to set
    @param aSegment the segment to set the tag on
*/
- (void)setTag:(int)aTag forSegment:(unsigned)aSegment
{
    _segments[aSegment].tag = aTag;
}

/*
    Returns the tag for the specified segment.
    @param aSegment the segment to obtain the tag for
*/
- (int)tagForSegment:(unsigned)aSegment
{
    return _segments[aSegment].tag;
}

// Drawings
/*
    Draws the specified segment bezel
    @param aSegment the segment to draw the bezel for
    @param shouldHighlight <code>YES</code> highlights the bezel
*/
- (void)drawSegmentBezel:(int)aSegment highlgiht:(BOOL)shouldHighlight
{
}

/*
    Draws the specified segment
    @param aSegment the segment to draw
    @param shouldHighlight <code>YES</code> highlights the bezel
*/
- (void)drawSegment:(int)aSegment highlight:(BOOL)shouldHighlight
{
    var segment = _segments[aSegment],
            
        imageView = segment.imageView,
        labelView = segment.labelView,
        
        frame = segment.frame,
            
        segmentX = CGRectGetMinX(frame),
        segmentWidth = CGRectGetWidth(frame),
        segmentHeight = CGRectGetHeight(frame) - 1.0;
                    
    if (imageView && labelView)
    {
        var imageViewSize = [imageView frame].size,
            labelViewSize = [labelView frame].size,
            totalHeight = imageViewSize.height + labelViewSize.height,
            labelWidth = MIN(labelViewSize.width, width),
            y = (segmentHeight - totalHeight) / 2.0;<commit_msg>Fix typo in CPSegmentedControl.<commit_after>/*
 * CPSegmentedControl.j
 * AppKit
 *
 * Created by <NAME>.
 * Copyright 2008, 280 North, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

import <Foundation/CPArray.j>

import "CPControl.j"

/*
    @global
    @group CPSegmentSwitchTracking
*/
CPSegmentSwitchTrackingSelectOne = 0;
/*
    @global
    @group CPSegmentSwitchTracking
*/
CPSegmentSwitchTrackingSelectAny = 1;
/*
    @global
    @group CPSegmentSwitchTracking
*/
CPSegmentSwitchTrackingMomentary = 2;

/*
    This class is a horizontal button with multiple
    segments.
*/
@implementation CPSegmentedControl : CPControl
{
    unsigned                _segmentCount;
    
    CPArray                 _segments;
    CPArray                 _selectedSegment;
    
    CPSegmentSwitchTracking _trackingMode;
    unsigned                _trackingSegment;
    BOOL                    _trackingHighlighted;
}

- (id)initWithFrame:(CGRect)aRect
{
    self = [super initWithFrame:aRect];
    
    if (self)
    {
        _segments = [];
        _selectedSegment = -1;
        
        _segmentCount = 0;
        
        _trackingMode = CPSegmentSwitchTrackingSelectOne;
    }
    
    return self;
}

/*
    Returns the tag of the selected segment.
*/
- (int)selectedTag
{
    return _segments[_selectedSegment].tag;
}

// Specifying the number of segments
/*
    Sets the number of segments in the button.
    @param aCount the number of segments on
    the button
*/
- (void)setSegmentCount:(unsigned)aCount
{
    if (_segmentCount == aCount)
        return;
        
    var height = CGRectGetHeight([self bounds]);
    
    if (_segmentCount < aCount)
    {
        var index = _segmentCount;
        
        for (; index < aCount; ++index)
        {
            _segments[index] = _CPSegmentMake();
            _segments[index].frame.size.height = height;
        }
    }
    else if (aCount < _segmentCount)
    {
        var index = aCount;
        
        for (; index < _segmentCount; ++index)
        {
            [_segments[index].imageView removeFromSuperview];
            [_segments[index].labelView removeFromSuperview];
            
            _segments[index] = nil;
        }
    }
    
    _segmentCount = aCount;
    
    if (_selectedSegment < _segmentCount)
        _selectedSegment = -1;
    
    [self tileWithChangedSegment:0];
}

/*
    Returns the number of segments in the button.
*/
- (unsigned)segmentCount
{
    return _segmentCount;
}

// Specifying Selected Segment
/*
    Selects a segment.
    @param aSegment the segment to select
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setSelectedSegment:(unsigned)aSegment
{
    // setSelected:forSegment throws the exception for us (if necessary)
    [self setSelected:YES forSegment:aSegment];
}

/*
    Returns the selected segment.
*/
- (unsigned)selectedSegment
{
    return _selectedSegment;
}

/*
    Selects the button segment with the
    specified tag.
*/
- (BOOL)selectSegmentWithTag:(int)aTag
{
    var index = 0;
    
    for (; index < _segmentCount; ++index)
        if (_segments[index].tag == aTag)
        {
            [self setSelectedSegment:index];
            
            return YES;
        }
    
    return NO;
}

// Specifying Tracking Mode

- (BOOL)isTracking
{

}

- (void)setTrackingMode:(CPSegmentSwitchTracking)aTrackingMode
{
    if (_trackingMode == aTrackingMode)
        return;
        
    _trackingMode = aTrackingMode;
    
    if (_trackingMode == CPSegmentSwitchTrackingSelectOne)
    {
        var index = 0,
            selected = NO;
        
        for (; index < _segmentCount; ++index)
            if (_segments[index].selected)
                if (selected)
                    [self setSelected:NO forSegment:index];
                else
                    selected = YES;
    }
    
    else if (_trackingMode == CPSegmentSwitchTrackingMomentary)
    {
        var index = 0;
        
        for (; index < _segmentCount; ++index)
            if (_segments[index].selected)
                [self setSelected:NO forSegment:index];
    }
}

/*
    Returns the control's tracking mode.
*/
- (CPSegmentSwitchTracking)trackingMode
{
    return _trackingMode;
}

// Working with Individual Segments
/*
    Sets the width of the specified segment.
    @param aWidth the new width for the segment
    @param aSegment the segment to set the width for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setWidth:(float)aWidth forSegment:(unsigned)aSegment
{
    _segments[aSegment].width = aWidth;
    
    [self tileWithChangedSegment:aSegment];
}

/*
    Returns the width for the specified segment.
    @param aSegment the segment to get the width for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (float)widthForSegment:(unsigned)aSegment
{
    return _segments[aSegment].width;
}

/*
    Sets the image for the specified segment.
    @param anImage the image for the segment
    @param aSegment the segment to set the image on
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setImage:(CPImage)anImage forSegment:(unsigned)aSegment
{
    var segment = _segments[aSegment];
    
    if (!anImage)
    {
        [segment.imageView removeFromSuperview];
        
        segment.imageView = nil;
    }
    
    else
    {
        if (!segment.imageView)
        {
            segment.imageView = [[CPImageView alloc] initWithFrame:CGRectMakeZero()];
            
            [self addSubview:segment.imageView];
        }
        
        [segment.imageView setImage:anImage];
        [segment.imageView setFrameSize:CGSizeMakeCopy([anImage size])];
    }
    
    segment.image = anImage;

    if (segment.width)
        [self drawSegment:aSegment highlight:NO];
    else
        [self tileWithChangedSegment:aSegment];
}

/*
    Returns the image for the specified segment
    @param aSegment the segment to obtain the image for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (CPImage)imageForSegment:(unsigned)aSegment
{
    return _segments[aSegment].image;
}

/*
    Sets the label for the specified segment
    @param aLabel the label for the segment
    @param aSegment the segment to label
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setLabel:(CPString)aLabel forSegment:(unsigned)aSegment
{
    var segment = _segments[aSegment];
    
    if (!aLabel || !aLabel.length)
    {
        [segment.labelView removeFromSuperview];
        
        segment.labelView = nil;
    }
    
    else
    {
        if (!segment.labelView)
        {
            segment.labelView = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
            
            [segment.labelView setFont:[self font]];
            
            [self addSubview:segment.labelView];
        }
        
        [segment.labelView setStringValue:aLabel];
        [segment.labelView sizeToFit];
    }
    
    _segments[aSegment].label = aLabel;
    
    if (segment.width)
        [self drawSegment:aSegment highlight:NO];
    else
        [self tileWithChangedSegment:aSegment];
}

/*
    Returns the label for the specified segment
    @param the segment to obtain the label for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (CPString)labelForSegment:(unsigned)aSegment
{
    return _segments[aSegment].label;
}

/*
    Sets the menu for the specified segment
    @param aMenu the menu to set
    @param aSegment the segment to set the menu on
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setMenu:(CPMenu)aMenu forSegment:(unsigned)aSegment
{
    _segments[aSegment].menu = aMenu;
}

/*
    Returns the menu for the specified segment.
    @param aSegment the segment to obtain the menu for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (CPMenu)menuForSegment:(unsigned)aSegment
{
    return _segments[aSegment].menu;
}

/*
    Sets the selection for the specified segment. If only one segment
    can be selected at a time, any other segment will be deselected.
    @param isSelected <code>YES</code> selects the segment. <code>NO</code> deselects it.
    @param aSegment the segment to set the selection for
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setSelected:(BOOL)isSelected forSegment:(unsigned)aSegment
{
    var segment = _segments[aSegment];
    
    // If we're already in this state, bail.
    if (segment.selected == isSelected)
        return;
    
    segment.selected = isSelected;

    // We need to do some cleanup if we only allow one selection.
    if (isSelected)
    {
        var oldSelectedSegment = _selectedSegment;
        
        _selectedSegment = aSegment;
        
        if (_trackingMode == CPSegmentSwitchTrackingSelectOne && oldSelectedSegment != aSegment && oldSelectedSegment != -1)
        {
            _segments[oldSelectedSegment].selected = NO;

            [self drawSegmentBezel:oldSelectedSegment highlight:NO];
        }
    }
    
    if (_trackingMode != CPSegmentSwitchTrackingMomentary)
        [self drawSegmentBezel:aSegment highlight:NO];
}

/*
    Returns <code>YES</code> if the specified segment is selected.
    @param aSegment the segment to check for selection
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (BOOL)isSelectedForSegment:(unsigned)aSegment
{
    return _segments[aSegment].selected;
}

/*
    Enables/diables the specified segment.
    @param isEnabled <code>YES</code> enables the segment
    @param aSegment the segment to enable/disble
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (void)setEnabled:(BOOL)isEnabled forSegment:(unsigned)aSegment
{
    _segments[aSegment].enabled = isEnabled;
}

/*
    Returns <code>YES</code> if the specified segment is enabled.
    @param aSegment the segment to check
    @throws CPRangeException if <code>aSegment</code> is out of bounds
*/
- (BOOL)isEnabledForSegment:(unsigned)aSegment
{
    return _segments[aSegment].enabled;
}

/*
    Sets a tag for the specified segment.
    @param aTag the tag to set
    @param aSegment the segment to set the tag on
*/
- (void)setTag:(int)aTag forSegment:(unsigned)aSegment
{
    _segments[aSegment].tag = aTag;
}

/*
    Returns the tag for the specified segment.
    @param aSegment the segment to obtain the tag for
*/
- (int)tagForSegment:(unsigned)aSegment
{
    return _segments[aSegment].tag;
}

// Drawings
/*
    Draws the specified segment bezel
    @param aSegment the segment to draw the bezel for
    @param shouldHighlight <code>YES</code> highlights the bezel
*/
- (void)drawSegmentBezel:(int)aSegment highlight:(BOOL)shouldHighlight
{
}

/*
    Draws the specified segment
    @param aSegment the segment to draw
    @param shouldHighlight <code>YES</code> highlights the bezel
*/
- (void)drawSegment:(int)aSegment highlight:(BOOL)shouldHighlight
{
    var segment = _segments[aSegment],
            
        imageView = segment.imageView,
        labelView = segment.labelView,
        
        frame = segment.frame,
            
        segmentX = CGRectGetMinX(frame),
        segmentWidth = CGRectGetWidth(frame),
        segmentHeight = CGRectGetHeight(frame) - 1.0;
                    
    if (imageView && labelView)
    {
        var imageViewSize = [imageView frame].size,
            labelViewSize = [labelView frame].size,
            totalHeight = imageViewSize.height + labelViewSize.height,
            labelWidth = MIN(labelViewSize.width, width),
            y = (segmentHeight - totalHeight) / 2.0;
{'fraction_non_alphanumeric': 0.08991440568475452, 'fraction_numerical': 0.0028262273901808787, 'mean_word_length': 2.630221310274073, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 87, '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': '3799163', 'n_tokens_mistral': 7321, 'n_tokens_neox': 7070, 'n_words': 2040}