关系抽取之PCNN(Piece-Wise-CNN)

下图清晰了显示了PCNN的整个网络架构,PCNN的实现过程:

  1. 数据预处理:首先对数据进行位置编码,按句子中各个词离entity的距离进行编码。

例如:“As we known,Steve Jobs was the co-founder of Apple Inc which is a great company in America.”
由于句子中有两个entity,所以这条句子就会产生两个和句子长度相同的编码。
pos_1:[-4,-3,-2,-1,0,1,2,3......] ,其中0就是Steve Jobs的位置。
pos_2:[-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3......] 其中0就是Apple Inc的位置。

  1. 切分句子:其中最主要的就是将一条文本数据在两个entity处各切一刀将文本且成了3段。(注意,位置向量也同样进行了切分操作)

比如 As we known,Steve Jobs was the co-founder of Apple Inc which is a great company in America,将被切成:

As we known,Steve Jobs

Steve Jobs was the co-founder of Apple Inc

Apple Inc which is a great company in America.

  1. 特征提取:将位置特征和文本特征拼接之后,然后将上面三个数据分别通过CNN 提取特征
  2. 关系分类:提取出来的特征通过maxpooling层之后进行拼接后送入softmax层,最终得到relation的分类。

  从上面PCNN的流程可以发现,这个网络结构很注重entitiy之间的距离信息,位置信息,以及entitiy之间或者左右的信息。其实这些都是是关系抽取中最重要的特征。

  1.  一般来说两个entitiy之间距离越近,则他们有关系的可能性越大。
  2.   而透露出entities之间有关系的词一般会出现在两个entity之间,左侧,或者右侧。

例如:Steve Jobs was the co-founder of Apple Inc , 关系词 co-founder就在两个entity之间

你可能感兴趣的:(学习新知识,关系抽取)