Exemplo n.º 1
0
        public override Dictionary <object, CCGCategory> CanUnify(CCGCategory other)
        {
            PrimitiveCategory primitiveCategory = (PrimitiveCategory)other;

            if (!other.IsPrimitive())
            {
                return(null);
            }

            if (other.IsVar())
            {
                return new Dictionary <object, CCGCategory>()
                       {
                           { other, this }
                       }
            }
            ;

            if (primitiveCategory.Categ == Categ)
            {
                foreach (var item in Restrictions)
                {
                    if (!primitiveCategory.Restrictions.Contains(item))
                    {
                        return(null);
                    }
                }

                return(new Dictionary <object, CCGCategory>());
            }

            return(null);
        }
Exemplo n.º 2
0
        public override Dictionary <object, CCGCategory> CanUnify(CCGCategory other)
        {
            if (other.IsVar())
            {
                return new Dictionary <object, CCGCategory>()
                       {
                           { other, this }
                       }
            }
            ;

            FunctionalCategory functionalCategory = (FunctionalCategory)other;

            if (other.IsFunction())
            {
                var sa = Result.CanUnify(functionalCategory.Result);

                var sd = Dir.CanUnify(functionalCategory.Dir);

                if (sa != null && sd != null)
                {
                    var sb = Arg.Substitute(sa).CanUnify(functionalCategory.Arg.Substitute(sa));
                    if (sb != null)
                    {
                        foreach (var item in sb)
                        {
                            sa.Add(item.Key, item.Value);
                        }
                    }
                }
            }

            return(null);
        }
Exemplo n.º 3
0
        public override Dictionary <object, CCGCategory> CanUnify(CCGCategory other)
        {
            if (other.IsPrimitive() || !PrimOnly)
            {
                return(new Dictionary <object, CCGCategory>()
                {
                    { this, other }
                });
            }

            return(null);
        }
Exemplo n.º 4
0
 public abstract Dictionary <object, CCGCategory> CanUnify(CCGCategory other);
Exemplo n.º 5
0
 public FunctionalCategory(CCGCategory result, CCGCategory arg, CCGCategory dir)
 {
     Result = result;
     Arg    = arg;
     Dir    = dir;
 }