Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
using System;
using System.IO;
using NFastTag.PosTag;

namespace NFastTag
{
   class Program
   {
      static void Main(string[] args)
      {
         Console.WriteLine(@"Welcome to FastTag_v2.NETPORT");
         Console.WriteLine(@"Enter an english sentence and watch it being tag");

         // read the english lexicon data
         var lexicon = File.ReadAllText("Grammar\\lexicon.txt");

         // run the sample loop
         var ft = new FastTag(lexicon);

         string sentence;

         while ((sentence = Console.ReadLine()) != "[x]")
         {
            var tagResult = ft.Tag(sentence);

            foreach (var ftr in tagResult)
            {
               var message = string.Format(@"[{0} {1}]", ftr.Word, ftr.PosTag);
               Console.WriteLine(message);
            }
         }

         Console.WriteLine(@"Bye Bye!");
      }
   }
}
Posted
Updated 20-Mar-15 22:45pm
v2

It's a loop: it reads a line for text from the console, stores it in the variable sentence and then checks to see if the user entered a specific value: "[x]". If he didn't, it keeps going round until he does, executing the code inside the loop.

Do yourself a favour, and indent your code correctly - it makes it a lot easier to read!
If your code compiles, you can do it by pressing CTRL+K, CTRL+D in Visual studio - and it will reformat the whole document to your preferred indentation style.
 
Share this answer
 
hi,
Here,Your Input String assign to Sentence Variable and checking that input string not equal to the string "[x]" .If the condition is true then it execute the statement what inside the loop.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900