Visual C++ Program for the Implementation of Natural Language Based Grammar Checker System | IT1253 - Software Engineering Laboratory

ABSTRACT:
This project “Natural Language Based on Grammar Checker” was developed mainly for checking the grammar error. It is an automated tool which checks the grammatical error from the given text.
Our intent is to create a natural language based on grammar checker to check the ambiguities in the given sentence. We are using three functions each independent from each other.
This function will get the input from the user and check the verb for tense and display the tense whether it is present tense or past tense or future tense.

PROBLEM DESCRIPTION:
Grammar is an important part of English. Usually people make a lot of grammatical mistake changes the whole tense of the sentenced from the original format of the sentence.
For example:   He is played the game.
        He is playing the game.
From the above sentence. We can realize that grammar is an
important role in English. It is very difficult to find the grammatical
mistake from a given context of text. So, people lag in grammar part of English.
In an automated system the context is type in a fast rate. Therefore people will not take enough conscious about grammatical mistake.
Therefore in a grammar checker, person is needed to type the context. Once it is typed, the grammar checker will check for errors which will be indicated by underline (different checkers use different indication).

REQUIREMENT ANALYSIS:
 
SOFTWARE REQUIREMENTS:
    Front End   :    ‘C++’ language.
    Back End   :     File Management System (using Dat files)
    Operating system:    Any Operating System (Window or Linux)

HARDWARE REQUIREMENTS:
    Processor     :     3.06 GHZ operating speed.
    Hard Disk    :      80GB Capacity.
    RAM           :       256MB
    Monitor       :       CRT 17’
    Mouse         :       OPTICAL
    Keyboard    :       Alphanumeric keys.
     The specified hardware requirements are the minimum requirements that are needed to implement in the project.

 FUNCTIONAL REQUIREMENTS:
    As mentioned in the requirements, the grammar checker activity involves the following function or process
Grammar Checker consists of two modules. They are
    Module 1: Check the Tense
    Module 2: Exit
Check the Tense:
     In this module the user enters the text and the message is displayed if it is a present tense or past tense or future tense.
Exit:
    In this module the user can quit from the project.

NON FUNCTIONAL REQUIREMENT:
    It is reliable software. Whenever the user wants to retrieve any information from the database, it returns with the correct information. Provided, the information stored is a correct one. The cost of maintenance of the software is very low. The size of the software is less. This means, it is a portable one. If any request is given, the time taken for the response is low. This makes the software more efficient.


SOFTWARE METHODOLOGY:

Waterfall model:
     The software process used in this project is WATERFALL MODEL which is otherwise called as LINEAR SEQUENTIAL MODEL. We opted for this model because this is a simple and a basic model which can be implemented easily. This process consists of various phases like Analysis, Design, Coding, Testing and Maintenance or documentation.  
    In the analysis part we had a detailed analysis of the project requirement and how to solve the problem. Then, based on our analysis, requirement and solution, we designed modules and a brief structure of our project. Then we implemented our design as a code or program. Once when the coding part is over, we debugged and tested our software. After testing, we documented our project.
In requirement gathering and analysis phase the basic requirements of the system must be understood by the software engineer. The information domain, function, behavioral requirements of the system is understood.
The design is an intermediate step between requirement analysis and coding. Design focuses on program attributes such as data structure, software architecture, interface representation and algorithmic details.
Coding is a step in which design is translated into machine readable form. If design is done in sufficient detail, then coding can be done efficiently. Programs are created in this phase.
Testing begins when coding is done. While performing testing the major focus is on logical internals of the software. The testing ensures execution of all the paths and functional behaviors. The purpose of testing is to uncover errors, fix the bugs and meet customer requirements.
Maintenance is the longest life cycle phase. When the system is installed and put in practical use then error may get introduced. Correcting those errors and putting it in use is the major purpose of maintenance activity.



Reason to Choose Waterfall Model:
1.    This model is used because of its systematic and sequential approach to software development.
2.    The software development starts with requirements gathering phase. Then progresses through analysis, design, coding, testing and maintenance.
Even though this model has some disadvantages this is widely used model because of its sequential method.

