I am trying to get the reformulations from the reformulator but I get all nonsensical reformulations like this-
My questions were- ['how can i apply for nsa?', 'what is the minimum working hours required for a day?']
I used this code to get the reformulations-
from px.nmt import reformulator
from px.proto import reformulator_pb2
questions = ['how can i apply for nsa?', 'what is the minimum working hours required for a day?']
reformulator_instance = reformulator.Reformulator(
hparams_path='px/nmt/example_configs/reformulator.json',
source_prefix='<en> <2en> ',
out_dir='path/to/reformulator_dir',
environment_server_address='localhost:10000')
# Change from GREEDY to BEAM if you want 20 rewrites instead of one.
responses = reformulator_instance.reformulate(
questions=questions,
inference_mode=reformulator_pb2.ReformulatorRequest.GREEDY)
# Since we are using greedy decoder, keep only the first rewrite.
reformulations = [r[0].reformulation for r in responses]
print reformulations
I am trying to get the reformulations from the reformulator but I get all nonsensical reformulations like this-
My questions were- ['how can i apply for nsa?', 'what is the minimum working hours required for a day?']
I used this code to get the reformulations-