だから私はプログラムを書いており、その一部は文字列の配列を処理することであり、文字列配列の各要素から、文字列内のすべてのバイグラムを取り出して別の配列に配置しようとしています。substr 関数を使用してこれを実行しようとしており、微調整を試みましたが、引き続き OOR エラーが発生します。
コードは次のとおりです。
「numwords」は文字列配列内の単語数で、「lowpunct」は文字列の配列です
for(i=0; i<numwords;i++)
{
for(x=0; x<=lowpunct[i].length()-2;x++)
{
if(lowpunct[i].length()-2 <=0)
{
bigram[count]=lowpunct[i];
count++;
}
else
{
bistring=lowpunct[i].substr(x,2);
bigram[count]=bistring;
count++;
bistring="";
}
}
}