Used to split the identifiers in a program into their constituent words.
Inheritance: IdSplitter
Esempio n. 1
0
 public static void ClassSetup()
 {
     Splitter = new SamuraiIdSplitter(@"TestFiles\NotepadPlusPlus6.2_words.count");
 }
Esempio n. 2
0
        public override void Execute()
        {
            //set default values for optional arguments
            if (Model == null)
            {
                Model = "NotepadPlusPlus6.2_words.count";
            }

            if (Identifier == null && IdentifierFile == null)
            {
                Console.Error.WriteLine("Must specify either Identifier or IdentifierFile");
                return;
            }

            SamuraiIdSplitter splitter = new SamuraiIdSplitter(Model);

            if (Identifier != null)
            {
                string[] words = splitter.Split(Identifier, Trace);
                Console.WriteLine("{0} -> {1}", Identifier, string.Join(" ", words));
            }

            if (IdentifierFile != null)
            {
                using (StreamReader file = new StreamReader(IdentifierFile))
                {
                    string word;
                    while (!file.EndOfStream)
                    {
                        word = file.ReadLine();
                        string[] splitWords = splitter.Split(word, Trace);
                        Console.WriteLine("{0} -> {1}", word, string.Join(" ", splitWords));
                    }
                }
            }
        }