#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 11/9/19 8:00 PM
# @Author  : zchai
from allennlp.common import JsonDict
from allennlp.data import Instance, DatasetReader
from allennlp.models import Model
from allennlp.predictors import Predictor


class MySeqPredictor(Predictor):

    def __init__(self, model: Model, dataset_reader: DatasetReader) -> None:
        super().__init__(model, dataset_reader)
        self._model = model
        self._dataset_reader = dataset_reader

    def _json_to_instance(self, json_dict: JsonDict) -> Instance:
        source_tokens = json_dict['source_tokens']
        gold_mentions = json_dict['gold_mentions']

        return self._dataset_reader.text_to_instance(source_tokens, gold_mentions)
3e2c2ec9a3b8c1d6eb68b156c11b00fe7aef2eff
<mask token>


class MySeqPredictor(Predictor):
    <mask token>
    <mask token>

<mask token>


class MySeqPredictor(Predictor):
    <mask token>

    def _json_to_instance(self, json_dict: JsonDict) ->Instance:
        source_tokens = json_dict['source_tokens']
        gold_mentions = json_dict['gold_mentions']
        return self._dataset_reader.text_to_instance(source_tokens,
            gold_mentions)

<mask token>


class MySeqPredictor(Predictor):

    def __init__(self, model: Model, dataset_reader: DatasetReader) ->None:
        super().__init__(model, dataset_reader)
        self._model = model
        self._dataset_reader = dataset_reader

    def _json_to_instance(self, json_dict: JsonDict) ->Instance:
        source_tokens = json_dict['source_tokens']
        gold_mentions = json_dict['gold_mentions']
        return self._dataset_reader.text_to_instance(source_tokens,
            gold_mentions)

from allennlp.common import JsonDict
from allennlp.data import Instance, DatasetReader
from allennlp.models import Model
from allennlp.predictors import Predictor


class MySeqPredictor(Predictor):

    def __init__(self, model: Model, dataset_reader: DatasetReader) ->None:
        super().__init__(model, dataset_reader)
        self._model = model
        self._dataset_reader = dataset_reader

    def _json_to_instance(self, json_dict: JsonDict) ->Instance:
        source_tokens = json_dict['source_tokens']
        gold_mentions = json_dict['gold_mentions']
        return self._dataset_reader.text_to_instance(source_tokens,
            gold_mentions)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 11/9/19 8:00 PM
# @Author  : zchai
from allennlp.common import JsonDict
from allennlp.data import Instance, DatasetReader
from allennlp.models import Model
from allennlp.predictors import Predictor


class MySeqPredictor(Predictor):

    def __init__(self, model: Model, dataset_reader: DatasetReader) -> None:
        super().__init__(model, dataset_reader)
        self._model = model
        self._dataset_reader = dataset_reader

    def _json_to_instance(self, json_dict: JsonDict) -> Instance:
        source_tokens = json_dict['source_tokens']
        gold_mentions = json_dict['gold_mentions']

        return self._dataset_reader.text_to_instance(source_tokens, gold_mentions)