%% Specify Document Function with Multiple Inputs
% Tag words by combining the words from one document array with another, using the string function plus.
% Create the first tokenizedDocument array. Erase the punctuation and convert the text to lowercase.

str = [ ...
    "An example of a short sentence."
    "A second short sentence."];
str = erasePunctuation(str);
str = lower(str);
documents1 = tokenizedDocument(str)

% Create the second tokenizedDocument array. The documents have the same number of words as the corresponding documents in documents1. The words of documents2 are POS tags for the corresponding words.

documents2 = tokenizedDocument([ ...
    "_det _noun _prep _det _adj _noun"
    "_det _adj _adj _noun"])
func = @plus;
newDocuments = docfun(func,documents1,documents2)

% The output is not the same as calling plus on the documents directly.

plus(documents1,documents2)

% Copyright 2012 The MathWorks, Inc.