SOURCE CODE:
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<graphics.h>
#include<process.h>
#include<dos.h>
int j=0,s1,s2,k,i,f;
int gdriver = EGA,gmode = DETECT;
char t[10][10] = {'\0'},tp,al,cha={'\0'};
void choice();
void text();
void present();
void past();
void future();
void background();

void main()
{
 clrscr();
 choice();
 getch();
}

void background()
{
 clrscr();
 initgraph(&gdriver,&gmode,"");
 setbkcolor(15);
}

void choice()
{
 int n;
 clrscr();
 gotoxy(30,8);
 cout<<"1:Present";
 gotoxy(30,11);
 cout<<"2:Past";
 gotoxy(30,14);
 cout<<"3:Future";
 gotoxy(30,17);
 cout<<"4:Exit";
 n=getch();
 switch(n)
 {
  case '1':
    clrscr();
    text();
    present();
    break;
  case '2':
    clrscr();
    text();
    past();
    break;
  case '3':
    clrscr();
    text();
    future();
    break;
  case '4':
    exit(0);
  default:
    cout<<"WRONG INPUT";
    choice();
 }
}

void present()
{
 int c;
 char pr[5][5]={"is","are","have","has","am"};
 f=1;
 for(k=0;k<5;k++)
 {
  c=strcmpi(t[1],pr[k]);
  if(c==0)
   f=0;
 }
  if(f==0)
    cout<<"\nIt is a Present Tense\n";
  else
    cout<<"\n Wrong\n";
  al=getch();
  if(al=='\r')
  choice();
}
 
void past()
{
 char d[3]={'\0'},d1[3]={"ed"};
 char pa[10][5]={"was","went","were","had","ate","did"};
 int c1,c2=1;
 f=1;
 for(int kl=0;kl<10;kl++)
 {
  if(t[1][kl]=='\0')
    break;
 }
 if(t[1][kl]=='\0')
 {
  d[0]=t[1][kl-2];
  d[1]=t[1][kl-1];
 }
 c2=strcmpi(d,d1);
 if(c2==0)
    cout<<"\nIt is a past sentence\n";
 else
 {
  for(k=0;k<6;k++)
  {
   c1=strcmpi(t[1],pa[k]);
   if(c1==0)
   f=0;
  }
  if(f==0)
    cout<<"\nIt is a past tense\n ";
  else
    cout<<"\nWrong\n";
 }
 al=getch();
 if(al=='\r')
    choice();
 else
    choice();
}

void future()
{
 char fu[5][7]={"will","shall","would","should"};
 int c2;
 f=1;
 for(k=0;k<5;k++)
 {
  c2=strcmpi(t[1],fu[k]);
  if(c2==0)
    f=0;
 }
 if(f==0)
    cout<<"\nIt is future Sentence\n";
 else
    cout<<"\nWrong\n";
 al=getch();
 if(al=='\r')
   choice();
 else
   choice();
}

void text()
{
 for(i=0;i<10;i++)
 {
   for(j=0;j<10;j++)
   {
    t[i][j]=cha;
   }
 }
 cout<<"\n Enter the Text:\n";
 for(i=0;i<10;i++)
 {
   for(j=0;j<10;j++)
   {
    tp=getche();
    if(tp==' ')
      goto s1;
    if(tp=='\r')
    {
     goto s2;
    }
    t[i][j]=tp;
   }
   s2:
     break;
   s1:
 }
 for(int il=0;il<=i;il++)
 {
   cout<<t[il]<<" ";
 }
}
OUTPUT:

MENU MODULE: 

PRESENT TENSE MODULE:

PAST TENSE MODULE:

FUTURE TENSE MODULE:


CONCLUSION:
             The  project we have done here is “NATURAL LANGUAGE BASED GRAMMAR CHECKER” using C++ language. In this project we have designed a software to implement the customer details that any user can perform it in a simple and a better way. This way of format helps us to have clear database.
Previous
Next Post »

1 comments:

Write comments
Jaide Smith
AUTHOR
July 8, 2013 at 11:05 AM delete

Thank you so much for writing a lot of this good information!

Grammar Check

Reply
avatar

If you still didn't find what you're looking for, you can search this website below: