/*
 * LensKit, an open source recommender systems toolkit.
 * Copyright 2010-2014 LensKit Contributors.  See CONTRIBUTORS.md.
 * Work on LensKit has been funded by the National Science Foundation under
 * grants IIS 05-34939, 08-08692, 08-12148, and 10-17697.
 *
 * This program 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 program 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 General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package org.grouplens.lenskit.data.text;

/**
 * Utility classes for event formats.
 *
 * @since 2.2
 */
public final class Formats {
    private Formats() {}

    /**
     * Get a format for reading the ML-100K data set.
     *
     * @return A format for using {@link TextEventDAO} to read the ML-100K data set.
     */
    public static DelimitedColumnEventFormat ml100kFormat() {
        DelimitedColumnEventFormat fmt = new DelimitedColumnEventFormat(new RatingEventType());
        fmt.setDelimiter("\t");
        fmt.setFields(Fields.user(), Fields.item(), Fields.rating(), Fields.timestamp());
        return fmt;
    }

    /**
     * Get a format for reading the MovieLens data sets.
     *
     * @return A format for using {@link TextEventDAO} to read the ML-1M and ML-10M data sets.
     */
    public static DelimitedColumnEventFormat movieLensFormat() {
        DelimitedColumnEventFormat fmt = new DelimitedColumnEventFormat(new RatingEventType());
        fmt.setDelimiter("::");
        fmt.setFields(Fields.user(), Fields.item(), Fields.rating(), Fields.timestamp());
        return fmt;
    }
}

@@ -1146,16 +1146,1015 @@
 s() %7B%7D%0A%0A
+    /**%0A     * A basic format of ratings in a CSV file.  The expected format is (%3Cem%3Euser%3C/em%3E, %3Cem%3Eitem%3C/em%3E,%0A     * %3Cem%3Erating%3C/em%3E, %3Cem%3Etimestamp%3C/em%3E), where the timestamp is optional.%0A     * @param delim The delimiter.%0A     * @return An event format for reading ratings from a CSV file.%0A     */%0A    public static DelimitedColumnEventFormat delimitedRatings(String delim) %7B%0A        DelimitedColumnEventFormat fmt = new DelimitedColumnEventFormat(new RatingEventType());%0A        fmt.setDelimiter(delim);%0A        fmt.setFields(Fields.user(), Fields.item(), Fields.rating(), Fields.timestamp(false));%0A        return fmt;%0A    %7D%0A%0A    /**%0A     * A basic format of ratings in a CSV file.  The expected format is (%3Cem%3Euser%3C/em%3E, %3Cem%3Eitem%3C/em%3E,%0A     * %3Cem%3Erating%3C/em%3E, %3Cem%3Etimestamp%3C/em%3E), where the timestamp is optional.%0A     * @return An event format for reading ratings from a CSV file.%0A     */%0A    public static DelimitedColumnEventFormat csvRatings() %7B%0A        return delimitedRatings(%22,%22);%0A    %7D%0A%0A
     /**%0A
@@ -2669,32 +2669,50 @@
 ieLens data sets
+ (other than 100K)
 .%0A     *%0A     * 

Add CSV and delimited text formats