-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathextractor.py
56 lines (45 loc) · 1.64 KB
/
extractor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
# Relation Extraction Skeleton
# ==========================================
#
# Author: Jianbin Qin <[email protected]>
from relation import Relation
def extract_date_of_birth(sentence):
predicate = "DateOfBirth"
results = []
#print("called")
############################################################
# Replace this part to your own code of extract DataOfBirth.
#
# If you identify one relation. Use the following code to add
# into relations.
# Naive Solution:
from sample_solution import sample_extract_date_of_birth
from relation_test import extract_date_relations
# results.extend(sample_extract_date_of_birth(sentence))
results.extend(extract_date_relations(sentence))
#
# rel = Relation("Subject", predicate, "Object")
# results.append(rel)
#
############################################################
return results
def extract_has_parent(sentence):
predicate = "HasParent"
results = []
############################################################
# Replace this part to your own code of extract HasParent.
#
# If you identify one relation. Use the following code to add
# into relations.
# Naive Solution:
# from sample_solution import sample_extract_has_parent
# results.extend(sample_extract_has_parent(sentence))
from relation_test import extract_parent_relations
results.extend(extract_parent_relations(sentence))
#
# rel = Relation("Subject", predicate, "Object")
# results.append(rel)
#
############################################################
return results