【问题标题】:How to write an @overrides allennlp predictor.load_line?如何编写@overrides allennlp predictor.load_line?
【发布时间】:2019-05-27 05:58:03
【问题描述】:

AllenNLP 有一个预测函数,它接收一个 JSON 文件,然后输出一个 JSON 文件。从文档中可以@overrides predictor.load_line 并写入一个函数来接收一个文本文件。

你会如何编写这个函数?以及如何实现该功能(即作为模块导入)?

AllenNLP load_line API:https://allenai.github.io/allennlp-docs/api/allennlp.predictors.html?highlight=sentencetaggerpredictor#allennlp.predictors.predictor.Predictor

我正在学习这里的教程: https://github.com/allenai/allennlp/blob/master/tutorials/tagger/README.md

【问题讨论】:

    标签: python natural-language-processing allennlp


    【解决方案1】:

    您可以在驱动器上本地安装 AllenNLP 框架,然后在那里手动更新代码。在重新加载更改后恢复正常功能。

    或者,您可以dynamically update the class method。这就像修补第三方代码并确保更新沿链分发。 Another article here.

    【讨论】:

    • 这是一个非常笼统的答案。我正在寻找带有装饰器@overrides 的东西以及将文本文件读入函数的代码。
    • @bottledatthesource 您的问题也很笼统,并没有表现出太多的努力。有这样的问题很可能得到这样的答案。
    猜你喜欢
    • 2022-01-13
    • 2021-06-22
    • 2021-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-23
    • 2021-05-24
    • 1970-01-01
    相关资源
    最近更新 更多