lephong / mulrel-nel

named entity linking with latent relations
Apache License 2.0
172 stars 36 forks source link

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

Open oskar-j opened 5 years ago

oskar-j commented 5 years ago

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!

lephong commented 5 years ago

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.