%% Remove Documents from Bag-of-Words Model
% Remove selected documents from a bag-of-words model.

documents = tokenizedDocument([ ...
    "an example of a short sentence" 
    "a second short sentence"
    "a third example"
    "a final sentence"]);
bag = bagOfWords(documents)

% Remove the first and third documents from bag.

idx = [1 3];
newBag = removeDocument(bag,idx)

% Remove the same documents using logical indices.

idx = logical([1 0 1 0]);
newBag = removeDocument(bag,idx)

% Copyright 2012 The MathWorks, Inc.