简体   繁体   English

如何合并 tf.data.Dataset 的元素?

[英]How to merge elements of of a tf.data.Dataset?

A quick disclaimer: this is not a noob question about tf.data.Dataset.concat() , tf.data.Dataset.zip() , or tf.data.Dataset.interleave() .快速免责声明:这不是关于tf.data.Dataset.concat()tf.data.Dataset.zip()tf.data.Dataset.interleave() This is about combining the rows of a single dataset, not merging two seperate datasets.这是关于组合单个数据集的行,而不是合并两个单独的数据集。

I wanted to build a Named Entity Recognition (NER) model in TensorFlow.我想在 TensorFlow 中构建一个命名实体识别 (NER) 模型。 I found This Dataset for this task.我为这个任务找到了这个数据集 But each word is on a separate row of the dataset, and I wanted to combine all of the words in a sentence into their own row (It would be more like [Sentence 1, Sentence 2, ...] instead of [Sentence 1, Sentence 1, Sentence 1, ...] ) I don't know if I'm supposed to do NER that way, but I don't know how to merge the rows of the dataset.但是每个单词都在数据集的单独一行上,我想将句子中的所有单词组合到自己的行中(这更像是[Sentence 1, Sentence 2, ...]而不是[Sentence 1, Sentence 1, Sentence 1, ...] ) 我不知道我是否应该那样做 NER,但我不知道如何合并数据集的行。 I did try, but as you can see in this gist , it gives me a strange error.我确实尝试过,但正如您在此要点中所见,它给了我一个奇怪的错误。 How would I merge the rows?我将如何合并行?

Yes, For Named Entity Recognition (NER) dataset looks exactly same as in This Dataset .是的,对于Named Entity Recognition (NER)数据集看起来与此数据集完全相同。 In the dataset each word is annoated with person, location,organization, time etc.数据集中,每个单词都用人、位置、组织、时间等进行注释。
For NER the above dataset can be used as it is without any modification in the rows or columns.对于 NER,上述数据集可以按原样使用,而无需对行或列进行任何修改。 If you still would like to merge/concatenate the rows, please let us know we will help you to resolve.如果您仍想合并/连接行,请告诉我们,我们将帮助您解决。 Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM