<commit_before>using System;
using System.Globalization;
using Lucene.Net.Search;
using Lucene.Net.Util;

namespace Lucene.Net.Documents
{
    /*
     * Licensed to the Apache Software Foundation (ASF) under one or more
     * contributor license agreements.  See the NOTICE file distributed with
     * this work for additional information regarding copyright ownership.
     * The ASF licenses this file to You under the Apache License, Version 2.0
     * (the "License"); you may not use this file except in compliance with
     * the License.  You may obtain a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    // for javadocs
    // for javadocs

    /// <summary>
    /// Provides support for converting dates to strings and vice-versa.
    /// The strings are structured so that lexicographic sorting orders
    /// them by date, which makes them suitable for use as field values
    /// and search terms.
    ///
    /// <P>this class also helps you to limit the resolution of your dates. Do not
    /// save dates with a finer resolution than you really need, as then
    /// <seealso cref="TermRangeQuery"/> and <seealso cref="PrefixQuery"/> will require more memory and become slower.
    ///
    /// <P>
    /// Another approach is <seealso cref="NumericUtils"/>, which provides
    /// a sortable binary representation (prefix encoded) of numeric values, which
    /// date/time are.
    /// For indexing a <seealso cref="Date"/> or <seealso cref="Calendar"/>, just get the unix timestamp as
    /// <code>long</code> using <seealso cref="Date#getTime"/> or <seealso cref="Calendar#getTimeInMillis"/> and
    /// index this as a numeric value with <seealso cref="LongField"/>
    /// and use <seealso cref="NumericRangeQuery"/> to query it.
    /// </summary>
    public static class DateTools
    {
        private static readonly String YEAR_FORMAT = "yyyy";
        private static readonly String MONTH_FORMAT = "yyyyMM";
        private static readonly String DAY_FORMAT = "yyyyMMdd";
        private static readonly String HOUR_FORMAT = "yyyyMMddHH";
        private static readonly String MINUTE_FORMAT = "yyyyMMddHHmm";
        private static readonly String SECOND_FORMAT = "yyyyMMddHHmmss";
        private static readonly String MILLISECOND_FORMAT = "yyyyMMddHHmmssfff";

        private static readonly System.Globalization.Calendar calInstance = new System.Globalization.GregorianCalendar();

        /// <summary>
        /// Converts a Date to a string suitable for indexing.
        /// </summary>
        /// <param name="date"> the date to be converted </param>
        /// <param name="resolution"> the desired resolution, see
        ///  <seealso cref="#round(Date, DateTools.Resolution)"/> </param>
        /// <returns> a string in format <code>yyyyMMddHHmmssSSS</code> or shorter,
        ///  depending on <code>resolution</code>; using GMT as timezone  </returns>
        public static string DateToString(DateTime date, Resolution resolution)
        {
            return TimeToString(date.Ticks / TimeSpan.TicksPerMillisecond, resolution);<commit_msg>Lucene.Net.Core.Document.DateTools: changed String > string<commit_after>using System;

namespace Lucene.Net.Documents
{
    /*
     * Licensed to the Apache Software Foundation (ASF) under one or more
     * contributor license agreements.  See the NOTICE file distributed with
     * this work for additional information regarding copyright ownership.
     * The ASF licenses this file to You under the Apache License, Version 2.0
     * (the "License"); you may not use this file except in compliance with
     * the License.  You may obtain a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    // for javadocs
    // for javadocs

    /// <summary>
    /// Provides support for converting dates to strings and vice-versa.
    /// The strings are structured so that lexicographic sorting orders
    /// them by date, which makes them suitable for use as field values
    /// and search terms.
    ///
    /// <P>this class also helps you to limit the resolution of your dates. Do not
    /// save dates with a finer resolution than you really need, as then
    /// <seealso cref="TermRangeQuery"/> and <seealso cref="PrefixQuery"/> will require more memory and become slower.
    ///
    /// <P>
    /// Another approach is <seealso cref="NumericUtils"/>, which provides
    /// a sortable binary representation (prefix encoded) of numeric values, which
    /// date/time are.
    /// For indexing a <seealso cref="Date"/> or <seealso cref="Calendar"/>, just get the unix timestamp as
    /// <code>long</code> using <seealso cref="Date#getTime"/> or <seealso cref="Calendar#getTimeInMillis"/> and
    /// index this as a numeric value with <seealso cref="LongField"/>
    /// and use <seealso cref="NumericRangeQuery"/> to query it.
    /// </summary>
    public static class DateTools
    {
        private static readonly string YEAR_FORMAT = "yyyy";
        private static readonly string MONTH_FORMAT = "yyyyMM";
        private static readonly string DAY_FORMAT = "yyyyMMdd";
        private static readonly string HOUR_FORMAT = "yyyyMMddHH";
        private static readonly string MINUTE_FORMAT = "yyyyMMddHHmm";
        private static readonly string SECOND_FORMAT = "yyyyMMddHHmmss";
        private static readonly string MILLISECOND_FORMAT = "yyyyMMddHHmmssfff";

        private static readonly System.Globalization.Calendar calInstance = new System.Globalization.GregorianCalendar();

        /// <summary>
        /// Converts a Date to a string suitable for indexing.
        /// </summary>
        /// <param name="date"> the date to be converted </param>
        /// <param name="resolution"> the desired resolution, see
        ///  <seealso cref="#round(Date, DateTools.Resolution)"/> </param>
        /// <returns> a string in format <code>yyyyMMddHHmmssSSS</code> or shorter,
        ///  depending on <code>resolution</code>; using GMT as timezone  </returns>
        public static string DateToString(DateTime date, Resolution resolution)
        {
            return TimeToString(date.Ticks / TimeSpan.TicksPerMillisecond, resolution);
{'fraction_non_alphanumeric': 0.09481268011527377, 'fraction_numerical': 0.0011527377521613833, 'mean_word_length': 2.8390486725663715, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6528504', 'n_tokens_mistral': 1791, 'n_tokens_neox': 1732, 'n_words': 728}