See the assignment turn-in page (last modified on 18 January 2006) for instructions on turning in your assignment.
Given a word w in a text, the n-neighbor tree T of w is a tree with w at its root and has the following properties true for every subtree of T:
The program should accept one or two command-line arguments. If there is one command-line argument, it should be taken as the name of the file containing the text to be analyzed. If there are two command-line arguments, the first should be taken as the name of a file containing stop words and the second should be taken as the name of the file containing the text to be analyzed.
A stop word is a word that should be ignored if it appears in the text being analyzed. If no stop words are given, all words in the text should be part of the analysis.
For example, in the command
$ nn-tree wealth.txt
wealth.txt
is the name of the file containing the text to be analyzed. In
the command line
$ nn-tree ignore origins.txt
ignore
is the name of the file containing stop words and origins.txt
is the name of the file containing the text to be analyzed.
word nwhere word is the word that should appear at the root of the n-neighbor tree created and n is a non-negative integer. For example, the specification
Specifies a 3-neighbor tree for the word "nail".? nail 3
stop-words
in the
/export/home/class/CS-503/a4
assignment directory contains an example stop-word file.
Under non-error conditions, the program outputs an n-neighbor tree by calling the procedure
Passing a pointer to the root of the tree orvoid show_tree(const tree_node * const);
0
if there is no tree. The
file show-tree.cc
in the /export/home/class/CS-503/a4
assignment directory
contains the code for show_tree()
. This file should be
compiled and linked in to your code.
The definition for tree-node used by show_tree()
can be found in the file
tree-node.h
, which can also be found in the assignment directory. You may
extend this definition any way you see fit, but you should not change the
declarations for the existing member functions (tree_node::child_count()
,
tree_node::get_child()
, and tree_node:: get_word()
).
Error messages should be brief and informative, and written to std-out (not std-err) preceded by "! " (that is, an exclamation point followed by a space).
This page last modified on 22 March 2006. |