フィルターのクリア

tf weighting in docs

1 回表示 (過去 30 日間)
John
John 2017 年 12 月 2 日
How do I evaluate term frequency (how many times each term occurs in a document) from a notepad having multiple documents, started by a document ID <P ID=xxx> and separated by delimiters </P>. I need to distinguish the statistics for each document.
I have been able to load the text, but my regular approach of identifying document ID won't work because the IDs are not contiguous, and as such, 'n' cannot be used to increment doc ID.
% The notepad file has been loaded into variable C
C = C{1};
fclose(fid);
idx = strfind(C,'</P>');
n = nnz(cellfun(@(x) ~isempty(x), idx));
fileName = ('DTags.txt');
fid = fopen(fileName,'w+');
for kk = 1:n
str = ['<p id=',num2str(kk),'>'];
fileName = ('DTags.txt');
fid = fopen(fileName,'a+');
fprintf(fid,'%s\r\n',str);
fclose(fid);
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeVariables についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by