my 2D array has sentences, their tokens and their tags. I want to remove all the other tags Except nouns and verbs. I want to remove the whole index which is not verb/noun. Right now my code is just placing a null on that index. but i want that index to be removed from the array. my code is:
HashSet<String> tagsToRemove = new HashSet<String>() { "'NN'", "'NNS'", "'VBD'", "'VBG'", "'VBZ'", "'VB'" };
for (int i = 0; i < array2D_of_tags.GetLength(0); ++i)
{
if (!tagsToRemove.Contains(array2D_of_tags[i, 2]))
array2D_of_tags[i, 2] = null;
//Console.WriteLine(array2D_of_tags[i, 2]);
}
this is the data in the array2D_of_tags:
A supplier supplies many parts. | 'A' | 'DT' |
A supplier supplies many parts. | 'supplier' | 'NN' |
A supplier supplies many parts. | 'supplies' | 'NNS' |
A supplier supplies many parts. | 'many' | 'JJ' |
A supplier supplies many parts. | 'parts' | 'NNS' |
A supplier supplies many parts. | '.' | '.' |