示例#1
0
        public Pairings LoadFormPairings()
        {
            //TODO: This will come from a database of pairs that maps every possible unit to a default form of an ingredient
            var pairings = new Pairings();

            pairings.Add(new NameIngredientPair("melted", TestIngredientLoader.ING_CHEESE), new IngredientForm(TestIngredientLoader.FORM_CHEESE_MELTED, TestIngredientLoader.ING_CHEESE, Units.Cup, "melted", "", 0, null));
            pairings.Add(new NameIngredientPair("shredded", TestIngredientLoader.ING_CHEESE), new IngredientForm(TestIngredientLoader.FORM_CHEESE_SHREDDED, TestIngredientLoader.ING_CHEESE, Units.Cup, "shredded", "", 0, null));
            pairings.Add(new NameIngredientPair("diced", TestIngredientLoader.ING_CHEESE), new IngredientForm(TestIngredientLoader.FORM_CHEESE_DICED, TestIngredientLoader.ING_CHEESE, Units.Cup, "diced", "", 0, null));

            return(pairings);
        }
示例#2
0
        public Pairings LoadFormPairings()
        {
            var forms    = store.GetIndexedIngredientForms();
            var formSyn  = store.NlpFormSynonyms;
            var pairings = new Pairings();

            foreach (var syn in formSyn)
            {
                var f = forms[syn.FormId];

                var name           = syn.Name;
                var ing            = syn.IngredientId;
                var form           = f.IngredientFormId;
                var convType       = f.UnitType;
                var displayName    = f.FormDisplayName;
                var unitName       = f.UnitName;
                int convMultiplier = f.ConvMultiplier;
                var formAmt        = f.FormAmount;
                var formUnit       = f.FormUnit;
                var amount         = new Amount(formAmt, formUnit);

                pairings.Add(
                    new NameIngredientPair(name, ing),
                    new IngredientForm(form, ing, convType, displayName, unitName, convMultiplier, amount));
            }

            return(pairings);
        }
示例#3
0
        public Pairings LoadFormPairings()
        {
            using (var session = adapter.GetStatelessSession())
            {
                var formSyn = session.QueryOver <NlpFormSynonyms>()
                              .Fetch(prop => prop.Form).Eager()
                              .List();

                //Load all form pairings from db
                var pairings = new Pairings();

                foreach (var syn in formSyn)
                {
                    var name           = syn.Name;
                    var ing            = syn.Ingredient.IngredientId;
                    var form           = syn.Form.IngredientFormId;
                    var convType       = syn.Form.UnitType;
                    var displayName    = syn.Form.FormDisplayName;
                    var unitName       = syn.Form.UnitName;
                    int convMultiplier = syn.Form.ConvMultiplier;
                    var formAmt        = syn.Form.FormAmount;
                    var formUnit       = syn.Form.FormUnit;
                    var amount         = new Amount(formAmt, formUnit);

                    pairings.Add(
                        new NameIngredientPair(name, ing),
                        new IngredientForm(form, ing, convType, displayName, unitName, convMultiplier, amount));
                }

                return(pairings);
            }
        }
示例#4
0
        public Pairings LoadFormPairings()
        {
            using (var session = adapter.GetStatelessSession())
            {
                //Load all form pairings from db
                var unitSyn = session.QueryOver <NlpUnitSynonyms>()
                              .Fetch(prop => prop.Form).Eager()
                              .List();

                var pairings = new Pairings();
                foreach (var syn in unitSyn)
                {
                    pairings.Add(new NameIngredientPair(
                                     syn.Name.Trim(),
                                     syn.Ingredient.IngredientId),
                                 new IngredientForm(
                                     syn.Form.IngredientFormId,
                                     syn.Ingredient.IngredientId,
                                     syn.Form.UnitType,
                                     syn.Form.FormDisplayName,
                                     syn.Form.UnitName,
                                     syn.Form.ConvMultiplier,
                                     new Amount(syn.Form.FormAmount, syn.Form.FormUnit)));
                }

                return(pairings);
            }
        }
示例#5
0
        public Pairings LoadFormPairings()
        {
            var forms    = store.GetIndexedIngredientForms();
            var unitSyn  = store.NlpUnitSynonyms;
            var pairings = new Pairings();

            foreach (var syn in unitSyn)
            {
                var form = forms[syn.FormId];

                pairings.Add(new NameIngredientPair(
                                 syn.Name.Trim(),
                                 syn.IngredientId),
                             new IngredientForm(
                                 form.IngredientFormId,
                                 form.IngredientId,
                                 form.UnitType,
                                 form.FormDisplayName,
                                 form.UnitName,
                                 form.ConvMultiplier,
                                 new Amount(form.FormAmount, form.FormUnit)));
            }

            return(pairings);
        }
示例#6
0
        public Pairings LoadFormPairings()
        {
            //TODO: This will come from a database of pairs that maps every possible unit to a default form of an ingredient
            var pairings = new Pairings();
            var pair     = new NameIngredientPair("head", TestIngredientLoader.ING_LETTUCE);
            var form     = new IngredientForm(TestIngredientLoader.FORM_LETTUCE_HEAD, TestIngredientLoader.ING_LETTUCE, Units.Unit, null, "head/heads", 0, null);

            pairings.Add(pair, form);

            return(pairings);
        }
示例#7
0
 public NodePairings(List <LabeledVertex> imageGraph, List <LabeledVertex> sourceGraph)
 {
     ImageGraph  = imageGraph;
     SourceGraph = sourceGraph;
     ImageGraph.ForEach(x => Pairings.Add(x, new ConcurrentBag <VertexMatch>()));
 }