Beispiel #1
0
        private void LoadRelations(CrowdRecDataContainer container)
        {
            Console.WriteLine("Importing relations...");

            foreach (var line in File.ReadAllLines(_relationsFile))
            {
                var tokens = line.Split('\t');

                if (tokens.Length < 5)
                {
                    throw new Exception("Expect 5 tab seperated fields.");
                }

                string relationType = tokens[0];
                string relationId   = tokens[1];

                double temp;
                double?timestamp;

                if (double.TryParse(tokens[2], out temp))
                {
                    timestamp = temp;
                }
                else
                {
                    timestamp = null;
                }

                ItemRating ir = container.CreateItemRating(relationId, timestamp, tokens[3], tokens[4]);

                container.Ratings.Add(ir);
            }
        }
        private void LoadRelations(CrowdRecDataContainer container)
        {
            Console.WriteLine("Importing relations...");

            foreach (var line in File.ReadAllLines(_relationsFile))
            {
                var tokens = line.Split('\t');

                if (tokens.Length < 5)
                    throw new Exception("Expect 5 tab seperated fields.");

                string relationType = tokens[0];
                string relationId = tokens[1];

                double temp;
                double? timestamp;

                if (double.TryParse(tokens[2], out temp))
                    timestamp = temp;
                else
                    timestamp = null;

                ItemRating ir = container.CreateItemRating(relationId, timestamp, tokens[3], tokens[4]);

                container.Ratings.Add(ir);
            }
        }