jazzyarchitects / fasttext-node

Node wrapper around FastText Library
MIT License
57 stars 4 forks source link

Issue on running the example on readme #4

Closed tuananh closed 6 years ago

tuananh commented 6 years ago

Issue on running the example on readme

(node:8943) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'split' of undefined

the code

const FastText = require('fasttext-node')

const fastText = new FastText()

const trainFileUri =
    'https://raw.githubusercontent.com/jazzyarchitects/fasttext-node/master/train.txt'

async function train() {
    const trainResult = await fastText.train(trainFileUri, {
        /* options */
        epoch: 50,
        lr: 0.01
    })

    const options = {
        labelCount: 3
    }

    const result = await fastText.predict(
        [
            'Custard Pudding tasting like raw eggs',
            'Is Himalayan pink salt the same as the pink salt used for curing?'
        ],
        options
    )

    console.log(result);
}

try {
    train() // because i cant use await top level yet
} catch(err) {
    console.log(err);
}
jazzyarchitects commented 6 years ago

@tuananh Can you check with the updated version of the library? I have just updated it. It should have been fixed.

If not can you specify the OS you are using?

tuananh commented 6 years ago

yeah, i change to use github url in dependency and it works fine. figure the published package might not be the the latest in master.