Пример #1
0
            public WithReferences()
            {
                LoaderMock = new Mock <IReferenceLoader>();
                SetUpReferences();

                Tagger = new AddressTagger(LoaderMock.Object);
            }
Пример #2
0
        static void ParseFromConsole(HiddenMarkovModel hmm, ParseTarget target)
        {
            ConsoleColor defaultColor = Console.ForegroundColor;
            ITagger      tagger;

            char[] splitChars = null;
            if (target == ParseTarget.Address)
            {
                tagger     = new AddressTagger();
                splitChars = new char[1] {
                    '-'
                };
            }
            else
            {
                tagger = new NameTagger();
            }
            while (true)
            {
                Console.WriteLine($"Enter the {target}:");
                Console.ForegroundColor = ConsoleColor.Green;
                string input = Console.ReadLine();
                if (string.IsNullOrWhiteSpace(input))
                {
                    continue;
                }
                string[] words  = Preprocessing.GetFormattedWords(input, splitChars);
                int[]    tags   = tagger.TagInput(words);
                int[]    result = hmm.Decide(tags);
                DisplayParseResults(words, tags, result, target);
                Console.ForegroundColor = defaultColor;
            }
        }
Пример #3
0
            public WithOutReferences()
            {
                LoaderMock = new Mock <IReferenceLoader>();
                Tagger     = new AddressTagger(LoaderMock.Object);

                // return empty reference array by default
                LoaderMock.SetReturnsDefault(new string[0]);
            }