Home

Awesome

en-pos

A better English POS tagger written in JavaScript

Installation and usage

Install via NPM:

npm i --save en-pos

How to use

const Tag = require("en-pos").Tag;
var tags = new Tag(["this","is","my","sentence"])
.initial() // initial dictionary and pattern based tagging
.smooth() // further context based smoothing
.tags;
console.log(tags);
// ["DT","VBZ","PRP$","NN"]

Annotation Specification

AnnotationNameExample
NNNoundog man
NNSPlural noundogs men
NNPProper nounLondon Alex
NNPSPlural proper nounSmiths
VBBase form verbbe
VBPPresent form verbthrow
VBZPresent form (3rd person)throws
VBGGerund form verbthrowing
VBDPast tense verbthrew
VBNPast participle verbthrown
MDModal verbcan shall will may must ought
JJAdjectivebig fast
JJRComparative adjectivebigger
JJSSuperlative adjectivebiggest
RBAdverbnot quickly closely
RBRComparative adverbless-closely faster
RBSSuperlative adverbfastest
DTDeterminerthe a some both
PDTPredeterminerall quite
PRPPersonal PronounI you he she
PRP$Possessive PronounI you he she
POSPossessive ending's
INPrepositionof by in
PRParticleup off
TOtoto
WDTWh-determinerwhich that whatever whichever
WPWh-pronounwho whoever whom what
WP$Wh-possessivewhose
WRBWh-adverbhow where
EXExpletive therethere
CCCoordinating conjugation& and nor or
CDCardinal Numbers1 7 77 one
LSList item marker1 B C One
UHInterjectionah oh oops
FWForeign Wordsviva mon toujours
,Comma,
:Mid-sent punct: ; ...
.Sent-final punct.. ! ?
(Left parenthesis) } ]
)Right parenthesis( { [
#Pound sign#
$Currency symbols$ £ ¥
SYMOther symbols+ * / < >
EMEmojis & emoticons:)

Accuracy and performance

TL:DR;


As of 25 Jan 2017, this library scored 96.43% at the Penn Treebank test (0.3% away from being a state of the art tagger).

Being written in JavaScript, I think it's safe to say that this is the most accurate JavaScript POS tagger, since the only JS library I know of is pos-js which when I tested on the same treebank scored 87.8%, though it was faster than my implementation when smoothing is enabled.

However, if performance is what's you're after rather than accuracy, then you have the option to disable smoothing in this library and this will marginally increase performance making this library even faster than pos-js but with far better accuracy (94.4%).

Building from source and testing

Credits