0

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

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

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

4

1 回答 1

0

我不太确定是否<category="Modifier">应该工作,但据我所知,快速入门中的正确方法是以以下方式进行注释:

{"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(usingstart_offset和),或者您可以在 AutoML UI 中上传 CSV 文件并以交互方式标记实体。end_offset

于 2020-12-17T02:39:52.860 回答