Ejemplo n.º 1
0
 def _create_example(self, lines, set_type):
     examples = []
     for (i, line) in enumerate(lines):
         guid = '%s-%s' % (set_type, i)
         text = tokenization.convert_to_unicode(line[1])
         label = tokenization.convert_to_unicode(line[0])
         examples.append(InputExample(guid=guid, text=text, label=label))
     return examples
Ejemplo n.º 2
0
 def _create_example(self, lines, set_type):
     examples = []
     for (i, line) in enumerate(lines):
         guid = "%s-%s" % (set_type, i)
         text = tokenization.convert_to_unicode(line[1])
         label = tokenization.convert_to_unicode(line[0])
         # if i == 0:
         #     print('label: ', label)
         # print('text:',text)
         # print('label:',label)
         '''
         text: 我 们 变 而 以 书 会 友 , 以 书 结 缘 , 把 欧 美 、 港 台 流 行 的 食 品 类 图 谱 、 画 册 、 工 具 书 汇 集 一 堂 。
         label: O O O O O O O O O O O O O O O B-LOC B-LOC O B-LOC B-LOC O O O O O O O O O O O O O O O O O O O O
         text: 为 了 跟 踪 国 际 最 新 食 品 工 艺 、 流 行 趋 势 , 大 量 搜 集 海 外 专 业 书 刊 资 料 是 提 高 技 艺 的 捷 径 。
         label: O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O
         text: 其 中 线 装 古 籍 逾 千 册 ; 民 国 出 版 物 几 百 种 ; 珍 本 四 册 、 稀 见 本 四 百 余 册 , 出 版 时 间 跨 越 三 百 余 年 。
         label: O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O
         InputExample(guid=guid, text=text, label=label)是一个类的初始化,可通过
         a.guid,a.text,a.label,分别调用属性值
         '''
         examples.append(InputExample(guid=guid, text=text, label=label))
     return examples