Tensorflow.js tokenizer

后端 未结 3 1869
南笙
南笙 2020-12-10 17:32

I\'m new to Machine Learning and Tensorflow, since I don\'t know python so I decide to use there javascript version (maybe more like a wrapper).

The problem

3条回答
  •  借酒劲吻你
    2020-12-10 17:52

    const vocabulary = ["machine", "learning", "is", "a", "new", "field", "in", "computer", "science"]
    const text = ["machine", "is", "a", "field", "machine", "is", "is"] 
    const parse = (t) => vocabulary.map((w, i) => t.reduce((a, b) => b === w ? ++a : a , 0))
    console.log(parse(text))

提交回复
热议问题