Пример #1
0
        private Poem Match2(string p)
        {
            Poem S = new Poem( );

            Probable Pr = Padyam.MostProbable(p, new MatchOptions( ));
            Padyam   P  = Pr.Padyam;

            P.MatchYati       = true;
            P.MatchPrasa      = true;
            P.AllowSantiPrasa = true;
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;

            S.Calculated = R.ShortName;
            S.HasMatach  = MR.IsMatched;
            S.Percentage = MR.Percentage.ToString( );
            S.Remarks    = MR.ShowErrors(OutputFormat.Text);

            string s = P.Build2(Pr.MatchResult);

            S.MarkingText = s;

            S.Yatis = ExtractYati(s);


            return(S);
        }
Пример #2
0
        protected override void RemoveItem(int index)
        {
            CaseViewModel caseToRemove = this[index];

            _master.Remove(caseToRemove.RecordId);
            base.RemoveItem(index);

            if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.Confirmed)
            {
                Confirmed.Remove(caseToRemove);
            }
            if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.Probable)
            {
                Probable.Remove(caseToRemove);
            }
            if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.Suspect)
            {
                Suspect.Remove(caseToRemove);
            }
            if (caseToRemove.EpiCaseDef == Core.Enums.EpiCaseClassification.NotCase)
            {
                NotCase.Remove(caseToRemove);
            }

            caseToRemove.EpiCaseDefinitionChanging -= item_EpiCaseDefinitionChanging;
            caseToRemove.CaseIDChanging            -= item_CaseIDChanging;
            caseToRemove.CaseSecondaryIDChanging   -= item_CaseIDChanging;
            caseToRemove.MarkedForRemoval          -= item_MarkedForRemoval;
            caseToRemove.Inserted            -= item_Inserted;
            caseToRemove.Updated             -= item_Updated;
            caseToRemove.ViewerClosed        -= item_ViewerClosed;
            caseToRemove.SwitchToLegacyEnter -= item_SwitchToLegacyEnter;
        }
Пример #3
0
        private static bool Match(string p1)
        {
            Probable    Pr = Padyam.MostProbable(p1);
            Padyam      P  = Pr.Padyam;
            MatchResult MR = Pr.MatchResult;

            //Rule R=Pr.Rule;
            return(MR.IsMatched);
        }
Пример #4
0
        public static void OnDetermine()
        {
            Window.Document.GetElementById("result").InnerHTML = "<b style='color:red;'>Detecting Best Match..</b>";
            Script.SetTimeout(delegate()
            {
                StopWatch.Start();
                MatchOptions Options = Settings();
                Probable Pr          = Business.Determine(Util.GetValue("txt"), Options);

                string s = Business.BuildResult2(Pr);
                Window.Document.GetElementById("result").InnerHTML = s;

                for (int i = 1; i <= 5; i++)
                {
                    Element E = Document.GetElementById("candiate_" + i);
                    if (E == null)
                    {
                        continue;
                    }
                    try
                    {
                        E.AddEventListener("click", delegate(ElementEvent e)
                        {
                            Element E3 = e.Target;
                            SetClosedResult(E3);
                        }, false);
                    }
                    catch
                    {
                        E.AttachEvent("onclick", new ElementEventHandler(delegate()
                        {
                            Element E3 = Window.Event.SrcElement;
                            SetClosedResult(E3);
                        }));
                    }
                }

                if (Pr != null && Pr.MatchResult != null && Pr.Rule != null)
                {
                    Util.SetOption("list", Pr.Rule.Identifier);
                }

                string identifier = "";
                string score      = "";
                if (Pr != null)
                {
                    identifier = Pr.Rule.Identifier;
                    score      = Pr.MatchResult.Percentage.ToString();
                }

                Util.ScrollTo("main");

                StopWatch.ShowTicks(true);
                Metrics.Export2(Metric.Determine, StopWatch.LastTicks, identifier, score);
            }, 0);
        }
