Synonyms
create_skos_dictionary(synonyms, video_id, mode, language)
Create SKOS dictionary from a dict with synonyms.
Creates an RDF graph with SKOS vocabulary structure from a dictionary of words and their synonyms.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
synonyms
|
dict
|
Dictionary with words as keys and lists of synonyms as values |
required |
video_id
|
str
|
Identifier for the video |
required |
mode
|
str
|
Mode of operation for the annotator |
required |
language
|
str
|
Language code for the labels |
required |
Returns:
Type | Description |
---|---|
dict
|
JSON-LD representation of the SKOS dictionary |
Notes
The output follows the W3C Web Annotation Data Model context and includes custom Edurell namespace references
Source code in apps/annotator/code/text_processor/synonyms.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
get_synonyms_from_list(concepts)
Find synonyms from a list of words using WordNet NLTK.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
concepts
|
list
|
List of words to find synonyms for |
required |
Returns:
Type | Description |
---|---|
dict
|
Dictionary with words as keys and lists of found synonyms as values |
Notes
Words with spaces are converted to underscore format for WordNet lookup and converted back to spaces in the output
Source code in apps/annotator/code/text_processor/synonyms.py
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 |
|