// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/IAnnotationUnit.java
// public interface IAnnotationUnit
//     extends Serializable
// {
//     /**
//      * Returns the index of the rater who coded this unit (in case of a coding study) or defined the
//      * boundaries of this unit (in case of a unitizing study). The first rater has index 0.
//      */
//     public int getRaterIdx();
// 
//     /**
//      * Returns the category assigned to this unit by one of the raters. The category might be null
//      * if, and only if, the unit represents a missing value (in case of a coding study) or a gap (in
//      * case of a unitizing study).
//      */
//     public Object getCategory();
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/distance/SetAnnotation.java
// public class SetAnnotation
//     extends HashSet<Object>
//     implements Comparable<SetAnnotation>
// {
//     private static final long serialVersionUID = 8656250211589017624L;
// 
//     /** Instantiates an empty set annotation. */
//     public SetAnnotation()
//     {
//         super();
//     }
// 
//     /** Instantiates a set annotation with the given values as set elements. */
//     public SetAnnotation(Object... values)
//     {
//         super();
//         for (Object value : values) {
//             add(value);
//         }
//     }
// 
//     /** Instantiates a set annotation with the given values as set elements. */
//     public SetAnnotation(Collection<? extends Object> c)
//     {
//         super(c);
//     }
// 
//     @Override
//     public int compareTo(final SetAnnotation that)
//     {
//         return toString().compareTo(that.toString());
//     }
// 
//     @Override
//     public boolean equals(final Object that)
//     {
//         if (!(that instanceof SetAnnotation)) {
//             return false;
//         }
//         return toString().equals(((SetAnnotation) that).toString());
//     }
// 
//     @Override
//     public int hashCode()
//     {
//         return toString().hashCode();
//     }
// 
//     @Override
//     public String toString()
//     {
//         StringBuilder result = new StringBuilder();
//         for (Object value : this) {
//             result.append(result.length() == 0 ? "" : ", ").append(value);
//         }
//         return result.toString();
//     }
// }


import org.dkpro.statistics.agreement.IAnnotationUnit;
import org.dkpro.statistics.agreement.distance.SetAnnotation;
/*
 * Copyright 2014
 * Ubiquitous Knowledge Processing (UKP) Lab
 * Technische Universität Darmstadt
 *
 * Licensed 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.
 */
package org.dkpro.statistics.agreement.coding;


/**
 * Implementation of a mean Dice agreement measure for calculating the inter-rater agreement for two
 * or more raters applying set-valued annotations. The measure is neither chance-corrected nor
 * weighted.<br>
 * <br>
 * References:
 * <ul>
 * <li>Lee R. Dice. Measures of the amount of ecologic association between species. <em>Ecology</em>
 * 36(3):297–302, 1945.</li>
 * <li>Jean Véronis. A study of polysemy judgements and inter-annotator agreement. In
 * <em>Proceedings of SENSEVAL-1</em>, 1998.</li>
 * </ul>
 *
 * @author Tristan Miller
 */
public class DiceAgreement
    extends CodingAgreementMeasure
    implements ICodingItemSpecificAgreement /* , IRaterAgreement */
{

    /**
     * Initializes the instance for the given annotation study. The study should never be null.
     */
    public DiceAgreement(final ICodingAnnotationStudy study)
    {
        super(study);
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/IAnnotationUnit.java
// public interface IAnnotationUnit
//     extends Serializable
// {
//     /**
//      * Returns the index of the rater who coded this unit (in case of a coding study) or defined the
//      * boundaries of this unit (in case of a unitizing study). The first rater has index 0.
//      */
//     public int getRaterIdx();
// 
//     /**
//      * Returns the category assigned to this unit by one of the raters. The category might be null
//      * if, and only if, the unit represents a missing value (in case of a coding study) or a gap (in
//      * case of a unitizing study).
//      */
//     public Object getCategory();
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/distance/SetAnnotation.java
// public class SetAnnotation
//     extends HashSet<Object>
//     implements Comparable<SetAnnotation>
// {
//     private static final long serialVersionUID = 8656250211589017624L;
// 
//     /** Instantiates an empty set annotation. */
//     public SetAnnotation()
//     {
//         super();
//     }
// 
//     /** Instantiates a set annotation with the given values as set elements. */
//     public SetAnnotation(Object... values)
//     {
//         super();
//         for (Object value : values) {
//             add(value);
//         }
//     }
// 
//     /** Instantiates a set annotation with the given values as set elements. */
//     public SetAnnotation(Collection<? extends Object> c)
//     {
//         super(c);
//     }
// 
//     @Override
//     public int compareTo(final SetAnnotation that)
//     {
//         return toString().compareTo(that.toString());
//     }
// 
//     @Override
//     public boolean equals(final Object that)
//     {
//         if (!(that instanceof SetAnnotation)) {
//             return false;
//         }
//         return toString().equals(((SetAnnotation) that).toString());
//     }
// 
//     @Override
//     public int hashCode()
//     {
//         return toString().hashCode();
//     }
// 
//     @Override
//     public String toString()
//     {
//         StringBuilder result = new StringBuilder();
//         for (Object value : this) {
//             result.append(result.length() == 0 ? "" : ", ").append(value);
//         }
//         return result.toString();
//     }
// }


// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/DiceAgreement.java
import org.dkpro.statistics.agreement.IAnnotationUnit;
import org.dkpro.statistics.agreement.distance.SetAnnotation;

/*
 * Copyright 2014
 * Ubiquitous Knowledge Processing (UKP) Lab
 * Technische Universität Darmstadt
 *
 * Licensed 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.
 */
package org.dkpro.statistics.agreement.coding;


/**
 * Implementation of a mean Dice agreement measure for calculating the inter-rater agreement for two
 * or more raters applying set-valued annotations. The measure is neither chance-corrected nor
 * weighted.<br>
 * <br>
 * References:
 * <ul>
 * <li>Lee R. Dice. Measures of the amount of ecologic association between species. <em>Ecology</em>
 * 36(3):297–302, 1945.</li>
 * <li>Jean Véronis. A study of polysemy judgements and inter-annotator agreement. In
 * <em>Proceedings of SENSEVAL-1</em>, 1998.</li>
 * </ul>
 *
 * @author Tristan Miller
 */
public class DiceAgreement
    extends CodingAgreementMeasure
    implements ICodingItemSpecificAgreement /* , IRaterAgreement */
{

    /**
     * Initializes the instance for the given annotation study. The study should never be null.
     */
    public DiceAgreement(final ICodingAnnotationStudy study)
    {
        super(study);
        ensureTwoRaters();