Example of how to use Stanford PoS Tagger from Matlab
Latest commit 3bbcfbf Jan 29, 2017 @musically-ut committed on GitHub Update README to contain @johnnykast's setup.
Failed to load latest commit information.
PosTaggerM.m Update year on license. Dec 26, 2014
README.md Update README to contain @johnnykast's setup. Jan 29, 2017


A small function to show how to use the stanford-pos-tagger in Matlab.


It requires the following files:

  1. english-left3words-distsim.tagger in the current path while running it. It can be found in $STANFORD_POS_TAGGER_PATH/models/
  2. stanford-postagger.jar should be added to the classpath. Matlab command to do it: javaaddpath('$STANFORD_POS_TAGGER_PATH/stanford-postagger.jar')


To run it simply drop it in the current working directory and run:


Sample input:

This is a very small sample sentence for test purpose - Chomsky.

Sample output:

[This/DT, is/VBZ, a/DT, very/RB, small/JJ, sample/NN, sentence/NN, for/IN, test/NN, purpose/NN, -/:, Chomsky/NNP, ./.]

The result is an ArrayList of TaggedWords.

Note on performance:: See discussion on this issue.


Verified to work on:

  • 3.3.1 and 3.4.1 of the tagger
  • Matlab version 2010a and (R2014a)
  • JRE 7 (version: 1.7)


This was initially hosted on my homepage. Douglas found the code and improved it to work with the latest version of the tagger.

@johnnykast helped debug some compatibility issues.