1.0.0 • Published 5 years ago

term-vector v1.0.0

Weekly downloads
4,675
License
-
Repository
github
Last release
5 years ago

NPM version NPM downloads MIT License Build Status

term-vector

A node.js module that creates a term vector from tokenized text. Use term-vector when implementing a vector space model

Works with Unicode!

Does ngrams!

const tokens = 'this is really really really cool'.split(' ')

// just make a simple term vector
tv(tokens)
// [
//   { term: [ 'cool' ], positions: [ 5 ] },
//   { term: [ 'is' ], positions: [ 1 ] },
//   { term: [ 'really' ], positions: [ 2, 3, 4 ] },
//   { term: [ 'this' ], positions: [ 0 ] }
// ]

// make a term vector with ngrams of length 1 and 2
tv(tokens, { ngramLengths: [ 1, 2 ] })
// [
//   { term: [ 'cool' ], positions: [ 5 ] },
//   { term: [ 'is' ], positions: [ 1 ] },
//   { term: [ 'is', 'really' ], positions: [ 1 ] },
//   { term: [ 'really' ], positions: [ 2, 3, 4 ] },
//   { term: [ 'really', 'really' ], positions: [ 2, 3 ] },
//   { term: [ 'really', 'cool' ], positions: [ 4 ] },
//   { term: [ 'this' ], positions: [ 0 ] },
//   { term: [ 'this', 'is' ], positions: [ 0 ] }
// ]
1.0.0

5 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago