Bigram 分词
作者:互联网
class Solution {
public:
vector findOcurrences(string text, string first, string second) {
string tmp="";
vectorstr;
vectorans;
for(auto &c:text){
if(c ==’ '){
str.push_back(tmp);
tmp="";
} else
tmp+=c;
}
str.push_back(tmp);
for(int i=2;i<str.size();i++){
if(str[i-2]==first&&str[i-1]==second)
ans.push_back(str[i]);
}
return ans;
}
};
标签:tmp,Bigram,string,text,back,str,push,分词 来源: https://blog.csdn.net/IntgtJzz/article/details/100831961