mulrel-nel icon indicating copy to clipboard operation
mulrel-nel copied to clipboard

Using trained models to run the tagging process on a custom input

Open oskar-j opened this issue 5 years ago • 1 comments

Hello!

I'm trying to run your tool to wikify (tag) custom input. I successfully run the train mode, than I wrote this code in the main.py file:

    if args.mode == 'test':
        # tagging the standard input
        vecs = ranker.model.rel_embs.cpu().data.numpy()
        ranker.model._coh_ctx_vecs = []
        data = {'Torch': 'A torch is a stick with combustible material at one end, which is ignited and used as a light source.',
                'Microsoft': 'Microsoft Corporation is an American multinational technology company with headquarters in Redmond, Washington. It develops, manufactures, licenses, supports and sells computer software, consumer electronics, personal computers, and related services.'}
        data = ranker.get_data_items(data, predict=True)
        predictions = ranker.predict(data)
        print(predictions)

The goal is to read from the standard input and tag the text (predict entities) line-by-line. Do you reckon it's achievable to return a list of tags with your projects?

Thanks a lot!

oskar-j avatar Jun 19 '19 15:06 oskar-j

Hi. It is unfortunate that the source code is not for testing on input raw texts. There are quite several preprocessing steps to make it work this case, but I'm afraid that I'm not available now to change the code.

lephong avatar Jun 19 '19 16:06 lephong