Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public override Dictionary <object, CCGCategory> CanUnify(CCGCategory other)
        {
            if (other.IsPrimitive() || !PrimOnly)
            {
                return(new Dictionary <object, CCGCategory>()
                {
                    { this, other }
                });
            }

            return(null);
        }
Пример #4
0
 public abstract Dictionary <object, CCGCategory> CanUnify(CCGCategory other);
Пример #5
0
 public FunctionalCategory(CCGCategory result, CCGCategory arg, CCGCategory dir)
 {
     Result = result;
     Arg    = arg;
     Dir    = dir;
 }