forked from cltl/OpenDutchWordnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
relation.py
43 lines (33 loc) · 1007 Bytes
/
relation.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
class Relation():
'''
class for XML element Synset
<SynsetRelation provenance="pwn" relType="has_hyperonym" target="eng-30-00322847-v"/>
'''
def __init__(self,relation_el):
self.relation_el = relation_el
def get_provenance(self):
'''
return value provenance attribute
@rtype: str
@return: provenance tag
'''
return self.relation_el.get("provenance")
def get_reltype(self):
'''
return value relType attribute
@rtype: str
@return: relType tag
'''
return self.relation_el.get("relType")
def get_target(self):
'''
return value target attribute
@rtype: str
@return: synset target of relation
'''
return self.relation_el.get("target")
def remove_me(self):
'''
remove relation element
'''
self.relation_el.getparent().remove(self.relation_el)