|
@@ -260,7 +260,7 @@ class Model_relation_extraction():
|
|
|
|
|
|
def predict(self,text_in, words, rate=0.5):
|
|
|
# text_words = text_in
|
|
|
- R = []
|
|
|
+ triple_list = []
|
|
|
# _t2 = [self.words2id.get(c, 1) for c in words]
|
|
|
_t2 = np.zeros((len(words), self.words_size))
|
|
|
for i in range(len(words)):
|
|
@@ -292,8 +292,8 @@ class Model_relation_extraction():
|
|
|
for _ooo1, _c1 in zip(*_oo1):
|
|
|
_object = text_in[_ooo1]
|
|
|
_predicate = self.id2predicate[_c1]
|
|
|
- R.append((_subject[0], _predicate, _object))
|
|
|
- return R
|
|
|
+ triple_list.append((_subject[0], _predicate, _object))
|
|
|
+ return triple_list
|
|
|
else:
|
|
|
return []
|
|
|
|