功能词= load_lexicon(filename) % load_lexicon加载情感词汇% lexicon可在https://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html#lexicon fid=fopen(filename);打开文件tline = fgetl(fid);% get new line words = string({});如果~ startwith (tline,';') &&…当新行可用时,ischar(tline) %累计单词%%如果不以分号开始~isempty(tline) %或不是空词(end+1,1) = tline;% add words end tline = fgetl(fid);%获取下一行结束fclose(fid);%关闭文件结束
Baidu
map