Пример #5
0
	private void MostProbable()
	{
		string p = @"పలికెడిది భాగవత మఁట, 
పలికించెడివాడు రామభద్రుం డఁట, నేఁ
బలికిన భవహర మగునఁట, 
పలికెద, వేఱొండు గాథ బలుకఁగ నేలా?";
		Probable Pr = Padyam.MostProbable(p, MatchOptions.QucikMatchSettings);
		MatchResult MR = Pr.MatchResult;
		Padyam P = Pr.Padyam;
	}
Пример #6
0
        protected override void ClearItems()
        {
            _master.Clear();

            Confirmed.Clear();
            Probable.Clear();
            Suspect.Clear();
            NotCase.Clear();

            base.ClearItems();
        }
Пример #7
0
        public static string Build(string s, string number, string type)
        {
            Probable Pr = Padyam.MostProbable(s, MatchOptions.QucikMatchSettings);

            if (Pr.MatchResult == null)
            {
                Debugger.Break( );
            }
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;
            Padyam      P  = Pr.Padyam;

            return(Build(MR, R, P, number, type));
        }
Пример #8
0
        private void Identifier(string s)
        {
            MatchOptions Options = MatchOptions.QucikMatchSettings;

            Options.Language   = RuleLanguage.Kannada;
            Options.MatchYati  = false;
            Options.MatchPrasa = true;


            Probable    Pr = Padyam.MostProbable(s, Options);
            MatchResult MR = Pr.MatchResult;

            Console.Write(MR.Percentage);
        }
Пример #9
0
        public static string Build(Poem Poem, MatchOptions Options, OutputOptions OO)
        {
            if (Poem == null)
            {
                return("");
            }
            if (Poem.Text.Trim().Length == 0)
            {
                return("");
            }

            List <Rule> Rules = new List <Rule>();

            if (OO.Rules == null || OO.Rules.Count == 0)
            {
                if (Poem.Identifier == null)
                {
                    Rules.AddRange(Manager.Rules());
                }
                else
                {
                    Rule R2 = Manager.FetchRule(Poem.Identifier);
                    if (R2 == null)
                    {
                        Rules.AddRange(Manager.Rules());
                    }
                    else
                    {
                        Rules.Add(R2);
                    }
                }
            }
            else
            {
                Rules.AddRange(OO.Rules);
            }

            Probable Pr = Padyam.MostProbable2(Poem.Text, Options, Rules);

            if (Pr.MatchResult == null)
            {
                Debugger.Break();
            }
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;
            Padyam      P  = Pr.Padyam;

            return(Build(MR, R, P, OO));
        }
Пример #10
0
        private static Stats Match2(string p)
        {
            Stats S = new Stats( );

            Probable    Pr = Padyam.MostProbable(p);
            Padyam      P  = Pr.Padyam;
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;


            S.Poem       = p;
            S.Calculated = R.Name;
            S.HasMatach  = MR.IsMatched;
            S.Percentage = MR.Percentage.ToString( );
            S.Remarks    = MR.ShowErrors(OutputFormat.Text);

            return(S);
        }
Пример #11
0
        public static string Build2(string s, string number, string type, string skanda, string ghatta, ref int score)
        {
            Probable Pr = Padyam.MostProbable(s, MatchOptions.TradtionalMatchSettings);

            if (Pr == null || Pr.MatchResult == null)
            {
                Debugger.Break( );
                return("");
            }
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;
            Padyam      P  = Pr.Padyam;

            if (Pr.MatchResult.Percentage != 100)
            {
                score = 1;
            }
            score = 0;
            return(Build2(MR, R, P, s, number, type, skanda, ghatta));
        }
