私は発話を単語に解析し、それらの単語をリストに保持しようとしています。各リストを発話番号キーで辞書に追加したい。各発話の類似性を他の発話と比較したい。私はこれを試しましたが、うまくいきませんでした。誰でも私を助けてください!
ありがとう
public string[] utterance = new string[4];
Dictionary<string, List> wording = new Dictionary<string, List>();
public void splitit()
{
utterance[0] = "Fish attacked Nemo's parents";
utterance[1] = "Only one fish egg left after fish attacked Nemo's parents and that was Nemo.";
utterance[2] = "Nemo grow up and went to school.";
utterance[3] = "Nemo got bored during the lecture and went to ocean with his friends.";
for (int x=0; x < 4; x++)
{
string[] words = utterance[x].Split(' ');
List<string> Tokens = new List<string>();
foreach (string word in words)
{
Tokens.Add(word);
}
//string parsed = Tokens[1];
//foreach(string tok in Tokens)
//{
// List<string> listing = new List<string>();
// listing.Add (tok);
// wording.Add("utterance"+x, listing);
// //listBox1.Items.Add("utterance"+x+" : "+tok);
//}
for (int w = 0; w < 4; w++)
{
wording.Add("utterance"+x,Tokens);
}
}
}
}
この問題を次のように解決しましたが、現在は機能しています。
for (int x=0; x < 36; x++) {
string[] words = utterance[x].Split(' ');
ArrayList Tokens = new ArrayList();
foreach (string word in words)
{
Tokens.Add(word);
}
ArrayList listing = new ArrayList();
foreach (string tok in Tokens)
{
listing.Add(tok);
}
wording.Add("utterance" + x, listing);
counting = wording["utterance0"].Count;
}