private static void AddRelationAttribute(ArffRelation relation, string attribute)
        {
            string[] attributeValues = new string[3];
            attributeValues[0] = attribute.Substring(0, attribute.IndexOfAny(new char[] { ' ', '\t' }));
            attribute          = attribute.Remove(0, attributeValues[0].Length).Trim();
            attributeValues[1] = attribute.Substring(0, attribute.IndexOfAny(new char[] { ' ', '\t' }));
            attribute          = attribute.Remove(0, attributeValues[1].Length).Trim();
            attributeValues[2] = attribute;

            string name   = attributeValues[1];
            bool   isReal = true;
            Map <double, string> nominals = null;

            if (attributeValues[2].ToLower() != "real" && attributeValues[2].ToLower() != "continuous")
            {
                isReal   = false;
                nominals = new Map <double, string>();
                string[] nominalValues = attributeValues[2].Trim(new char[] { '{', '}' }).Split(',');
                for (int i = 0; i < nominalValues.Length; i++)
                {
                    nominals.Add(i, nominalValues[i].Trim());
                }
            }

            var column = new ArffColumn(name, isReal, nominals);

            relation.AddColumn(column);
        }
Exemple #2
0
 public void AddColumn(ArffColumn col)
 {
     _columns.Add(col);
 }