Пример #12
0
        private void item_EpiCaseDefinitionChanging(object sender, Events.EpiCaseDefinitionChangingEventArgs e)
        {
            CaseViewModel caseVM = sender as CaseViewModel;

            if (caseVM != null)
            {
                if (e.PreviousDefinition == EpiCaseClassification.Confirmed)
                {
                    Confirmed.Remove(caseVM);
                }
                else if (e.PreviousDefinition == EpiCaseClassification.Probable)
                {
                    Probable.Remove(caseVM);
                }
                else if (e.PreviousDefinition == EpiCaseClassification.Suspect)
                {
                    Suspect.Remove(caseVM);
                }
                else if (e.PreviousDefinition == EpiCaseClassification.NotCase)
                {
                    NotCase.Remove(caseVM);
                }

                if (e.NewDefinition == EpiCaseClassification.Confirmed)
                {
                    Confirmed.Add(caseVM);
                }
                else if (e.NewDefinition == EpiCaseClassification.Probable)
                {
                    Probable.Add(caseVM);
                }
                else if (e.NewDefinition == EpiCaseClassification.Suspect)
                {
                    Suspect.Add(caseVM);
                }
                else if (e.NewDefinition == EpiCaseClassification.NotCase)
                {
                    NotCase.Add(caseVM);
                }
            }
        }
Пример #13
0
        protected override void ClearItems()
        {
            foreach (CaseViewModel c in this)
            {
                c.EpiCaseDefinitionChanging -= item_EpiCaseDefinitionChanging;
                c.CaseIDChanging            -= item_CaseIDChanging;
                c.CaseSecondaryIDChanging   -= item_CaseIDChanging;
                c.MarkedForRemoval          -= item_MarkedForRemoval;
                c.Inserted            -= item_Inserted;
                c.Updated             -= item_Updated;
                c.ViewerClosed        -= item_ViewerClosed;
                c.SwitchToLegacyEnter -= item_SwitchToLegacyEnter;
            }
            _master.Clear();

            Confirmed.Clear();
            Probable.Clear();
            Suspect.Clear();
            NotCase.Clear();

            base.ClearItems();
        }
Пример #14
0
        protected override void InsertItem(int index, CaseViewModel item)
        {
            #region Input Validation
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (_master.ContainsKey(item.RecordId))//Error when trying to add existing item. VHF-259
            {
                return;
            }

            #endregion // Input Validation

            //base.InsertItem(index, item);

            if (Count == 0)
            {
                base.InsertItem(0, item);
            }
            else
            {
                var lastItem = this[Count - 1];

                if (item.IDForSorting.CompareTo(lastItem.IDForSorting) == 1)
                {
                    base.InsertItem(Count, item);
                }
                else
                {
                    bool wasInserted = false;
                    for (int i = Count - 1; i >= 0; i--)
                    {
                        var c = this[i];

                        if (item.IDForSorting.CompareTo(c.IDForSorting) == 1)
                        {
                            base.InsertItem(i + 1, item);
                            wasInserted = true;
                            break;
                        }
                    }

                    if (!wasInserted)
                    {
                        base.InsertItem(0, item);
                    }
                }
            }

            _master.Add(item.RecordId, item);

            if (item.EpiCaseDef == Core.Enums.EpiCaseClassification.Confirmed)
            {
                Confirmed.Add(item);
            }
            if (item.EpiCaseDef == Core.Enums.EpiCaseClassification.Probable)
            {
                Probable.Add(item);
            }
            if (item.EpiCaseDef == Core.Enums.EpiCaseClassification.Suspect)
            {
                Suspect.Add(item);
            }
            if (item.EpiCaseDef == Core.Enums.EpiCaseClassification.NotCase)
            {
                NotCase.Add(item);
            }

            CheckCaseForInvalidId(item, item.ID);
            CheckCaseForDuplicateId(item, item.IDForSorting);

            item.EpiCaseDefinitionChanging += item_EpiCaseDefinitionChanging;
            item.CaseIDChanging            += item_CaseIDChanging;
            item.CaseSecondaryIDChanging   += item_CaseIDChanging;
            item.MarkedForRemoval          += item_MarkedForRemoval;
            item.Inserted            += item_Inserted;
            item.Updated             += item_Updated;
            item.ViewerClosed        += item_ViewerClosed;
            item.SwitchToLegacyEnter += item_SwitchToLegacyEnter;
        }
Пример #15
0
        public static string Determine(string padyam, MatchOptions2 Options2)
        {
            Probable Pr = Business.Determine(padyam, Options2);

            return(Business.BuildResult2(Pr, Options2 == null ? true : Options2.ShowGV));
        }