% function [counts,words] = getdoc(filename)
%
%  For a file with name filename, this opens
%  it and reads in the lines which are presumed
%  to have an integer followed by a text string.
%  The vector of text strings are returned in
%  words, and the vector of integers in counts.
%
function [counts,words] = getdoc(filename)

	fid = fopen(filename, 'rt');
	k = 1;
	words = [];
	counts = [];
	while feof(fid) == 0
		tline = fgetl(fid);
		cc = pdebsplit(tline);
		counts(k) = str2num(cc(1,:));
		words = strvcat(words,cc(2,:));
		k = k + 1;
	end
	counts = counts(:);
	status = fclose(fid);
