Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiNesterov committed Aug 31, 2023
1 parent 1487d96 commit 90a6d10
Show file tree
Hide file tree
Showing 41 changed files with 6,001 additions and 270 deletions.
32 changes: 22 additions & 10 deletions LODlitParser/odwn.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,13 @@ def get_cs():

return odwn_df

def get_pragmatics_by_synset_id(ids:list, path_odwn:str) -> dict:
def get_pragmatics(ids:list, path_odwn:str, by="synset_id") -> dict:
'''
Get pragmatic values of lemmas by synset IDs
ids: list, synset ids, for example ["temperatuur-n-4", "temperatuur-n-3"]
Get pragmatic values of lemmas by synset IDs or sense IDs
ids: list, synset ids or sense_ids, for example ["temperatuur-n-4", "temperatuur-n-3"]
path_odwn: str, path to the directory with OpenDutchWordnet (not including the module itself, for example "user/Downloads")
Returns dict: {'synset_id': [{'le_id': 'lemma_id',
by: str, how to get pragmatics: by "synset_id" or "sense_id", default is "synset_id"
Returns dict: {'id': [{'le_id': 'lemma_id',
'pragmatics': {'register': None,
'geography': None,
'chronology': None,
Expand All @@ -355,12 +356,23 @@ def get_pragmatics_by_synset_id(ids:list, path_odwn:str) -> dict:

pragmatics_per_le = []

for le in instance.les_all_les_of_one_synset(i):
dict_per_le = {}
dict_per_le["le_id"] = le.get_id()
dict_per_le["pragmatics"] = le.get_pragmatics()
pragmatics_per_le.append(dict_per_le)
if by == "synset_id":

for le in instance.les_all_les_of_one_synset(i):
dict_per_le = {}
dict_per_le["le_id"] = le.get_id()
dict_per_le["pragmatics"] = le.get_pragmatics()
pragmatics_per_le.append(dict_per_le)

if by == "sense_id":

for le in instance.les_get_generator():
if le.get_sense_id() == i:
dict_per_le = {}
dict_per_le["le_id"] = le.get_id()
dict_per_le["pragmatics"] = le.get_pragmatics()
pragmatics_per_le.append(dict_per_le)

pragmatics[i] = pragmatics_per_le

return pragmatics
return pragmatics
126 changes: 0 additions & 126 deletions RQ2/odwn_explicit.ipynb

This file was deleted.

132 changes: 0 additions & 132 deletions RQ2/pwn_markers.ipynb

This file was deleted.

Loading

0 comments on commit 90a6d10

Please sign in to comment.