-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathokgraph_class_star_deep2.html
More file actions
212 lines (169 loc) · 235 KB
/
Copy pathokgraph_class_star_deep2.html
File metadata and controls
212 lines (169 loc) · 235 KB
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
57
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vis-network@latest/styles/vis-network.css" type="text/css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vis-network@latest/dist/vis-network.min.js"> </script>
<center>
<h1></h1>
</center>
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
<style type="text/css">
#mynetwork {
width: 800px;
height: 800px;
background-color: #ffffff;
border: 1px solid lightgray;
position: relative;
float: left;
}
#loadingBar {
position:absolute;
top:0px;
left:0px;
width: 800px;
height: 800px;
background-color:rgba(200,200,200,0.8);
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
opacity:1;
}
#bar {
position:absolute;
top:0px;
left:0px;
width:20px;
height:20px;
margin:auto auto auto auto;
border-radius:11px;
border:2px solid rgba(30,30,30,0.05);
background: rgb(0, 173, 246); /* Old browsers */
box-shadow: 2px 0px 4px rgba(0,0,0,0.4);
}
#border {
position:absolute;
top:10px;
left:10px;
width:500px;
height:23px;
margin:auto auto auto auto;
box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
border-radius:10px;
}
#text {
position:absolute;
top:8px;
left:530px;
width:30px;
height:50px;
margin:auto auto auto auto;
font-size:22px;
color: #000000;
}
div.outerBorder {
position:relative;
top:400px;
width:600px;
height:44px;
margin:auto auto auto auto;
border:8px solid rgba(0,0,0,0.1);
background: rgb(252,252,252); /* Old browsers */
background: -moz-linear-gradient(top, rgba(252,252,252,1) 0%, rgba(237,237,237,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(252,252,252,1)), color-stop(100%,rgba(237,237,237,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
border-radius:72px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
}
</style>
</head>
<body>
<div id = "mynetwork"></div>
<div id="loadingBar">
<div class="outerBorder">
<div id="text">0%</div>
<div id="border">
<div id="bar"></div>
</div>
</div>
</div>
<script type="text/javascript">
// initialize global variables.
var edges;
var nodes;
var network;
var container;
var options, data;
// This method is responsible for drawing the graph, returns the drawn network
function drawGraph() {
var container = document.getElementById('mynetwork');
// parsing and collecting nodes and edges from the python
nodes = new vis.DataSet([{"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field89", "label": "woc:field89\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class4", "label": "woc:class4\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field35", "label": "woc:field35\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter58", "label": "woc:parameter58\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class43", "label": "woc:class43\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/constructor3", "label": "woc:constructor3\nConstructor\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "17", "label": "17\nint\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field60", "label": "woc:field60\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/returnstatement16", "label": "woc:returnstatement16\nReturnStatement\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/method4", "label": "woc:method4\nMethod\nDeep 1", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/field31", "label": "woc:field31\nField\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/constructor4", "label": "woc:constructor4\nConstructor\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\n\nclass OKgraph:\n \"\"\"A class used to extract knowledge from unstructured text corpus.\n\n This class currently focuses on the following tasks:\n - **set expansion**: given one or a short set of words, continues this\n set with a list of other \u0027same-type\u0027 words (`co-hyponyms\n \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy#Co-hyponyms\u003e`_);\n - **relation expansion**: given one or a short set of word pairs,\n continues this set with a list of pairs having the same implicit\n relation of the given pairs;\n - **set labeling**: given one or a short set of words, returns a list\n of short strings (labels) describing the given set (its type or\n `hyperonym \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy\u003e`_);\n - **relation labeling**: given one or a short set of word pairs,\n returns a list of short strings (labels) describing the relation in\n the given set;\n All the tasks work with plain text corpus (untagged).\n\n Attributes:\n corpus (str): path of the corpus file.\n embeddings (MagnitudeWordEmbeddings): words embeddings (vector\n model).\n index (str): path of the indexed corpus files.\n dictionary (str): path of the corpus dictionary.\n\n \"\"\"\n corpus: str\n embeddings: MagnitudeWordEmbeddings\n index: str\n dictionary: str\n \n def __init__(self, corpus_file: str, embeddings_file: str = None, k: int = 5, stream: bool = False, lazy_loading: int = 0, index_dir: str = None, dictionary_file: str = None, force_init: bool = False):\n \"\"\"The constructor creates a OKgraph object.\n\n Loads or generates the word embeddings, corpus index and corpus\n dictionary, whether or not they already exist.\n\n Args:\n corpus_file (str): path of the corpus file. The corpus file should\n be a cleaned free text file (untagged).\n embeddings_file (MagnitudeWordEmbeddings): path or URL of the\n embeddings file. FIXME: do not correctly handle URLs.\n The supported embeddings are *.magnitude*, *.bin*, *.txt*,\n *.vec* and *.hdf5*. The *.bin*, *.txt*, *.vec* and *.hdf5*\n embeddings are supported by automatically converting them to a\n *.magnitude* file. No extension will be treated as *.magnitude*.\n If the embeddings file is not specified, the default path\n points to a *.magnitude* file with the same basename of the\n corpus file.\n If the specified file is found in the path, the embeddings is\n directly loaded.\n If the specified *.magnitude* file is not found, an embeddings\n Magnitude model is created from the text corpus.\n If the specified *.bin*, *.txt*, *.vec* or *.hdf5* file is not\n found a ValueError is raised, because these models can be\n loaded but not created.\n k (int): embeddings can be queried to know the words whose vector\n representation is similar to a known vector. The OKgraph tasks\n could be using this functionality to extract their results:\n usually, the more results you are expecting from the task, the\n more words you are expecting from the embeddings.\n *k* should be set to the approximate upper-bound of the number\n of results that will be expected from the embeddings. If the\n exact number is unknown, be conservative picking a large number,\n while keeping in mind the bigger *k* is, the more memory it\n will consume.\n stream (bool): stream the URL instead of downloading it.\n lazy_loading (int): allows faster cold start when loading:\n\n +----+-------------------------------------------+\n | -1 | preload into memory |\n +----+-------------------------------------------+\n | 0 | lazy loads with unbounded in-memory cache |\n +----+-------------------------------------------+\n | \u003e0 | lazy loads with an LRU cache of that size |\n +----+-------------------------------------------+\n index_dir (str): path of the indexed corpus files directory.\n If the index directory is not specified, the default path\n points to a directory named *indexdir* with the same parent\n directory of the corpus.\n If the directory exists it is used as it is, otherwise it is\n created.\n dictionary_file (str): path of the corpus dictionary file.\n The supported files are *.npy*. No extension will be treated as\n *.npy*.\n If the dictionary file is not specified, the default path\n points to a file named *dictTotal.npy* with the same parent\n directory of the corpus.\n If the file exists it is used as it is, otherwise it is created.\n force_init (bool): forces the initialization of the embeddings,\n index and dictionary from scratch, overwriting them if already\n existing.\n\n Example:\n - Instantiating an OKgraph object specifing a corpus file:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e okg = OKgraph(corpus)\n or even\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No path have been specified for the embeddings, index directory\n and dictionary, so the default paths (same of the corpus)\n \u0027/OKgraph/Example/enwik9.magnitude\u0027,\n \u0027/OKgraph/Example/indexdir/\u0027, \u0027/OKgraph/Example/dictTotal.npy\u0027\n are implicitly used.\n All the resources will be searched in the default paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus).\n\n\n - Instantiating an OKgraph object specifing the resources paths:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e embeddings = \"/OKgraph/Example/NewDir/enwiki9_embeddings\"\n \u003e\u003e\u003e index = \"/OKgraph/Example/NewDir/enwiki9_index\"\n \u003e\u003e\u003e dictionary = \"/OKgraph/Example/NewDir/enwiki9_dictionary\"\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus,\n \u003e\u003e\u003e embeddings_file=embeddings,\n \u003e\u003e\u003e index_dir=index,\n \u003e\u003e\u003e dictionary_file=dictionary)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No extension has been specified for the embeddings and the\n dictionary, so the *.magnitude* and *.npy* exntensions will be\n automatically appended.\n All the resources will be searched in the specified paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus). In the above example, the resources\n are missing and they will be created in the new directory\n *NewDir*. *NewDir* will be automatically created.\n\n \"\"\"\n corpus_file = path.normpath(corpus_file)\n if not path.exists(corpus_file):\n raise NotExistingCorpusException(corpus_file)\n if embeddings_file is not None:\n embeddings_file = path.normpath(embeddings_file)\n if index_dir is not None:\n index_dir = path.normpath(index_dir)\n if dictionary_file is not None:\n dictionary_file = path.normpath(dictionary_file)\n embeddings_file = self._get_embeddings(corpus_file, embeddings_file, force_init)\n index_dir = self._get_index(corpus_file, index_dir, force_init)\n dictionary_file = self._get_dictionary(corpus_file, dictionary_file, force_init)\n self.embeddings = MagnitudeWordEmbeddings(embeddings_file, k, stream, lazy_loading)\n self.corpus = corpus_file\n self.index = index_dir\n self.dictionary = dictionary_file\n \n @staticmethod\n def _get_embeddings(corpus_file: str, embeddings_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the embeddings whether or not it is already\n existing.\n\n FIXME: do not work with URLs, just with files.\n\n Args:\n corpus_file (str): path of the corpus file.\n embeddings_file (str): path of the embeddings file.\n force_init (bool): if True forces the creation of the embeddings.\n\n Returns:\n str: the path of the loaded/generated Magnitude model.\n\n \"\"\"\n if embeddings_file is None:\n (corpus_basename, _) = path.splitext(corpus_file)\n embeddings_file = corpus_basename + \u0027.magnitude\u0027\n logger.info(f\u0027Embeddings file for corpus {corpus_file} not specified. Referencing to default value {embeddings_file}\u0027)\n else:\n embeddings_file = check_extension(file_name=embeddings_file, default_extension=\u0027.magnitude\u0027, allowed_extensions=[\u0027.magnitude\u0027, \u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027])\n (embeddings_basename, embeddings_extension) = path.splitext(embeddings_file)\n magnitude_file = embeddings_basename + \u0027.magnitude\u0027\n if path.exists(embeddings_file) and force_init is True:\n logger.info(f\u0027Removing existing embeddings file {embeddings_file} to generate it again\u0027)\n remove(embeddings_file)\n if embeddings_extension == \u0027.magnitude\u0027:\n if path.exists(embeddings_file):\n logger.info(f\u0027Specified embeddings file {embeddings_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified embeddings file {embeddings_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n embeddings_file = FileConverter.corpus_to_magnitude_model(corpus_file, embeddings_file)\n elif embeddings_extension in [\u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027]:\n if path.exists(magnitude_file):\n logger.info(f\u0027The Magnitude model {magnitude_file} related to the specified {embeddings_file} embeddings already exists: using it\u0027)\n embeddings_file = magnitude_file\n elif path.exists(embeddings_file):\n logger.info(f\u0027Generating Magnitude model from specified {embeddings_file} embeddings\u0027)\n FileConverter.generic_model_to_magnitude_model(embeddings_file, magnitude_file)\n embeddings_file = magnitude_file\n else:\n raise ValueError(f\u0027Specified embeddings file {embeddings_file} does not exists: it cannot be loaded and it cannot be generated (its not a Magnitude model)\u0027)\n return embeddings_file\n \n @staticmethod\n def _get_index(corpus_file: str, index_dir: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the index whether or not it is already existing.\n\n Args:\n corpus_file: path of the corpus file.\n index_dir: path of the index directory.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated index directory.\n\n \"\"\"\n if index_dir is None:\n index_dir = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_INDEX_FOLDER))\n logger.info(f\u0027Indexing directoy for corpus {corpus_file} not specified. Referencing to default value {index_dir}\u0027)\n if path.exists(index_dir) and force_init is True:\n logger.info(f\u0027Removing existing indexing directory {index_dir} to generate it again\u0027)\n remove_dir(index_dir)\n if path.exists(index_dir):\n logger.info(f\u0027Specified index directory {index_dir} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified indexing directory {index_dir} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n ix = Indexing(corpus_path=corpus_file)\n ix.indexing(index_path=index_dir)\n del ix\n return index_dir\n \n @staticmethod\n def _get_dictionary(corpus_file: str, dictionary_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the dictionary whether or not it is already\n existing.\n\n Args:\n corpus_file: path of the corpus file.\n dictionary_file: path of the dictionary file.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated dictionary file.\n\n \"\"\"\n if dictionary_file is None:\n dictionary_file = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_DICTIONARY_NAME))\n logger.info(f\u0027Dictionary file for corpus {corpus_file} not specified. Referencing to default value {dictionary_file}\u0027)\n else:\n dictionary_file = check_extension(file_name=dictionary_file, default_extension=\u0027.npy\u0027, allowed_extensions=[\u0027.npy\u0027])\n if path.exists(dictionary_file) and force_init is True:\n logger.info(f\u0027Removing existing dictionary file {dictionary_file} to generate it again\u0027)\n remove(dictionary_file)\n if path.exists(dictionary_file):\n logger.info(f\u0027Specified dictionary file {dictionary_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified dictionary file {dictionary_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n generate_dictionary(corpus_file, dictionary=dictionary_file, save_dictionary=True)\n return dictionary_file\n \n def relation_expansion(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[Tuple[str, ...]]:\n \"\"\"Finds tuples with the same implicit relation of the seed tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be\n expanded.\n k (int): limit to the number of result tuples.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[Tuple[str, ...]]: the list of tuples related to the seed\n tuples.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027relation_labeling_algo\u0027: \u0027intersection\u0027, \u0027relation_labeling_options\u0027: {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}, \u0027relation_labeling_k\u0027: 15, \u0027set_expansion_algo\u0027: \u0027centroid\u0027, \u0027set_expansion_options\u0027: {\u0027embeddings\u0027: self.embeddings}, \u0027set_expansion_k\u0027: 15}\n package = ALGORITHMS_PACKAGE + \u0027.relation_expansion.\u0027 + algo\n algo = getattr(__import__(package, fromlist=[algo]), algo)\n return algo.task(seed, k, **options)\n \n def relation_labeling(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed tuples.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.relation_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n \n def set_expansion(self, seed: List[str], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds words with the same implicit relation of the seed words \n (co-hyponyms).\n\n Args:\n seed (List[str]): list of words that has to be expanded.\n k (int): limit to the number of result words.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of words related to the seed words.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027centroid\u0027\n options = {\u0027embeddings\u0027: self.embeddings}\n package = ALGORITHMS_PACKAGE + \u0027.set_expansion.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n \n def set_labeling(self, seed: List[str], k: int = 15, algo: str = None, options: dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n words (hyperonym).\n\n Args:\n seed (List[str]): list of words that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed words.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.set_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n", "label": "\n\nclass OKgraph:\n \"\"\"A c ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field41", "label": "woc:field41\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field115", "label": "woc:field115\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field73", "label": "woc:field73\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/method9", "label": "woc:method9\nMethod\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class10", "label": "woc:class10\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class21", "label": "woc:class21\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field152", "label": "woc:field152\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/method8", "label": "woc:method8\nMethod\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field81", "label": "woc:field81\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field101", "label": "woc:field101\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field79", "label": "woc:field79\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/fielddeclarationstatement30", "label": "woc:fielddeclarationstateme ...\nFieldDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field6", "label": "woc:field6\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class46", "label": "woc:class46\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Returns: the path of the loaded/generated index directory.", "label": "Returns: the path of the lo ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable110", "label": "woc:localvariable110\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field163", "label": "woc:field163\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/parameter75", "label": "woc:parameter75\nParameter\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field51", "label": "woc:field51\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "11", "label": "11\nint\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field20", "label": "woc:field20\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method52", "label": "woc:method52\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class34", "label": "woc:class34\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement131", "label": "woc:blockstatement131\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field72", "label": "woc:field72\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field83", "label": "woc:field83\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method25", "label": "woc:method25\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "okgraph.core.OKgraph.dictionary", "label": "okgraph.core.OKgraph.dictio ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "path of the corpus file.", "label": "path of the corpus file.\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field33", "label": "woc:field33\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field36", "label": "woc:field36\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter67", "label": "woc:parameter67\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/expressionstatement56", "label": "woc:expressionstatement56\nExpressionStatement\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/parameter57", "label": "woc:parameter57\nParameter\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field107", "label": "woc:field107\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field160", "label": "woc:field160\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field57", "label": "woc:field57\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method17", "label": "woc:method17\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/fielddeclarationstatement31", "label": "woc:fielddeclarationstateme ...\nFieldDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter87", "label": "woc:parameter87\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method51", "label": "woc:method51\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field104", "label": "woc:field104\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method49", "label": "woc:method49\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field63", "label": "woc:field63\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field76", "label": "woc:field76\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field139", "label": "woc:field139\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method57", "label": "woc:method57\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class18", "label": "woc:class18\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class1", "label": "woc:class1\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class24", "label": "woc:class24\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field82", "label": "woc:field82\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field121", "label": "woc:field121\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class6", "label": "woc:class6\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method2", "label": "woc:method2\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field127", "label": "woc:field127\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field37", "label": "woc:field37\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field166", "label": "woc:field166\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method23", "label": "woc:method23\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field164", "label": "woc:field164\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method21", "label": "woc:method21\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "index", "label": "index\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\ndef relation_expansion(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[Tuple[str, ...]]:\n \"\"\"Finds tuples with the same implicit relation of the seed tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be\n expanded.\n k (int): limit to the number of result tuples.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[Tuple[str, ...]]: the list of tuples related to the seed\n tuples.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027relation_labeling_algo\u0027: \u0027intersection\u0027, \u0027relation_labeling_options\u0027: {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}, \u0027relation_labeling_k\u0027: 15, \u0027set_expansion_algo\u0027: \u0027centroid\u0027, \u0027set_expansion_options\u0027: {\u0027embeddings\u0027: self.embeddings}, \u0027set_expansion_k\u0027: 15}\n package = ALGORITHMS_PACKAGE + \u0027.relation_expansion.\u0027 + algo\n algo = getattr(__import__(package, fromlist=[algo]), algo)\n return algo.task(seed, k, **options)", "label": "\ndef relation_expansion(sel ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/importstatement83", "label": "woc:importstatement83\nImportStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter89", "label": "woc:parameter89\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field49", "label": "woc:field49\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field135", "label": "woc:field135\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement136", "label": "woc:blockstatement136\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "path of the indexed corpus files.", "label": "path of the indexed corpus ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Returns: the list of labels related to the seed words.", "label": "Returns: the list of labels ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Returns: the path of the loaded/generated Magnitude model.", "label": "Returns: the path of the lo ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "okgraph.core", "label": "okgraph.core\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/returnstatement15", "label": "woc:returnstatement15\nReturnStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method26", "label": "woc:method26\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement50", "label": "woc:declarationstatement50\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter83", "label": "woc:parameter83\nParameter\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier", "label": "woc:PythonPublicAccessModifier\nAccessModifier\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class28", "label": "woc:class28\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable120", "label": "woc:localvariable120\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field34", "label": "woc:field34\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field100", "label": "woc:field100\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/constructor2", "label": "woc:constructor2\nConstructor\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class22", "label": "woc:class22\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method20", "label": "woc:method20\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field90", "label": "woc:field90\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class41", "label": "woc:class41\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field88", "label": "woc:field88\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Loads or generates the embeddings whether or not it is already existing. FIXME: do not work with URLs, just with files.", "label": "Loads or generates the embe ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter60", "label": "woc:parameter60\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "relation_labeling", "label": "relation_labeling\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement46", "label": "woc:declarationstatement46\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "from okgraph.core import OKgraph", "label": "from okgraph.core import OK ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter78", "label": "woc:parameter78\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement45", "label": "woc:declarationstatement45\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class30", "label": "woc:class30\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field130", "label": "woc:field130\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field112", "label": "woc:field112\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field147", "label": "woc:field147\nField\nDeep 2", "shape": "circle"}, {"color": "#F0A3FF", "id": "http://rdf.webofcode.org/woc/class20", "label": "woc:class20\nClass\nDeep 0", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field10", "label": "woc:field10\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "relation_expansion", "label": "relation_expansion\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field142", "label": "woc:field142\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field94", "label": "woc:field94\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method42", "label": "woc:method42\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable116", "label": "woc:localvariable116\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "_get_embeddings", "label": "_get_embeddings\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Loads or generates the index whether or not it is already existing.", "label": "Loads or generates the inde ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter77", "label": "woc:parameter77\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement49", "label": "woc:declarationstatement49\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class31", "label": "woc:class31\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field50", "label": "woc:field50\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "okgraph.core.OKgraph", "label": "okgraph.core.OKgraph\nstr\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter92", "label": "woc:parameter92\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class15", "label": "woc:class15\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter63", "label": "woc:parameter63\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter94", "label": "woc:parameter94\nParameter\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/field29", "label": "woc:field29\nField\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field114", "label": "woc:field114\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\ndef relation_labeling(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed tuples.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.relation_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)", "label": "\ndef relation_labeling(self ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field39", "label": "woc:field39\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/statement140", "label": "woc:statement140\nStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method60", "label": "woc:method60\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field21", "label": "woc:field21\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field85", "label": "woc:field85\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field141", "label": "woc:field141\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field93", "label": "woc:field93\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method32", "label": "woc:method32\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field91", "label": "woc:field91\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/importstatement75", "label": "woc:importstatement75\nImportStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "False", "label": "False\nbool\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field61", "label": "woc:field61\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter79", "label": "woc:parameter79\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field7", "label": "woc:field7\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field55", "label": "woc:field55\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method13", "label": "woc:method13\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field153", "label": "woc:field153\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement3", "label": "woc:declarationstatement3\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field68", "label": "woc:field68\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field109", "label": "woc:field109\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field4", "label": "woc:field4\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "The constructor creates a OKgraph object. Loads or generates the word embeddings, corpus index and corpus dictionary, whether or not they already exist.", "label": "The constructor creates a O ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class40", "label": "woc:class40\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement44", "label": "woc:declarationstatement44\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/statement137", "label": "woc:statement137\nStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field134", "label": "woc:field134\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field148", "label": "woc:field148\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method50", "label": "woc:method50\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/fielddeclarationstatement29", "label": "woc:fielddeclarationstateme ...\nFieldDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/method5", "label": "woc:method5\nMethod\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field15", "label": "woc:field15\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/class3", "label": "woc:class3\nClass\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "\n@staticmethod\ndef _get_embeddings(corpus_file: str, embeddings_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the embeddings whether or not it is already\n existing.\n\n FIXME: do not work with URLs, just with files.\n\n Args:\n corpus_file (str): path of the corpus file.\n embeddings_file (str): path of the embeddings file.\n force_init (bool): if True forces the creation of the embeddings.\n\n Returns:\n str: the path of the loaded/generated Magnitude model.\n\n \"\"\"\n if embeddings_file is None:\n (corpus_basename, _) = path.splitext(corpus_file)\n embeddings_file = corpus_basename + \u0027.magnitude\u0027\n logger.info(f\u0027Embeddings file for corpus {corpus_file} not specified. Referencing to default value {embeddings_file}\u0027)\n else:\n embeddings_file = check_extension(file_name=embeddings_file, default_extension=\u0027.magnitude\u0027, allowed_extensions=[\u0027.magnitude\u0027, \u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027])\n (embeddings_basename, embeddings_extension) = path.splitext(embeddings_file)\n magnitude_file = embeddings_basename + \u0027.magnitude\u0027\n if path.exists(embeddings_file) and force_init is True:\n logger.info(f\u0027Removing existing embeddings file {embeddings_file} to generate it again\u0027)\n remove(embeddings_file)\n if embeddings_extension == \u0027.magnitude\u0027:\n if path.exists(embeddings_file):\n logger.info(f\u0027Specified embeddings file {embeddings_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified embeddings file {embeddings_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n embeddings_file = FileConverter.corpus_to_magnitude_model(corpus_file, embeddings_file)\n elif embeddings_extension in [\u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027]:\n if path.exists(magnitude_file):\n logger.info(f\u0027The Magnitude model {magnitude_file} related to the specified {embeddings_file} embeddings already exists: using it\u0027)\n embeddings_file = magnitude_file\n elif path.exists(embeddings_file):\n logger.info(f\u0027Generating Magnitude model from specified {embeddings_file} embeddings\u0027)\n FileConverter.generic_model_to_magnitude_model(embeddings_file, magnitude_file)\n embeddings_file = magnitude_file\n else:\n raise ValueError(f\u0027Specified embeddings file {embeddings_file} does not exists: it cannot be loaded and it cannot be generated (its not a Magnitude model)\u0027)\n return embeddings_file", "label": "\n@staticmethod\ndef _get_emb ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field75", "label": "woc:field75\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/declarationstatement42", "label": "woc:declarationstatement42\nDeclarationStatement\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable111", "label": "woc:localvariable111\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field65", "label": "woc:field65\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/globalvariable4", "label": "woc:globalvariable4\nGlobalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "okgraph.core.OKgraph.embeddings", "label": "okgraph.core.OKgraph.embedd ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field157", "label": "woc:field157\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class14", "label": "woc:class14\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method14", "label": "woc:method14\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field103", "label": "woc:field103\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/parameter80", "label": "woc:parameter80\nParameter\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/statement139", "label": "woc:statement139\nStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field137", "label": "woc:field137\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method54", "label": "woc:method54\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable118", "label": "woc:localvariable118\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/importstatement74", "label": "woc:importstatement74\nImportStatement\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class8", "label": "woc:class8\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field47", "label": "woc:field47\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field74", "label": "woc:field74\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field19", "label": "woc:field19\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method27", "label": "woc:method27\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class42", "label": "woc:class42\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field129", "label": "woc:field129\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/constructor5", "label": "woc:constructor5\nConstructor\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field27", "label": "woc:field27\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field156", "label": "woc:field156\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/field30", "label": "woc:field30\nField\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field154", "label": "woc:field154\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "The base class of the class hierarchy. When called, it accepts no arguments and returns a new featureless instance that has no instance attributes and cannot be given any.", "label": "The base class of the class ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "core", "label": "core\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter74", "label": "woc:parameter74\nParameter\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/blockstatement130", "label": "woc:blockstatement130\nBlockStatement\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method19", "label": "woc:method19\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "object", "label": "object\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method53", "label": "woc:method53\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Finds labels describing the implicit relation between the seed tuples.", "label": "Finds labels describing the ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field78", "label": "woc:field78\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable112", "label": "woc:localvariable112\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "self", "label": "self\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Returns: the list of labels related to the seed tuples.", "label": "Returns: the list of labels ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method3", "label": "woc:method3\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field123", "label": "woc:field123\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter65", "label": "woc:parameter65\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class19", "label": "woc:class19\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field168", "label": "woc:field168\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement341", "label": "woc:blockstatement341\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter88", "label": "woc:parameter88\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class48", "label": "woc:class48\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method47", "label": "woc:method47\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field53", "label": "woc:field53\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/constructor6", "label": "woc:constructor6\nConstructor\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/returnstatement17", "label": "woc:returnstatement17\nReturnStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method45", "label": "woc:method45\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/constructor1", "label": "woc:constructor1\nConstructor\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class32", "label": "woc:class32\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field56", "label": "woc:field56\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field16", "label": "woc:field16\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\ndef __init__(self, corpus_file: str, embeddings_file: str = None, k: int = 5, stream: bool = False, lazy_loading: int = 0, index_dir: str = None, dictionary_file: str = None, force_init: bool = False):\n \"\"\"The constructor creates a OKgraph object.\n\n Loads or generates the word embeddings, corpus index and corpus\n dictionary, whether or not they already exist.\n\n Args:\n corpus_file (str): path of the corpus file. The corpus file should\n be a cleaned free text file (untagged).\n embeddings_file (MagnitudeWordEmbeddings): path or URL of the\n embeddings file. FIXME: do not correctly handle URLs.\n The supported embeddings are *.magnitude*, *.bin*, *.txt*,\n *.vec* and *.hdf5*. The *.bin*, *.txt*, *.vec* and *.hdf5*\n embeddings are supported by automatically converting them to a\n *.magnitude* file. No extension will be treated as *.magnitude*.\n If the embeddings file is not specified, the default path\n points to a *.magnitude* file with the same basename of the\n corpus file.\n If the specified file is found in the path, the embeddings is\n directly loaded.\n If the specified *.magnitude* file is not found, an embeddings\n Magnitude model is created from the text corpus.\n If the specified *.bin*, *.txt*, *.vec* or *.hdf5* file is not\n found a ValueError is raised, because these models can be\n loaded but not created.\n k (int): embeddings can be queried to know the words whose vector\n representation is similar to a known vector. The OKgraph tasks\n could be using this functionality to extract their results:\n usually, the more results you are expecting from the task, the\n more words you are expecting from the embeddings.\n *k* should be set to the approximate upper-bound of the number\n of results that will be expected from the embeddings. If the\n exact number is unknown, be conservative picking a large number,\n while keeping in mind the bigger *k* is, the more memory it\n will consume.\n stream (bool): stream the URL instead of downloading it.\n lazy_loading (int): allows faster cold start when loading:\n\n +----+-------------------------------------------+\n | -1 | preload into memory |\n +----+-------------------------------------------+\n | 0 | lazy loads with unbounded in-memory cache |\n +----+-------------------------------------------+\n | \u003e0 | lazy loads with an LRU cache of that size |\n +----+-------------------------------------------+\n index_dir (str): path of the indexed corpus files directory.\n If the index directory is not specified, the default path\n points to a directory named *indexdir* with the same parent\n directory of the corpus.\n If the directory exists it is used as it is, otherwise it is\n created.\n dictionary_file (str): path of the corpus dictionary file.\n The supported files are *.npy*. No extension will be treated as\n *.npy*.\n If the dictionary file is not specified, the default path\n points to a file named *dictTotal.npy* with the same parent\n directory of the corpus.\n If the file exists it is used as it is, otherwise it is created.\n force_init (bool): forces the initialization of the embeddings,\n index and dictionary from scratch, overwriting them if already\n existing.\n\n Example:\n - Instantiating an OKgraph object specifing a corpus file:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e okg = OKgraph(corpus)\n or even\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No path have been specified for the embeddings, index directory\n and dictionary, so the default paths (same of the corpus)\n \u0027/OKgraph/Example/enwik9.magnitude\u0027,\n \u0027/OKgraph/Example/indexdir/\u0027, \u0027/OKgraph/Example/dictTotal.npy\u0027\n are implicitly used.\n All the resources will be searched in the default paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus).\n\n\n - Instantiating an OKgraph object specifing the resources paths:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e embeddings = \"/OKgraph/Example/NewDir/enwiki9_embeddings\"\n \u003e\u003e\u003e index = \"/OKgraph/Example/NewDir/enwiki9_index\"\n \u003e\u003e\u003e dictionary = \"/OKgraph/Example/NewDir/enwiki9_dictionary\"\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus,\n \u003e\u003e\u003e embeddings_file=embeddings,\n \u003e\u003e\u003e index_dir=index,\n \u003e\u003e\u003e dictionary_file=dictionary)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No extension has been specified for the embeddings and the\n dictionary, so the *.magnitude* and *.npy* exntensions will be\n automatically appended.\n All the resources will be searched in the specified paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus). In the above example, the resources\n are missing and they will be created in the new directory\n *NewDir*. *NewDir* will be automatically created.\n\n \"\"\"\n corpus_file = path.normpath(corpus_file)\n if not path.exists(corpus_file):\n raise NotExistingCorpusException(corpus_file)\n if embeddings_file is not None:\n embeddings_file = path.normpath(embeddings_file)\n if index_dir is not None:\n index_dir = path.normpath(index_dir)\n if dictionary_file is not None:\n dictionary_file = path.normpath(dictionary_file)\n embeddings_file = self._get_embeddings(corpus_file, embeddings_file, force_init)\n index_dir = self._get_index(corpus_file, index_dir, force_init)\n dictionary_file = self._get_dictionary(corpus_file, dictionary_file, force_init)\n self.embeddings = MagnitudeWordEmbeddings(embeddings_file, k, stream, lazy_loading)\n self.corpus = corpus_file\n self.index = index_dir\n self.dictionary = dictionary_file", "label": "\ndef __init__(self, corpus_ ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement148", "label": "woc:blockstatement148\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class13", "label": "woc:class13\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method29", "label": "woc:method29\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Python Public Access Modifier", "label": "Python Public Access Modifier\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field122", "label": "woc:field122\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field120", "label": "woc:field120\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field159", "label": "woc:field159\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field9", "label": "woc:field9\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field106", "label": "woc:field106\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field67", "label": "woc:field67\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field84", "label": "woc:field84\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter76", "label": "woc:parameter76\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field165", "label": "woc:field165\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field64", "label": "woc:field64\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field1", "label": "woc:field1\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "corpus", "label": "corpus\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field12", "label": "woc:field12\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable121", "label": "woc:localvariable121\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field22", "label": "woc:field22\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class2", "label": "woc:class2\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field108", "label": "woc:field108\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field126", "label": "woc:field126\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement28", "label": "woc:blockstatement28\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable115", "label": "woc:localvariable115\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field124", "label": "woc:field124\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class44", "label": "woc:class44\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field40", "label": "woc:field40\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/globalvariable11", "label": "woc:globalvariable11\nGlobalVariable\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/method6", "label": "woc:method6\nMethod\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "Finds words with the same implicit relation of the seed words (co-hyponyms).", "label": "Finds words with the same i ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field96", "label": "woc:field96\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method44", "label": "woc:method44\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement12", "label": "woc:blockstatement12\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "embeddings", "label": "embeddings\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class33", "label": "woc:class33\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "okgraph.core.OKgraph.index", "label": "okgraph.core.OKgraph.index\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Returns: the path of the loaded/generated dictionary file.", "label": "Returns: the path of the lo ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter68", "label": "woc:parameter68\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "dictionary", "label": "dictionary\nstr\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/parameter85", "label": "woc:parameter85\nParameter\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field3", "label": "woc:field3\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field48", "label": "woc:field48\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method22", "label": "woc:method22\nMethod\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "A class used to extract knowledge from unstructured text corpus. This class currently focuses on the following tasks: - **set expansion**: given one or a short set of words, continues this set with a list of other \u0027same-type\u0027 words (`co-hyponyms \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy#Co-hyponyms\u003e`_); - **relation expansion**: given one or a short set of word pairs, continues this set with a list of pairs having the same implicit relation of the given pairs; - **set labeling**: given one or a short set of words, returns a list of short strings (labels) describing the given set (its type or `hyperonym \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy\u003e`_); - **relation labeling**: given one or a short set of word pairs, returns a list of short strings (labels) describing the relation in the given set; All the tasks work with plain text corpus (untagged).", "label": "A class used to extract kno ...\nstr\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method56", "label": "woc:method56\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement163", "label": "woc:blockstatement163\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field87", "label": "woc:field87\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field69", "label": "woc:field69\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter70", "label": "woc:parameter70\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field38", "label": "woc:field38\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method43", "label": "woc:method43\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Returns: the list of tuples related to the seed tuples.", "label": "Returns: the list of tuples ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement47", "label": "woc:declarationstatement47\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field132", "label": "woc:field132\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field149", "label": "woc:field149\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter64", "label": "woc:parameter64\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "set_expansion", "label": "set_expansion\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter66", "label": "woc:parameter66\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field155", "label": "woc:field155\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/importstatement85", "label": "woc:importstatement85\nImportStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field111", "label": "woc:field111\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method46", "label": "woc:method46\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field133", "label": "woc:field133\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field71", "label": "woc:field71\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class47", "label": "woc:class47\nClass\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/method7", "label": "woc:method7\nMethod\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field77", "label": "woc:field77\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field17", "label": "woc:field17\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable113", "label": "woc:localvariable113\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement167", "label": "woc:blockstatement167\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field25", "label": "woc:field25\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class5", "label": "woc:class5\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class26", "label": "woc:class26\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/statement138", "label": "woc:statement138\nStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field116", "label": "woc:field116\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "1", "label": "1\nint\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "path of the corpus dictionary.", "label": "path of the corpus dictionary.\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "set_labeling", "label": "set_labeling\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method12", "label": "woc:method12\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field13", "label": "woc:field13\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter93", "label": "woc:parameter93\nParameter\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/method10", "label": "woc:method10\nMethod\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field146", "label": "woc:field146\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method16", "label": "woc:method16\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field105", "label": "woc:field105\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field95", "label": "woc:field95\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Finds tuples with the same implicit relation of the seed tuples.", "label": "Finds tuples with the same ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field2", "label": "woc:field2\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field70", "label": "woc:field70\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field26", "label": "woc:field26\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class25", "label": "woc:class25\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field18", "label": "woc:field18\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method30", "label": "woc:method30\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement43", "label": "woc:declarationstatement43\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\ndef set_labeling(self, seed: List[str], k: int = 15, algo: str = None, options: dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n words (hyperonym).\n\n Args:\n seed (List[str]): list of words that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed words.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.set_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)", "label": "\ndef set_labeling(self, see ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "The core module contains the library main functionalities to performs unsupervised natural-language understanding.", "label": "The core module contains th ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "builtins.object", "label": "builtins.object\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class17", "label": "woc:class17\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field32", "label": "woc:field32\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field113", "label": "woc:field113\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field136", "label": "woc:field136\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "from okgraph.core import OKgraph, NotExistingCorpusException, DEFAULT_DICTIONARY_NAME", "label": "from okgraph.core import OK ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field150", "label": "woc:field150\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field99", "label": "woc:field99\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field158", "label": "woc:field158\nField\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/package16", "label": "woc:package16\nPackage\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field58", "label": "woc:field58\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method15", "label": "woc:method15\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method11", "label": "woc:method11\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field52", "label": "woc:field52\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter61", "label": "woc:parameter61\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field102", "label": "woc:field102\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/importstatement73", "label": "woc:importstatement73\nImportStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement340", "label": "woc:blockstatement340\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\n@staticmethod\ndef _get_index(corpus_file: str, index_dir: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the index whether or not it is already existing.\n\n Args:\n corpus_file: path of the corpus file.\n index_dir: path of the index directory.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated index directory.\n\n \"\"\"\n if index_dir is None:\n index_dir = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_INDEX_FOLDER))\n logger.info(f\u0027Indexing directoy for corpus {corpus_file} not specified. Referencing to default value {index_dir}\u0027)\n if path.exists(index_dir) and force_init is True:\n logger.info(f\u0027Removing existing indexing directory {index_dir} to generate it again\u0027)\n remove_dir(index_dir)\n if path.exists(index_dir):\n logger.info(f\u0027Specified index directory {index_dir} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified indexing directory {index_dir} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n ix = Indexing(corpus_path=corpus_file)\n ix.indexing(index_path=index_dir)\n del ix\n return index_dir", "label": "\n@staticmethod\ndef _get_ind ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter82", "label": "woc:parameter82\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/returnstatement11", "label": "woc:returnstatement11\nReturnStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable114", "label": "woc:localvariable114\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field24", "label": "woc:field24\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field119", "label": "woc:field119\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field117", "label": "woc:field117\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field138", "label": "woc:field138\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field46", "label": "woc:field46\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field125", "label": "woc:field125\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field140", "label": "woc:field140\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter84", "label": "woc:parameter84\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field5", "label": "woc:field5\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class16", "label": "woc:class16\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class11", "label": "woc:class11\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field131", "label": "woc:field131\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class12", "label": "woc:class12\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class45", "label": "woc:class45\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/returnstatement14", "label": "woc:returnstatement14\nReturnStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/returnstatement12", "label": "woc:returnstatement12\nReturnStatement\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "OKgraph", "label": "OKgraph\nstr\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter71", "label": "woc:parameter71\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method55", "label": "woc:method55\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field80", "label": "woc:field80\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method31", "label": "woc:method31\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Finds labels describing the implicit relation between the seed words (hyperonym).", "label": "Finds labels describing the ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class29", "label": "woc:class29\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field86", "label": "woc:field86\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/returnstatement13", "label": "woc:returnstatement13\nReturnStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter81", "label": "woc:parameter81\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "_get_dictionary", "label": "_get_dictionary\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter62", "label": "woc:parameter62\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field59", "label": "woc:field59\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter73", "label": "woc:parameter73\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method59", "label": "woc:method59\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field110", "label": "woc:field110\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field45", "label": "woc:field45\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class49", "label": "woc:class49\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "18", "label": "18\nint\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "2", "label": "2\nint\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field54", "label": "woc:field54\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "523", "label": "523\nint\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement161", "label": "woc:blockstatement161\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\n@staticmethod\ndef _get_dictionary(corpus_file: str, dictionary_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the dictionary whether or not it is already\n existing.\n\n Args:\n corpus_file: path of the corpus file.\n dictionary_file: path of the dictionary file.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated dictionary file.\n\n \"\"\"\n if dictionary_file is None:\n dictionary_file = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_DICTIONARY_NAME))\n logger.info(f\u0027Dictionary file for corpus {corpus_file} not specified. Referencing to default value {dictionary_file}\u0027)\n else:\n dictionary_file = check_extension(file_name=dictionary_file, default_extension=\u0027.npy\u0027, allowed_extensions=[\u0027.npy\u0027])\n if path.exists(dictionary_file) and force_init is True:\n logger.info(f\u0027Removing existing dictionary file {dictionary_file} to generate it again\u0027)\n remove(dictionary_file)\n if path.exists(dictionary_file):\n logger.info(f\u0027Specified dictionary file {dictionary_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified dictionary file {dictionary_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n generate_dictionary(corpus_file, dictionary=dictionary_file, save_dictionary=True)\n return dictionary_file", "label": "\n@staticmethod\ndef _get_dic ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field11", "label": "woc:field11\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement154", "label": "woc:blockstatement154\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter86", "label": "woc:parameter86\nParameter\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/importstatement84", "label": "woc:importstatement84\nImportStatement\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter72", "label": "woc:parameter72\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field42", "label": "woc:field42\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter91", "label": "woc:parameter91\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class35", "label": "woc:class35\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/package9", "label": "woc:package9\nPackage\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field62", "label": "woc:field62\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field98", "label": "woc:field98\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method18", "label": "woc:method18\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class39", "label": "woc:class39\nClass\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/parameter90", "label": "woc:parameter90\nParameter\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "Loads or generates the dictionary whether or not it is already existing.", "label": "Loads or generates the dict ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field167", "label": "woc:field167\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "\ndef set_expansion(self, seed: List[str], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds words with the same implicit relation of the seed words \n (co-hyponyms).\n\n Args:\n seed (List[str]): list of words that has to be expanded.\n k (int): limit to the number of result words.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of words related to the seed words.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027centroid\u0027\n options = {\u0027embeddings\u0027: self.embeddings}\n package = ALGORITHMS_PACKAGE + \u0027.set_expansion.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)", "label": "\ndef set_expansion(self, se ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method24", "label": "woc:method24\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field14", "label": "woc:field14\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/PythonProtectedAccessModifier", "label": "woc:PythonProtectedAccessMo ...\nAccessModifier\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method58", "label": "woc:method58\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class7", "label": "woc:class7\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/blockstatement165", "label": "woc:blockstatement165\nBlockStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable117", "label": "woc:localvariable117\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field66", "label": "woc:field66\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field23", "label": "woc:field23\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "okgraph.core.OKgraph.corpus", "label": "okgraph.core.OKgraph.corpus\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class27", "label": "woc:class27\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class36", "label": "woc:class36\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/localvariable119", "label": "woc:localvariable119\nLocalVariable\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class50", "label": "woc:class50\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field128", "label": "woc:field128\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement48", "label": "woc:declarationstatement48\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class37", "label": "woc:class37\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field92", "label": "woc:field92\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field151", "label": "woc:field151\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "words embeddings (vector model).", "label": "words embeddings (vector mo ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field97", "label": "woc:field97\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class38", "label": "woc:class38\nClass\nDeep 2", "shape": "circle"}, {"color": "#0075DC", "id": "http://rdf.webofcode.org/woc/field28", "label": "woc:field28\nField\nDeep 1", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method48", "label": "woc:method48\nMethod\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/declarationstatement51", "label": "woc:declarationstatement51\nDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class9", "label": "woc:class9\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/library1", "label": "woc:library1\nLibrary\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter59", "label": "woc:parameter59\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "Returns: the list of words related to the seed words.", "label": "Returns: the list of words ...\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/class23", "label": "woc:class23\nClass\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field44", "label": "woc:field44\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "_get_index", "label": "_get_index\nstr\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/fielddeclarationstatement28", "label": "woc:fielddeclarationstateme ...\nFieldDeclarationStatement\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field43", "label": "woc:field43\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field118", "label": "woc:field118\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/parameter69", "label": "woc:parameter69\nParameter\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/field8", "label": "woc:field8\nField\nDeep 2", "shape": "circle"}, {"color": "#993F00", "id": "http://rdf.webofcode.org/woc/method1", "label": "woc:method1\nMethod\nDeep 2", "shape": "circle"}]);
edges = new vis.DataSet([{"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "has fully-qualified name", "to": "okgraph.core.OKgraph.corpus"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter85", "label": "is positional only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable113", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter75", "label": "is positional only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class9", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field32", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter76", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method7"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter57", "label": "has parameter position", "to": "1"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement84", "label": "has previous statement", "to": "http://rdf.webofcode.org/woc/importstatement83"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method42", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "has variable declaration", "to": "http://rdf.webofcode.org/woc/fielddeclarationstatement28"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method20", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method16", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method43", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has end line", "to": "523"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter69", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement131"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter90", "label": "is positional only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "has documentation", "to": "Returns: the path of the loaded/generated dictionary file."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field48", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class3", "label": "has simple name", "to": "object"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field62", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier", "label": "has label", "to": "Python Public Access Modifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field146", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field13", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field114", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field52", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field76", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field167", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class3", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field163", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement154"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field59", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field17", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable120", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field64", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "has type", "to": "http://rdf.webofcode.org/woc/class5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field46", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class2", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "has source code", "to": "\ndef set_labeling(self, seed: List[str], k: int = 15, algo: str = None, options: dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n words (hyperonym).\n\n Args:\n seed (List[str]): list of words that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed words.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.set_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter74", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method6"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class6", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/package16", "label": "has fully-qualified name", "to": "okgraph.core"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/returnstatement17", "label": "is return statement of", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "has type", "to": "http://rdf.webofcode.org/woc/class5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field58", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement161"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/declarationstatement42", "label": "has line", "to": "18"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field78", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field44", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method15", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method2", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class7", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class10", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter79", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method7"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "has documentation", "to": "path of the corpus file."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method32", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class20", "label": "has package", "to": "http://rdf.webofcode.org/woc/package16"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field119", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field125", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field164", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement167"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field109", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter89", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class49", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class18", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field160", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field18", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "has documentation", "to": "Returns: the list of words related to the seed words."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field124", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter57", "label": "has type", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field148", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field105", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class20", "label": "has documentation", "to": "A class used to extract knowledge from unstructured text corpus. This class currently focuses on the following tasks: - **set expansion**: given one or a short set of words, continues this set with a list of other \u0027same-type\u0027 words (`co-hyponyms \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy#Co-hyponyms\u003e`_); - **relation expansion**: given one or a short set of word pairs, continues this set with a list of pairs having the same implicit relation of the given pairs; - **set labeling**: given one or a short set of words, returns a list of short strings (labels) describing the given set (its type or `hyperonym \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy\u003e`_); - **relation labeling**: given one or a short set of word pairs, returns a list of short strings (labels) describing the relation in the given set; All the tasks work with plain text corpus (untagged)."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement45"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class8", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field37", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method46", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method17", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement43"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field22", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field112", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field63", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field135", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field133", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field40", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field42", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement340", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/importstatement74"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonProtectedAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method48", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method19", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/package16", "label": "has documentation", "to": "The core module contains the library main functionalities to performs unsupervised natural-language understanding."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field19", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "has fully-qualified name", "to": "okgraph.core.OKgraph.dictionary"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class50", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter80", "label": "is keyword only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter66", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field56", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field103", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/returnstatement16", "label": "is return statement of", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field75", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method44", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter85", "label": "has parameter position", "to": "1"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field100", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field50", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field110", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter75", "label": "has parameter position", "to": "1"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter93", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field53", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class46", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field77", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "has source code", "to": "\ndef set_expansion(self, seed: List[str], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds words with the same implicit relation of the seed words \n (co-hyponyms).\n\n Args:\n seed (List[str]): list of words that has to be expanded.\n k (int): limit to the number of result words.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of words related to the seed words.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027centroid\u0027\n options = {\u0027embeddings\u0027: self.embeddings}\n package = ALGORITHMS_PACKAGE + \u0027.set_expansion.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter90", "label": "has parameter position", "to": "1"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter80", "label": "has parameter position", "to": "1"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class30", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "has documentation", "to": "Returns: the path of the loaded/generated index directory."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter85", "label": "has type", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class1", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field118", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter75", "label": "has type", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class28", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field108", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter83", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "has name", "to": "_get_dictionary"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field123", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "has variable declaration", "to": "http://rdf.webofcode.org/woc/fielddeclarationstatement31"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class24", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonProtectedAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter90", "label": "has type", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/package16", "label": "has simple name", "to": "core"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter80", "label": "has type", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable114", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class47", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class21", "label": "has package", "to": "http://rdf.webofcode.org/woc/package16"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable118", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter80", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field11", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field21", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "has documentation", "to": "Finds words with the same implicit relation of the seed words (co-hyponyms)."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class38", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field104", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field116", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter85", "label": "is keyword only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field36", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor2", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement43"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor1", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field121", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class9", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field45", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field55", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter90", "label": "is keyword only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter68", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonProtectedAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field29", "label": "has fully-qualified name", "to": "okgraph.core.OKgraph.embeddings"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement48"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter86", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field23", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter85", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class43", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter75", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class14", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement28", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement130"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field126", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor2", "label": "is constructor of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field102", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/statement138"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class15", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field98", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field29", "label": "has documentation", "to": "words embeddings (vector model)."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field70", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable110", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/statement137"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter81", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class33", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field120", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter90", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class6", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field16", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field71", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "has documentation", "to": "Finds tuples with the same implicit relation of the seed tuples."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class17", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "has type", "to": "http://rdf.webofcode.org/woc/class5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter62", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field39", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field33", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class45", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class10", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter94", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field122", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class3", "label": "has package", "to": "http://rdf.webofcode.org/woc/package9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter90", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field87", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field60", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field83", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class16", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class37", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field41", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "has documentation", "to": "Loads or generates the index whether or not it is already existing."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor6", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/declarationstatement42", "label": "has previous statement", "to": "http://rdf.webofcode.org/woc/expressionstatement56"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "has documentation", "to": "Returns: the list of labels related to the seed tuples."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class42", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter82", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field54", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method58", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement46"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class13", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement84", "label": "has line", "to": "17"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "has simple name", "to": "dictionary"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field111", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field107", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field34", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement47"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class36", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field3", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement50"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement74", "label": "has line", "to": "2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/returnstatement13", "label": "is return statement of", "to": "http://rdf.webofcode.org/woc/method6"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field85", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field2", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "has documentation", "to": "Loads or generates the embeddings whether or not it is already existing. FIXME: do not work with URLs, just with files."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class50", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method1", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field82", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "has variable declaration", "to": "http://rdf.webofcode.org/woc/fielddeclarationstatement30"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class47", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field72", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter63", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement75", "label": "has previous statement", "to": "http://rdf.webofcode.org/woc/importstatement74"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "has name", "to": "_get_embeddings"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field65", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class32", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field73", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field29", "label": "has variable declaration", "to": "http://rdf.webofcode.org/woc/fielddeclarationstatement29"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class29", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field74", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter57", "label": "is keyword only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field128", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field134", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field115", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field99", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field66", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class28", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field130", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field96", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field86", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement46"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "has simple name", "to": "corpus"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter57", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement44"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field117", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field29", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field90", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field101", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class24", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement28", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement42"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/statement140"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field95", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "is field of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter71", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field1", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method57", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class20", "label": "has body", "to": "http://rdf.webofcode.org/woc/blockstatement130"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field35", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor2", "label": "has source code", "to": "\ndef __init__(self, corpus_file: str, embeddings_file: str = None, k: int = 5, stream: bool = False, lazy_loading: int = 0, index_dir: str = None, dictionary_file: str = None, force_init: bool = False):\n \"\"\"The constructor creates a OKgraph object.\n\n Loads or generates the word embeddings, corpus index and corpus\n dictionary, whether or not they already exist.\n\n Args:\n corpus_file (str): path of the corpus file. The corpus file should\n be a cleaned free text file (untagged).\n embeddings_file (MagnitudeWordEmbeddings): path or URL of the\n embeddings file. FIXME: do not correctly handle URLs.\n The supported embeddings are *.magnitude*, *.bin*, *.txt*,\n *.vec* and *.hdf5*. The *.bin*, *.txt*, *.vec* and *.hdf5*\n embeddings are supported by automatically converting them to a\n *.magnitude* file. No extension will be treated as *.magnitude*.\n If the embeddings file is not specified, the default path\n points to a *.magnitude* file with the same basename of the\n corpus file.\n If the specified file is found in the path, the embeddings is\n directly loaded.\n If the specified *.magnitude* file is not found, an embeddings\n Magnitude model is created from the text corpus.\n If the specified *.bin*, *.txt*, *.vec* or *.hdf5* file is not\n found a ValueError is raised, because these models can be\n loaded but not created.\n k (int): embeddings can be queried to know the words whose vector\n representation is similar to a known vector. The OKgraph tasks\n could be using this functionality to extract their results:\n usually, the more results you are expecting from the task, the\n more words you are expecting from the embeddings.\n *k* should be set to the approximate upper-bound of the number\n of results that will be expected from the embeddings. If the\n exact number is unknown, be conservative picking a large number,\n while keeping in mind the bigger *k* is, the more memory it\n will consume.\n stream (bool): stream the URL instead of downloading it.\n lazy_loading (int): allows faster cold start when loading:\n\n +----+-------------------------------------------+\n | -1 | preload into memory |\n +----+-------------------------------------------+\n | 0 | lazy loads with unbounded in-memory cache |\n +----+-------------------------------------------+\n | \u003e0 | lazy loads with an LRU cache of that size |\n +----+-------------------------------------------+\n index_dir (str): path of the indexed corpus files directory.\n If the index directory is not specified, the default path\n points to a directory named *indexdir* with the same parent\n directory of the corpus.\n If the directory exists it is used as it is, otherwise it is\n created.\n dictionary_file (str): path of the corpus dictionary file.\n The supported files are *.npy*. No extension will be treated as\n *.npy*.\n If the dictionary file is not specified, the default path\n points to a file named *dictTotal.npy* with the same parent\n directory of the corpus.\n If the file exists it is used as it is, otherwise it is created.\n force_init (bool): forces the initialization of the embeddings,\n index and dictionary from scratch, overwriting them if already\n existing.\n\n Example:\n - Instantiating an OKgraph object specifing a corpus file:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e okg = OKgraph(corpus)\n or even\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No path have been specified for the embeddings, index directory\n and dictionary, so the default paths (same of the corpus)\n \u0027/OKgraph/Example/enwik9.magnitude\u0027,\n \u0027/OKgraph/Example/indexdir/\u0027, \u0027/OKgraph/Example/dictTotal.npy\u0027\n are implicitly used.\n All the resources will be searched in the default paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus).\n\n\n - Instantiating an OKgraph object specifing the resources paths:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e embeddings = \"/OKgraph/Example/NewDir/enwiki9_embeddings\"\n \u003e\u003e\u003e index = \"/OKgraph/Example/NewDir/enwiki9_index\"\n \u003e\u003e\u003e dictionary = \"/OKgraph/Example/NewDir/enwiki9_dictionary\"\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus,\n \u003e\u003e\u003e embeddings_file=embeddings,\n \u003e\u003e\u003e index_dir=index,\n \u003e\u003e\u003e dictionary_file=dictionary)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No extension has been specified for the embeddings and the\n dictionary, so the *.magnitude* and *.npy* exntensions will be\n automatically appended.\n All the resources will be searched in the specified paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus). In the above example, the resources\n are missing and they will be created in the new directory\n *NewDir*. *NewDir* will be automatically created.\n\n \"\"\"\n corpus_file = path.normpath(corpus_file)\n if not path.exists(corpus_file):\n raise NotExistingCorpusException(corpus_file)\n if embeddings_file is not None:\n embeddings_file = path.normpath(embeddings_file)\n if index_dir is not None:\n index_dir = path.normpath(index_dir)\n if dictionary_file is not None:\n dictionary_file = path.normpath(dictionary_file)\n embeddings_file = self._get_embeddings(corpus_file, embeddings_file, force_init)\n index_dir = self._get_index(corpus_file, index_dir, force_init)\n dictionary_file = self._get_dictionary(corpus_file, dictionary_file, force_init)\n self.embeddings = MagnitudeWordEmbeddings(embeddings_file, k, stream, lazy_loading)\n self.corpus = corpus_file\n self.index = index_dir\n self.dictionary = dictionary_file"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field113", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor4", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method31", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/declarationstatement51", "label": "has previous statement", "to": "http://rdf.webofcode.org/woc/declarationstatement42"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method56", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method52", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class37", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class31", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field84", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method53", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class35", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field81", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/declarationstatement42", "label": "declares", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field67", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "is field of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement85", "label": "has previous statement", "to": "http://rdf.webofcode.org/woc/importstatement84"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter78", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method7"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter75", "label": "is keyword only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field57", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/package16", "label": "has library", "to": "http://rdf.webofcode.org/woc/library1"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field80", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class12", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field141", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "has documentation", "to": "Returns: the list of tuples related to the seed tuples."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter85", "label": "has name", "to": "self"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method49", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter70", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class23", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field127", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class15", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter59", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field27", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field136", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class40", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field132", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field140", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement74", "label": "has previous statement", "to": "http://rdf.webofcode.org/woc/importstatement73"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/declarationstatement3", "label": "declares", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method51", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class21", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter90", "label": "has name", "to": "self"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "has documentation", "to": "path of the indexed corpus files."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class17", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable119", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field4", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement163"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field155", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement47"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "is field of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field139", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field38", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class20", "label": "has simple name", "to": "OKgraph"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field69", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement48"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method27", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class16", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method26", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field10", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable115", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method7"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement136"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter91", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method55", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class42", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field165", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method30", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement49"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement44"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field137", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor2", "label": "has documentation", "to": "The constructor creates a OKgraph object. Loads or generates the word embeddings, corpus index and corpus dictionary, whether or not they already exist."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement74", "label": "imports", "to": "http://rdf.webofcode.org/woc/class21"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class13", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method29", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field92", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class36", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field51", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "has source code", "to": "\n@staticmethod\ndef _get_embeddings(corpus_file: str, embeddings_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the embeddings whether or not it is already\n existing.\n\n FIXME: do not work with URLs, just with files.\n\n Args:\n corpus_file (str): path of the corpus file.\n embeddings_file (str): path of the embeddings file.\n force_init (bool): if True forces the creation of the embeddings.\n\n Returns:\n str: the path of the loaded/generated Magnitude model.\n\n \"\"\"\n if embeddings_file is None:\n (corpus_basename, _) = path.splitext(corpus_file)\n embeddings_file = corpus_basename + \u0027.magnitude\u0027\n logger.info(f\u0027Embeddings file for corpus {corpus_file} not specified. Referencing to default value {embeddings_file}\u0027)\n else:\n embeddings_file = check_extension(file_name=embeddings_file, default_extension=\u0027.magnitude\u0027, allowed_extensions=[\u0027.magnitude\u0027, \u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027])\n (embeddings_basename, embeddings_extension) = path.splitext(embeddings_file)\n magnitude_file = embeddings_basename + \u0027.magnitude\u0027\n if path.exists(embeddings_file) and force_init is True:\n logger.info(f\u0027Removing existing embeddings file {embeddings_file} to generate it again\u0027)\n remove(embeddings_file)\n if embeddings_extension == \u0027.magnitude\u0027:\n if path.exists(embeddings_file):\n logger.info(f\u0027Specified embeddings file {embeddings_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified embeddings file {embeddings_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n embeddings_file = FileConverter.corpus_to_magnitude_model(corpus_file, embeddings_file)\n elif embeddings_extension in [\u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027]:\n if path.exists(magnitude_file):\n logger.info(f\u0027The Magnitude model {magnitude_file} related to the specified {embeddings_file} embeddings already exists: using it\u0027)\n embeddings_file = magnitude_file\n elif path.exists(embeddings_file):\n logger.info(f\u0027Generating Magnitude model from specified {embeddings_file} embeddings\u0027)\n FileConverter.generic_model_to_magnitude_model(embeddings_file, magnitude_file)\n embeddings_file = magnitude_file\n else:\n raise ValueError(f\u0027Specified embeddings file {embeddings_file} does not exists: it cannot be loaded and it cannot be generated (its not a Magnitude model)\u0027)\n return embeddings_file"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "has name", "to": "relation_expansion"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement74", "label": "has statement position", "to": "2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method54", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class3", "label": "has fully-qualified name", "to": "builtins.object"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class25", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field79", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "has source code", "to": "\n@staticmethod\ndef _get_index(corpus_file: str, index_dir: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the index whether or not it is already existing.\n\n Args:\n corpus_file: path of the corpus file.\n index_dir: path of the index directory.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated index directory.\n\n \"\"\"\n if index_dir is None:\n index_dir = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_INDEX_FOLDER))\n logger.info(f\u0027Indexing directoy for corpus {corpus_file} not specified. Referencing to default value {index_dir}\u0027)\n if path.exists(index_dir) and force_init is True:\n logger.info(f\u0027Removing existing indexing directory {index_dir} to generate it again\u0027)\n remove_dir(index_dir)\n if path.exists(index_dir):\n logger.info(f\u0027Specified index directory {index_dir} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified indexing directory {index_dir} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n ix = Indexing(corpus_path=corpus_file)\n ix.indexing(index_path=index_dir)\n del ix\n return index_dir"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "has documentation", "to": "Returns: the list of labels related to the seed words."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter72", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method6"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement74", "label": "imports", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/returnstatement15", "label": "is return statement of", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable117", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field68", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field94", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field158", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field152", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "has documentation", "to": "Finds labels describing the implicit relation between the seed tuples."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter58", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter92", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field12", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field88", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter80", "label": "is positional only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "is method of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement74", "label": "imports", "to": "http://rdf.webofcode.org/woc/globalvariable11"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class34", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field91", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method50", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class12", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class5", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class27", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class44", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class20", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field29", "label": "is field of", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field43", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field93", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class4", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field9", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has line", "to": "18"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class39", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field24", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class19", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method13", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "has fully-qualified name", "to": "okgraph.core.OKgraph.index"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class41", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method59", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor5", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field7", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class26", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter64", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field29", "label": "has simple name", "to": "embeddings"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field129", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter73", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method6"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field28", "label": "has type", "to": "http://rdf.webofcode.org/woc/class5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement50"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "has name", "to": "set_labeling"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class35", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter57", "label": "has name", "to": "self"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method12", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field151", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter60", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field15", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field156", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field8", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method10", "label": "has documentation", "to": "Finds labels describing the implicit relation between the seed words (hyperonym)."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class23", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "has name", "to": "set_expansion"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method25", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable121", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method10"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has source code", "to": "\n\nclass OKgraph:\n \"\"\"A class used to extract knowledge from unstructured text corpus.\n\n This class currently focuses on the following tasks:\n - **set expansion**: given one or a short set of words, continues this\n set with a list of other \u0027same-type\u0027 words (`co-hyponyms\n \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy#Co-hyponyms\u003e`_);\n - **relation expansion**: given one or a short set of word pairs,\n continues this set with a list of pairs having the same implicit\n relation of the given pairs;\n - **set labeling**: given one or a short set of words, returns a list\n of short strings (labels) describing the given set (its type or\n `hyperonym \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy\u003e`_);\n - **relation labeling**: given one or a short set of word pairs,\n returns a list of short strings (labels) describing the relation in\n the given set;\n All the tasks work with plain text corpus (untagged).\n\n Attributes:\n corpus (str): path of the corpus file.\n embeddings (MagnitudeWordEmbeddings): words embeddings (vector\n model).\n index (str): path of the indexed corpus files.\n dictionary (str): path of the corpus dictionary.\n\n \"\"\"\n corpus: str\n embeddings: MagnitudeWordEmbeddings\n index: str\n dictionary: str\n \n def __init__(self, corpus_file: str, embeddings_file: str = None, k: int = 5, stream: bool = False, lazy_loading: int = 0, index_dir: str = None, dictionary_file: str = None, force_init: bool = False):\n \"\"\"The constructor creates a OKgraph object.\n\n Loads or generates the word embeddings, corpus index and corpus\n dictionary, whether or not they already exist.\n\n Args:\n corpus_file (str): path of the corpus file. The corpus file should\n be a cleaned free text file (untagged).\n embeddings_file (MagnitudeWordEmbeddings): path or URL of the\n embeddings file. FIXME: do not correctly handle URLs.\n The supported embeddings are *.magnitude*, *.bin*, *.txt*,\n *.vec* and *.hdf5*. The *.bin*, *.txt*, *.vec* and *.hdf5*\n embeddings are supported by automatically converting them to a\n *.magnitude* file. No extension will be treated as *.magnitude*.\n If the embeddings file is not specified, the default path\n points to a *.magnitude* file with the same basename of the\n corpus file.\n If the specified file is found in the path, the embeddings is\n directly loaded.\n If the specified *.magnitude* file is not found, an embeddings\n Magnitude model is created from the text corpus.\n If the specified *.bin*, *.txt*, *.vec* or *.hdf5* file is not\n found a ValueError is raised, because these models can be\n loaded but not created.\n k (int): embeddings can be queried to know the words whose vector\n representation is similar to a known vector. The OKgraph tasks\n could be using this functionality to extract their results:\n usually, the more results you are expecting from the task, the\n more words you are expecting from the embeddings.\n *k* should be set to the approximate upper-bound of the number\n of results that will be expected from the embeddings. If the\n exact number is unknown, be conservative picking a large number,\n while keeping in mind the bigger *k* is, the more memory it\n will consume.\n stream (bool): stream the URL instead of downloading it.\n lazy_loading (int): allows faster cold start when loading:\n\n +----+-------------------------------------------+\n | -1 | preload into memory |\n +----+-------------------------------------------+\n | 0 | lazy loads with unbounded in-memory cache |\n +----+-------------------------------------------+\n | \u003e0 | lazy loads with an LRU cache of that size |\n +----+-------------------------------------------+\n index_dir (str): path of the indexed corpus files directory.\n If the index directory is not specified, the default path\n points to a directory named *indexdir* with the same parent\n directory of the corpus.\n If the directory exists it is used as it is, otherwise it is\n created.\n dictionary_file (str): path of the corpus dictionary file.\n The supported files are *.npy*. No extension will be treated as\n *.npy*.\n If the dictionary file is not specified, the default path\n points to a file named *dictTotal.npy* with the same parent\n directory of the corpus.\n If the file exists it is used as it is, otherwise it is created.\n force_init (bool): forces the initialization of the embeddings,\n index and dictionary from scratch, overwriting them if already\n existing.\n\n Example:\n - Instantiating an OKgraph object specifing a corpus file:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e okg = OKgraph(corpus)\n or even\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No path have been specified for the embeddings, index directory\n and dictionary, so the default paths (same of the corpus)\n \u0027/OKgraph/Example/enwik9.magnitude\u0027,\n \u0027/OKgraph/Example/indexdir/\u0027, \u0027/OKgraph/Example/dictTotal.npy\u0027\n are implicitly used.\n All the resources will be searched in the default paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus).\n\n\n - Instantiating an OKgraph object specifing the resources paths:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e embeddings = \"/OKgraph/Example/NewDir/enwiki9_embeddings\"\n \u003e\u003e\u003e index = \"/OKgraph/Example/NewDir/enwiki9_index\"\n \u003e\u003e\u003e dictionary = \"/OKgraph/Example/NewDir/enwiki9_dictionary\"\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus,\n \u003e\u003e\u003e embeddings_file=embeddings,\n \u003e\u003e\u003e index_dir=index,\n \u003e\u003e\u003e dictionary_file=dictionary)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No extension has been specified for the embeddings and the\n dictionary, so the *.magnitude* and *.npy* exntensions will be\n automatically appended.\n All the resources will be searched in the specified paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus). In the above example, the resources\n are missing and they will be created in the new directory\n *NewDir*. *NewDir* will be automatically created.\n\n \"\"\"\n corpus_file = path.normpath(corpus_file)\n if not path.exists(corpus_file):\n raise NotExistingCorpusException(corpus_file)\n if embeddings_file is not None:\n embeddings_file = path.normpath(embeddings_file)\n if index_dir is not None:\n index_dir = path.normpath(index_dir)\n if dictionary_file is not None:\n dictionary_file = path.normpath(dictionary_file)\n embeddings_file = self._get_embeddings(corpus_file, embeddings_file, force_init)\n index_dir = self._get_index(corpus_file, index_dir, force_init)\n dictionary_file = self._get_dictionary(corpus_file, dictionary_file, force_init)\n self.embeddings = MagnitudeWordEmbeddings(embeddings_file, k, stream, lazy_loading)\n self.corpus = corpus_file\n self.index = index_dir\n self.dictionary = dictionary_file\n \n @staticmethod\n def _get_embeddings(corpus_file: str, embeddings_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the embeddings whether or not it is already\n existing.\n\n FIXME: do not work with URLs, just with files.\n\n Args:\n corpus_file (str): path of the corpus file.\n embeddings_file (str): path of the embeddings file.\n force_init (bool): if True forces the creation of the embeddings.\n\n Returns:\n str: the path of the loaded/generated Magnitude model.\n\n \"\"\"\n if embeddings_file is None:\n (corpus_basename, _) = path.splitext(corpus_file)\n embeddings_file = corpus_basename + \u0027.magnitude\u0027\n logger.info(f\u0027Embeddings file for corpus {corpus_file} not specified. Referencing to default value {embeddings_file}\u0027)\n else:\n embeddings_file = check_extension(file_name=embeddings_file, default_extension=\u0027.magnitude\u0027, allowed_extensions=[\u0027.magnitude\u0027, \u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027])\n (embeddings_basename, embeddings_extension) = path.splitext(embeddings_file)\n magnitude_file = embeddings_basename + \u0027.magnitude\u0027\n if path.exists(embeddings_file) and force_init is True:\n logger.info(f\u0027Removing existing embeddings file {embeddings_file} to generate it again\u0027)\n remove(embeddings_file)\n if embeddings_extension == \u0027.magnitude\u0027:\n if path.exists(embeddings_file):\n logger.info(f\u0027Specified embeddings file {embeddings_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified embeddings file {embeddings_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n embeddings_file = FileConverter.corpus_to_magnitude_model(corpus_file, embeddings_file)\n elif embeddings_extension in [\u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027]:\n if path.exists(magnitude_file):\n logger.info(f\u0027The Magnitude model {magnitude_file} related to the specified {embeddings_file} embeddings already exists: using it\u0027)\n embeddings_file = magnitude_file\n elif path.exists(embeddings_file):\n logger.info(f\u0027Generating Magnitude model from specified {embeddings_file} embeddings\u0027)\n FileConverter.generic_model_to_magnitude_model(embeddings_file, magnitude_file)\n embeddings_file = magnitude_file\n else:\n raise ValueError(f\u0027Specified embeddings file {embeddings_file} does not exists: it cannot be loaded and it cannot be generated (its not a Magnitude model)\u0027)\n return embeddings_file\n \n @staticmethod\n def _get_index(corpus_file: str, index_dir: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the index whether or not it is already existing.\n\n Args:\n corpus_file: path of the corpus file.\n index_dir: path of the index directory.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated index directory.\n\n \"\"\"\n if index_dir is None:\n index_dir = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_INDEX_FOLDER))\n logger.info(f\u0027Indexing directoy for corpus {corpus_file} not specified. Referencing to default value {index_dir}\u0027)\n if path.exists(index_dir) and force_init is True:\n logger.info(f\u0027Removing existing indexing directory {index_dir} to generate it again\u0027)\n remove_dir(index_dir)\n if path.exists(index_dir):\n logger.info(f\u0027Specified index directory {index_dir} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified indexing directory {index_dir} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n ix = Indexing(corpus_path=corpus_file)\n ix.indexing(index_path=index_dir)\n del ix\n return index_dir\n \n @staticmethod\n def _get_dictionary(corpus_file: str, dictionary_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the dictionary whether or not it is already\n existing.\n\n Args:\n corpus_file: path of the corpus file.\n dictionary_file: path of the dictionary file.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated dictionary file.\n\n \"\"\"\n if dictionary_file is None:\n dictionary_file = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_DICTIONARY_NAME))\n logger.info(f\u0027Dictionary file for corpus {corpus_file} not specified. Referencing to default value {dictionary_file}\u0027)\n else:\n dictionary_file = check_extension(file_name=dictionary_file, default_extension=\u0027.npy\u0027, allowed_extensions=[\u0027.npy\u0027])\n if path.exists(dictionary_file) and force_init is True:\n logger.info(f\u0027Removing existing dictionary file {dictionary_file} to generate it again\u0027)\n remove(dictionary_file)\n if path.exists(dictionary_file):\n logger.info(f\u0027Specified dictionary file {dictionary_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified dictionary file {dictionary_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n generate_dictionary(corpus_file, dictionary=dictionary_file, save_dictionary=True)\n return dictionary_file\n \n def relation_expansion(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[Tuple[str, ...]]:\n \"\"\"Finds tuples with the same implicit relation of the seed tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be\n expanded.\n k (int): limit to the number of result tuples.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[Tuple[str, ...]]: the list of tuples related to the seed\n tuples.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027relation_labeling_algo\u0027: \u0027intersection\u0027, \u0027relation_labeling_options\u0027: {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}, \u0027relation_labeling_k\u0027: 15, \u0027set_expansion_algo\u0027: \u0027centroid\u0027, \u0027set_expansion_options\u0027: {\u0027embeddings\u0027: self.embeddings}, \u0027set_expansion_k\u0027: 15}\n package = ALGORITHMS_PACKAGE + \u0027.relation_expansion.\u0027 + algo\n algo = getattr(__import__(package, fromlist=[algo]), algo)\n return algo.task(seed, k, **options)\n \n def relation_labeling(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed tuples.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.relation_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n \n def set_expansion(self, seed: List[str], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds words with the same implicit relation of the seed words \n (co-hyponyms).\n\n Args:\n seed (List[str]): list of words that has to be expanded.\n k (int): limit to the number of result words.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of words related to the seed words.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027centroid\u0027\n options = {\u0027embeddings\u0027: self.embeddings}\n package = ALGORITHMS_PACKAGE + \u0027.set_expansion.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n \n def set_labeling(self, seed: List[str], k: int = 15, algo: str = None, options: dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n words (hyperonym).\n\n Args:\n seed (List[str]): list of words that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed words.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.set_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field5", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field26", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/returnstatement11", "label": "is return statement of", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field20", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method45", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/statement139"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter75", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method7"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter61", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method60", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class22", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field25", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field106", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter77", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method7"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class2", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field154", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field29", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method47", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field47", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method21", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/package16", "label": "has body", "to": "http://rdf.webofcode.org/woc/blockstatement28"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class7", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter87", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/declarationstatement42", "label": "has source code", "to": "\n\nclass OKgraph:\n \"\"\"A class used to extract knowledge from unstructured text corpus.\n\n This class currently focuses on the following tasks:\n - **set expansion**: given one or a short set of words, continues this\n set with a list of other \u0027same-type\u0027 words (`co-hyponyms\n \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy#Co-hyponyms\u003e`_);\n - **relation expansion**: given one or a short set of word pairs,\n continues this set with a list of pairs having the same implicit\n relation of the given pairs;\n - **set labeling**: given one or a short set of words, returns a list\n of short strings (labels) describing the given set (its type or\n `hyperonym \u003chttps://en.wikipedia.org/wiki/Hyponymy_and_hypernymy\u003e`_);\n - **relation labeling**: given one or a short set of word pairs,\n returns a list of short strings (labels) describing the relation in\n the given set;\n All the tasks work with plain text corpus (untagged).\n\n Attributes:\n corpus (str): path of the corpus file.\n embeddings (MagnitudeWordEmbeddings): words embeddings (vector\n model).\n index (str): path of the indexed corpus files.\n dictionary (str): path of the corpus dictionary.\n\n \"\"\"\n corpus: str\n embeddings: MagnitudeWordEmbeddings\n index: str\n dictionary: str\n \n def __init__(self, corpus_file: str, embeddings_file: str = None, k: int = 5, stream: bool = False, lazy_loading: int = 0, index_dir: str = None, dictionary_file: str = None, force_init: bool = False):\n \"\"\"The constructor creates a OKgraph object.\n\n Loads or generates the word embeddings, corpus index and corpus\n dictionary, whether or not they already exist.\n\n Args:\n corpus_file (str): path of the corpus file. The corpus file should\n be a cleaned free text file (untagged).\n embeddings_file (MagnitudeWordEmbeddings): path or URL of the\n embeddings file. FIXME: do not correctly handle URLs.\n The supported embeddings are *.magnitude*, *.bin*, *.txt*,\n *.vec* and *.hdf5*. The *.bin*, *.txt*, *.vec* and *.hdf5*\n embeddings are supported by automatically converting them to a\n *.magnitude* file. No extension will be treated as *.magnitude*.\n If the embeddings file is not specified, the default path\n points to a *.magnitude* file with the same basename of the\n corpus file.\n If the specified file is found in the path, the embeddings is\n directly loaded.\n If the specified *.magnitude* file is not found, an embeddings\n Magnitude model is created from the text corpus.\n If the specified *.bin*, *.txt*, *.vec* or *.hdf5* file is not\n found a ValueError is raised, because these models can be\n loaded but not created.\n k (int): embeddings can be queried to know the words whose vector\n representation is similar to a known vector. The OKgraph tasks\n could be using this functionality to extract their results:\n usually, the more results you are expecting from the task, the\n more words you are expecting from the embeddings.\n *k* should be set to the approximate upper-bound of the number\n of results that will be expected from the embeddings. If the\n exact number is unknown, be conservative picking a large number,\n while keeping in mind the bigger *k* is, the more memory it\n will consume.\n stream (bool): stream the URL instead of downloading it.\n lazy_loading (int): allows faster cold start when loading:\n\n +----+-------------------------------------------+\n | -1 | preload into memory |\n +----+-------------------------------------------+\n | 0 | lazy loads with unbounded in-memory cache |\n +----+-------------------------------------------+\n | \u003e0 | lazy loads with an LRU cache of that size |\n +----+-------------------------------------------+\n index_dir (str): path of the indexed corpus files directory.\n If the index directory is not specified, the default path\n points to a directory named *indexdir* with the same parent\n directory of the corpus.\n If the directory exists it is used as it is, otherwise it is\n created.\n dictionary_file (str): path of the corpus dictionary file.\n The supported files are *.npy*. No extension will be treated as\n *.npy*.\n If the dictionary file is not specified, the default path\n points to a file named *dictTotal.npy* with the same parent\n directory of the corpus.\n If the file exists it is used as it is, otherwise it is created.\n force_init (bool): forces the initialization of the embeddings,\n index and dictionary from scratch, overwriting them if already\n existing.\n\n Example:\n - Instantiating an OKgraph object specifing a corpus file:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e okg = OKgraph(corpus)\n or even\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No path have been specified for the embeddings, index directory\n and dictionary, so the default paths (same of the corpus)\n \u0027/OKgraph/Example/enwik9.magnitude\u0027,\n \u0027/OKgraph/Example/indexdir/\u0027, \u0027/OKgraph/Example/dictTotal.npy\u0027\n are implicitly used.\n All the resources will be searched in the default paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus).\n\n\n - Instantiating an OKgraph object specifing the resources paths:\n \u003e\u003e\u003e from okgraph.core import OKgraph\n \u003e\u003e\u003e corpus = \"/OKgraph/Example/enwik9.txt\"\n \u003e\u003e\u003e embeddings = \"/OKgraph/Example/NewDir/enwiki9_embeddings\"\n \u003e\u003e\u003e index = \"/OKgraph/Example/NewDir/enwiki9_index\"\n \u003e\u003e\u003e dictionary = \"/OKgraph/Example/NewDir/enwiki9_dictionary\"\n \u003e\u003e\u003e okg = OKgraph(corpus_file=corpus,\n \u003e\u003e\u003e embeddings_file=embeddings,\n \u003e\u003e\u003e index_dir=index,\n \u003e\u003e\u003e dictionary_file=dictionary)\n This code will create an OKgraph object using the *enwiki9.txt*\n corpus.\n No extension has been specified for the embeddings and the\n dictionary, so the *.magnitude* and *.npy* exntensions will be\n automatically appended.\n All the resources will be searched in the specified paths: if\n found they will be used, otherwise the missing one will be\n created (using the corpus). In the above example, the resources\n are missing and they will be created in the new directory\n *NewDir*. *NewDir* will be automatically created.\n\n \"\"\"\n corpus_file = path.normpath(corpus_file)\n if not path.exists(corpus_file):\n raise NotExistingCorpusException(corpus_file)\n if embeddings_file is not None:\n embeddings_file = path.normpath(embeddings_file)\n if index_dir is not None:\n index_dir = path.normpath(index_dir)\n if dictionary_file is not None:\n dictionary_file = path.normpath(dictionary_file)\n embeddings_file = self._get_embeddings(corpus_file, embeddings_file, force_init)\n index_dir = self._get_index(corpus_file, index_dir, force_init)\n dictionary_file = self._get_dictionary(corpus_file, dictionary_file, force_init)\n self.embeddings = MagnitudeWordEmbeddings(embeddings_file, k, stream, lazy_loading)\n self.corpus = corpus_file\n self.index = index_dir\n self.dictionary = dictionary_file\n \n @staticmethod\n def _get_embeddings(corpus_file: str, embeddings_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the embeddings whether or not it is already\n existing.\n\n FIXME: do not work with URLs, just with files.\n\n Args:\n corpus_file (str): path of the corpus file.\n embeddings_file (str): path of the embeddings file.\n force_init (bool): if True forces the creation of the embeddings.\n\n Returns:\n str: the path of the loaded/generated Magnitude model.\n\n \"\"\"\n if embeddings_file is None:\n (corpus_basename, _) = path.splitext(corpus_file)\n embeddings_file = corpus_basename + \u0027.magnitude\u0027\n logger.info(f\u0027Embeddings file for corpus {corpus_file} not specified. Referencing to default value {embeddings_file}\u0027)\n else:\n embeddings_file = check_extension(file_name=embeddings_file, default_extension=\u0027.magnitude\u0027, allowed_extensions=[\u0027.magnitude\u0027, \u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027])\n (embeddings_basename, embeddings_extension) = path.splitext(embeddings_file)\n magnitude_file = embeddings_basename + \u0027.magnitude\u0027\n if path.exists(embeddings_file) and force_init is True:\n logger.info(f\u0027Removing existing embeddings file {embeddings_file} to generate it again\u0027)\n remove(embeddings_file)\n if embeddings_extension == \u0027.magnitude\u0027:\n if path.exists(embeddings_file):\n logger.info(f\u0027Specified embeddings file {embeddings_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified embeddings file {embeddings_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n embeddings_file = FileConverter.corpus_to_magnitude_model(corpus_file, embeddings_file)\n elif embeddings_extension in [\u0027.txt\u0027, \u0027.bin\u0027, \u0027.vec\u0027, \u0027.hdf5\u0027]:\n if path.exists(magnitude_file):\n logger.info(f\u0027The Magnitude model {magnitude_file} related to the specified {embeddings_file} embeddings already exists: using it\u0027)\n embeddings_file = magnitude_file\n elif path.exists(embeddings_file):\n logger.info(f\u0027Generating Magnitude model from specified {embeddings_file} embeddings\u0027)\n FileConverter.generic_model_to_magnitude_model(embeddings_file, magnitude_file)\n embeddings_file = magnitude_file\n else:\n raise ValueError(f\u0027Specified embeddings file {embeddings_file} does not exists: it cannot be loaded and it cannot be generated (its not a Magnitude model)\u0027)\n return embeddings_file\n \n @staticmethod\n def _get_index(corpus_file: str, index_dir: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the index whether or not it is already existing.\n\n Args:\n corpus_file: path of the corpus file.\n index_dir: path of the index directory.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated index directory.\n\n \"\"\"\n if index_dir is None:\n index_dir = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_INDEX_FOLDER))\n logger.info(f\u0027Indexing directoy for corpus {corpus_file} not specified. Referencing to default value {index_dir}\u0027)\n if path.exists(index_dir) and force_init is True:\n logger.info(f\u0027Removing existing indexing directory {index_dir} to generate it again\u0027)\n remove_dir(index_dir)\n if path.exists(index_dir):\n logger.info(f\u0027Specified index directory {index_dir} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified indexing directory {index_dir} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n ix = Indexing(corpus_path=corpus_file)\n ix.indexing(index_path=index_dir)\n del ix\n return index_dir\n \n @staticmethod\n def _get_dictionary(corpus_file: str, dictionary_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the dictionary whether or not it is already\n existing.\n\n Args:\n corpus_file: path of the corpus file.\n dictionary_file: path of the dictionary file.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated dictionary file.\n\n \"\"\"\n if dictionary_file is None:\n dictionary_file = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_DICTIONARY_NAME))\n logger.info(f\u0027Dictionary file for corpus {corpus_file} not specified. Referencing to default value {dictionary_file}\u0027)\n else:\n dictionary_file = check_extension(file_name=dictionary_file, default_extension=\u0027.npy\u0027, allowed_extensions=[\u0027.npy\u0027])\n if path.exists(dictionary_file) and force_init is True:\n logger.info(f\u0027Removing existing dictionary file {dictionary_file} to generate it again\u0027)\n remove(dictionary_file)\n if path.exists(dictionary_file):\n logger.info(f\u0027Specified dictionary file {dictionary_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified dictionary file {dictionary_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n generate_dictionary(corpus_file, dictionary=dictionary_file, save_dictionary=True)\n return dictionary_file\n \n def relation_expansion(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[Tuple[str, ...]]:\n \"\"\"Finds tuples with the same implicit relation of the seed tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be\n expanded.\n k (int): limit to the number of result tuples.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[Tuple[str, ...]]: the list of tuples related to the seed\n tuples.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027relation_labeling_algo\u0027: \u0027intersection\u0027, \u0027relation_labeling_options\u0027: {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}, \u0027relation_labeling_k\u0027: 15, \u0027set_expansion_algo\u0027: \u0027centroid\u0027, \u0027set_expansion_options\u0027: {\u0027embeddings\u0027: self.embeddings}, \u0027set_expansion_k\u0027: 15}\n package = ALGORITHMS_PACKAGE + \u0027.relation_expansion.\u0027 + algo\n algo = getattr(__import__(package, fromlist=[algo]), algo)\n return algo.task(seed, k, **options)\n \n def relation_labeling(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed tuples.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.relation_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n \n def set_expansion(self, seed: List[str], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds words with the same implicit relation of the seed words \n (co-hyponyms).\n\n Args:\n seed (List[str]): list of words that has to be expanded.\n k (int): limit to the number of result words.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of words related to the seed words.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027centroid\u0027\n options = {\u0027embeddings\u0027: self.embeddings}\n package = ALGORITHMS_PACKAGE + \u0027.set_expansion.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n \n def set_labeling(self, seed: List[str], k: int = 15, algo: str = None, options: dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n words (hyperonym).\n\n Args:\n seed (List[str]): list of words that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.set_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed words.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.set_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)\n"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field131", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field150", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement74", "label": "has source code", "to": "from okgraph.core import OKgraph, NotExistingCorpusException, DEFAULT_DICTIONARY_NAME"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter67", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class20", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "has source code", "to": "\ndef relation_labeling(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[str]:\n \"\"\"Finds labels describing the implicit relation between the seed\n tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be labeled.\n k (int): limit to the number of result labels.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_labeling*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[str]: the list of labels related to the seed tuples.\n \n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}\n package = ALGORITHMS_PACKAGE + \u0027.relation_labeling.\u0027 + algo\n algorithm = getattr(__import__(package, fromlist=[algo]), algo)\n return algorithm.task(seed, k, **options)"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter75", "label": "has name", "to": "self"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/globalvariable11", "label": "has package", "to": "http://rdf.webofcode.org/woc/package16"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method23", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class18", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field159", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter57", "label": "is positional only", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method11", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field6", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field89", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "has source code", "to": "\ndef relation_expansion(self, seed: List[Tuple[str, ...]], k: int = 15, algo: str = None, options: Dict = None) -\u003e List[Tuple[str, ...]]:\n \"\"\"Finds tuples with the same implicit relation of the seed tuples.\n\n Args:\n seed (List[Tuple[str, ...]]): list of tuples that has to be\n expanded.\n k (int): limit to the number of result tuples.\n algo (str): name of the chosen algorithm. The algorithm should be\n found in *okgraph.task.relation_expansion*.\n options (Dict): dictionary containing the keyword arguments for the\n chosen algorithm.\n\n Returns:\n List[Tuple[str, ...]]: the list of tuples related to the seed\n tuples.\n\n \"\"\"\n if algo is None or options is None:\n algo = \u0027intersection\u0027\n options = {\u0027relation_labeling_algo\u0027: \u0027intersection\u0027, \u0027relation_labeling_options\u0027: {\u0027dictionary\u0027: self.dictionary, \u0027index\u0027: self.index}, \u0027relation_labeling_k\u0027: 15, \u0027set_expansion_algo\u0027: \u0027centroid\u0027, \u0027set_expansion_options\u0027: {\u0027embeddings\u0027: self.embeddings}, \u0027set_expansion_k\u0027: 15}\n package = ALGORITHMS_PACKAGE + \u0027.relation_expansion.\u0027 + algo\n algo = getattr(__import__(package, fromlist=[algo]), algo)\n return algo.task(seed, k, **options)"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "has name", "to": "_get_index"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "has documentation", "to": "path of the corpus dictionary."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter80", "label": "has name", "to": "self"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable116", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field142", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable112", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field14", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter65", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method9", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field166", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement165"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/declarationstatement49"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method3", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class34", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class3", "label": "has body", "to": "http://rdf.webofcode.org/woc/blockstatement12"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "has declaration", "to": "http://rdf.webofcode.org/woc/declarationstatement45"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field147", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class11", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class5", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class3", "label": "has documentation", "to": "The base class of the class hierarchy. When called, it accepts no arguments and returns a new featureless instance that has no instance attributes and cannot be given any."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field138", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class44", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field168", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor3", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement84", "label": "has source code", "to": "from okgraph.core import OKgraph"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field153", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method7", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement130", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/blockstatement148"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement84", "label": "imports", "to": "http://rdf.webofcode.org/woc/class20"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field97", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class4", "label": "extends", "to": "http://rdf.webofcode.org/woc/class3"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "has documentation", "to": "Returns: the path of the loaded/generated Magnitude model."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/returnstatement14", "label": "is return statement of", "to": "http://rdf.webofcode.org/woc/method7"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field30", "label": "has simple name", "to": "index"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor2", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field61", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class20", "label": "has fully-qualified name", "to": "okgraph.core.OKgraph"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter80", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class30", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field149", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/blockstatement341", "label": "has block statement", "to": "http://rdf.webofcode.org/woc/importstatement84"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class1", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/declarationstatement42", "label": "has statement position", "to": "11"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/class48", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method2", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field31", "label": "has type", "to": "http://rdf.webofcode.org/woc/class5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field49", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter88", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/importstatement84", "label": "has statement position", "to": "2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/constructor2", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/returnstatement12", "label": "is return statement of", "to": "http://rdf.webofcode.org/woc/method5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/field157", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method22", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/globalvariable4", "label": "has package", "to": "http://rdf.webofcode.org/woc/package16"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter84", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method8"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/localvariable111", "label": "is declared by", "to": "http://rdf.webofcode.org/woc/method4"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "has source code", "to": "\n@staticmethod\ndef _get_dictionary(corpus_file: str, dictionary_file: str, force_init: bool) -\u003e str:\n \"\"\"Loads or generates the dictionary whether or not it is already\n existing.\n\n Args:\n corpus_file: path of the corpus file.\n dictionary_file: path of the dictionary file.\n force_init: if True forces the creation of the index.\n\n Returns:\n str: the path of the loaded/generated dictionary file.\n\n \"\"\"\n if dictionary_file is None:\n dictionary_file = path.normpath(path.join(path.dirname(corpus_file), DEFAULT_DICTIONARY_NAME))\n logger.info(f\u0027Dictionary file for corpus {corpus_file} not specified. Referencing to default value {dictionary_file}\u0027)\n else:\n dictionary_file = check_extension(file_name=dictionary_file, default_extension=\u0027.npy\u0027, allowed_extensions=[\u0027.npy\u0027])\n if path.exists(dictionary_file) and force_init is True:\n logger.info(f\u0027Removing existing dictionary file {dictionary_file} to generate it again\u0027)\n remove(dictionary_file)\n if path.exists(dictionary_file):\n logger.info(f\u0027Specified dictionary file {dictionary_file} for corpus {corpus_file} found: using it\u0027)\n else:\n if force_init is False:\n logger.info(f\"Specified dictionary file {dictionary_file} for corpus {corpus_file} doesn\u0027t exist: generating a new one\")\n generate_dictionary(corpus_file, dictionary=dictionary_file, save_dictionary=True)\n return dictionary_file"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter85", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/method9"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method4", "label": "has type", "to": "http://rdf.webofcode.org/woc/class5"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method8", "label": "has name", "to": "relation_labeling"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method6", "label": "has documentation", "to": "Loads or generates the dictionary whether or not it is already existing."}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/parameter57", "label": "is parameter of", "to": "http://rdf.webofcode.org/woc/constructor2"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method24", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method18", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method5", "label": "is var args", "to": "False"}, {"arrows": "to", "from": "http://rdf.webofcode.org/woc/method14", "label": "has modifier", "to": "http://rdf.webofcode.org/woc/PythonPublicAccessModifier"}]);
// adding nodes and edges to the graph
data = {nodes: nodes, edges: edges};
var options = {
"configure": {
"enabled": false
},
"edges": {
"color": {
"inherit": true
},
"smooth": {
"enabled": true,
"type": "dynamic"
}
},
"interaction": {
"dragNodes": true,
"hideEdgesOnDrag": false,
"hideNodesOnDrag": false
},
"physics": {
"enabled": true,
"repulsion": {
"centralGravity": 0.2,
"damping": 0.09,
"nodeDistance": 200,
"springConstant": 0.05,
"springLength": 200
},
"solver": "repulsion",
"stabilization": {
"enabled": true,
"fit": true,
"iterations": 1000,
"onlyDynamicEdges": false,
"updateInterval": 50
}
}
};
network = new vis.Network(container, data, options);
network.on("stabilizationProgress", function(params) {
document.getElementById('loadingBar').removeAttribute("style");
var maxWidth = 496;
var minWidth = 20;
var widthFactor = params.iterations/params.total;
var width = Math.max(minWidth,maxWidth * widthFactor);
document.getElementById('bar').style.width = width + 'px';
document.getElementById('text').innerHTML = Math.round(widthFactor*100) + '%';
});
network.once("stabilizationIterationsDone", function() {
document.getElementById('text').innerHTML = '100%';
document.getElementById('bar').style.width = '496px';
document.getElementById('loadingBar').style.opacity = 0;
// really clean the dom element
setTimeout(function () {document.getElementById('loadingBar').style.display = 'none';}, 500);
});
return network;
}
drawGraph();
</script>
</body>
</html>