Program for searching by indexing text files, Programming Languages

Assignment Help:

Write a program that can facilitate searching by indexing text files according to words. In this task, you are given a large text file, sample.txt, which you will need to index the words stored in them.

To do this, you will separate out the words in the text file and index them according to their frequencies.  Your program shall count the number of unique words and store them in an appropriate Standard Template Library container.  The words are to be normalized to lower-case so that we do not have to deal with case-sensitivity. Your program will ignore the following:

  • Punctuations
  • Numerical numbers (1, 2, etc., but 'one', 'two' are to be treated as words)

Next, your program shall generate two output files, index.txt, and common.txt. At the start of the program, you shall prompt user to enter the threshold number. This number determines if the unique words are to be stored in index.txt or common.txt.

Unique words with frequency greater or equal than the threshold are to be stored in common.txt. Likewise, unique words with frequency less than the threshold are to be stored in index.txt.

As an illustration, suppose a text file, sample.txt, contains the following:

Give us a break!  It is a beautiful day.  We do not want to do programming today.  Do you want to go to the beach with us?

At program starts:

Enter threshold number: 2

The above indicates that user enters 2 for threshold number. Your program shall generate the two output files with following content (words sorted in ascending order):

index.txt

Total words: 15

beach              1

beautiful          1

break               1

day                  1         

give                 1

go                    1

is                      1

it                      1

not                   1

programming  1

the                   1

today               1

we                   1

with                  1

you                  1

common.txt

Total words: 5

a                      2

do                    3

to                     3

us                    2

want                2


Related Discussions:- Program for searching by indexing text files

Higher order differential equations, We'll start this section off with the ...

We'll start this section off with the material which most text books that will cover in this section. We will take the matter from the Second Order chapter and expand this out to n

Calculate the appropriate weight for each query term, 1-Create ir3.py based...

1-Create ir3.py based on ir2.py 2-Repeatedly prompt the user for a query (if they enter "q", then quit) 3-Find the terms in the query, and calculate the appropriate weight fo

Maze-solving, For this assignment you will use the robot/maze simulation ex...

For this assignment you will use the robot/maze simulation example introduced in mini-assignments 0625ma-0627ma to develop a maze-solving program. The program will read a file cont

Genetic diseases, Genetic Diseases Problem Description Many human di...

Genetic Diseases Problem Description Many human diseases could be controlled by the knowledge of the gene's structure and pattern. The human gene could be represented by fou

Write a program to handle a book collection, Write a program to handle a bo...

Write a program to handle a book collection. The data on each book might be title, author, publication date, book number and  cataloging details. Allow for adding or deleting books

Write and test a simple perl program on the linux platform, Write and test ...

Write and test a simple perl program on the linux platform.  You may use any linux system you wish, including the Suse linux installed in the lab. Activities. Note:  to r

I need help in travel and photo sharing website, Vacation Envy - Travel and...

Vacation Envy - Travel and Photo Sharing Website Site Overview- Vacation Envy is a travel as well as photo-sharing site. Make your travel map, share photos and show off al

Implement a two-dimensional table in prolog, Implement a two-dimensional ta...

Implement a two-dimensional table in Prolog. Your program will contain: 1.  An insert_entry predicate that takes a table, row, column and an entry and inserts the entry at the g

Write a perl program to design a computer game, Write a Perl program ghici....

Write a Perl program ghici.pl, one of the simplest computer games. The program should generate a random integer between 1 and 1000 and asks the user to guess it. If the user ?nds t

Virtual Logic and Arrays, My programming class uses Virtual Logic (not virt...

My programming class uses Virtual Logic (not virtual studio) to learn how to program algorithms but we don''t get any assistance form the instructor so I am at a loss as to how I a

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd