【问题标题】:What is the required data format for Google AutoML ".txt to .jsonl" script?Google AutoML“.txt to .jsonl”脚本所需的数据格式是什么?
【发布时间】:2021-03-21 03:58:22
【问题描述】:

我正在尝试使用他们的脚本在 Google AutoML 中为实体识别任务创建数据集,以将我的 .txt 文件转换为 .jsonl 并将其保存在 Google Cloud Storage 中,如this tutorial 中所述。数据看起来像(来自他们的示例 - NCBI 疾病语料库):

"10021369   Identification of APC2, a homologue of the <category="Modifier">adenomatous polyposis coli tumour<\/category> suppressor .  "

在 GCS 中上传后,标签根本无法识别。什么格式的数据是相关的?

【问题讨论】:

    标签: google-cloud-platform google-cloud-automl google-cloud-automl-nl


    【解决方案1】:

    我不太确定&lt;category="Modifier"&gt; 是否应该工作,但据我所知,Quickstart 中的正确方法是通过以下方式进行注释:

    {"annotations": [
    {"text_extraction": {"text_segment": {"end_offset": 85, "start_offset": 52}}, "display_name": "Modifier"}, 
    {"text_extraction": {"text_segment": {"end_offset": 144, "start_offset": 103}}, "display_name": "Modifier"}, 
    {"text_extraction": {"text_segment": {"end_offset": 391, "start_offset": 376}}, "display_name": "Modifier"}, 
    {"text_extraction": {"text_segment": {"end_offset": 1008, "start_offset": 993}}, "display_name": "Modifier"}, 
    {"text_extraction": {"text_segment": {"end_offset": 1137, "start_offset": 1131}}, "display_name": "SpecificDisease"}], 
    "text_snippet": {"content": "10021369\tIdentification of APC2, a homologue of the adenomatous polyposis coli tumour suppressor .\tThe ... APC - / - colon 
    carcinoma cells . Human APC2 maps to chromosome 19p13 . 3. APC and APC2 may therefore have comparable functions in development and cancer .\n "}
    }
    

    导入数据集后,在 AutoML NL UI 中,您将看到 jsonl 中指定的五个注解:

    如需更多关于上述示例的 jsonl 结构的参考,您可以查看快速入门中的示例文件:

    $ gsutil cat gs://cloud-ml-data/NL-entity/dataset.csv
    TRAIN,gs://cloud-ml-data/NL-entity/train.jsonl
    TEST,gs://cloud-ml-data/NL-entity/test.jsonl
    $ gsutil cat gs://cloud-ml-data/NL-entity/train.jsonl
    

    如果您将 python 脚本用于您自己的文本字符串,您会看到它会生成一个 csv 文件 (dataset.csv) 和 jsonl 文件,其内容如下:

    {"text_snippet": {"content": "This is a disease\n Second line blah blabh"}, "annotations": []} 
    

    因此,您需要指定 annotations(使用 start_offsetend_offset),其手动过程可能有点不堪重负,或者您可以在 AutoML UI 中上传 CSV 文件并以交互方式标记实体。

    【讨论】:

      猜你喜欢
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      • 2021-05-25
      • 2021-12-25
      • 1970-01-01
      • 2014-01-28
      • 1970-01-01
      • 2020-12-26
      相关资源
      最近更新 更多