Exemplo n.º 1
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);
        }