Пример #1
0
        public static List <Frame> GetNeighbors(this NounFrame nf, MindMapTMR tmr)
        {
            List <Frame> frames = new List <Frame>();
            Dictionary <CaseRole, List <VerbFrame> > Associatedactions = tmr.GetNounFrameAssociatedactions(tmr.Nounframes.IndexOf(nf));
            //Array caseRoleArr = Enum.GetValues(typeof(CaseRole));

            int len = Enum.GetNames(typeof(CaseRole)).Length;

            for (int i = 0; i < Enum.GetNames(typeof(CaseRole)).Length; i++)
            {
                //Enum.GetValues(CaseRole)
                if (Associatedactions.ContainsKey((CaseRole)i))
                {
                    List <VerbFrame> ListofVF = Associatedactions[(CaseRole)i];
                    foreach (VerbFrame vf in ListofVF)
                    {
                        frames.Add(vf);
                    }
                }
                if (nf.Ownerof.ContainsKey((CaseRole)i))
                {
                    foreach (NounFrame nfi in nf.Ownerof[(CaseRole)i])
                    {
                        frames.Add(nfi);
                    }
                }
            }

            return(frames);
        }
        public override double WeighNounFrame(int nounFrameIndex)
        {
            LoadRelationWeights();
            LoadRelationFactors();

            NounFrame NF = _mindMapTMR.Nounframes[nounFrameIndex];
            //relations of noun frames ---> CaseRoles
            Dictionary <CaseRole, List <VerbFrame> > Associatedactions = MindMapTMR.GetNounFrameAssociatedactions(nounFrameIndex);
            double Weight = 0;

            //Array caseRoleArr = Enum.GetValues(typeof(CaseRole));

            int len = Enum.GetNames(typeof(CaseRole)).Length;

            for (int i = 0; i < Enum.GetNames(typeof(CaseRole)).Length; i++)
            {
                //Enum.GetValues(CaseRole)
                if (Associatedactions.ContainsKey((CaseRole)i))
                {
                    List <VerbFrame> ListofVF = Associatedactions[(CaseRole)i];
                    int count = ListofVF.Count;
                    if (count != 0)
                    {
                        for (int j = 0; j < count; j++)
                        {
                            Weight += caseRoleWeights[(CaseRole)i];
                        }
                    }
                }
            }

            return(Weight);
        }