Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
Textfont.__init__ | (
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
) |
Construct a new Textfont object
Sets the text font.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scattergeo.Textfont`
color
colorsrc
... |
Construct a new Textfont object
Sets the text font. | def __init__(
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
):
"""
Construct a new Textfont object
Sets the text font.
Parameters
----... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"family",
"=",
"None",
",",
"familysrc",
"=",
"None",
",",
"size",
"=",
"None",
",",
"sizesrc",
"=",
"None",
",",
"*",
"*",
"kw... | [
215,
4
] | [
329,
34
] | python | en | ['en', 'error', 'th'] | False |
_do_paste_mask | (masks, boxes, img_h, img_w, skip_empty=True) | Paste instance masks acoording to boxes.
This implementation is modified from
https://github.com/facebookresearch/detectron2/
Args:
masks (Tensor): N, 1, H, W
boxes (Tensor): N, 4
img_h (int): Height of the image to be pasted.
img_w (int): Width of the image to be pasted.
... | Paste instance masks acoording to boxes. | def _do_paste_mask(masks, boxes, img_h, img_w, skip_empty=True):
"""Paste instance masks acoording to boxes.
This implementation is modified from
https://github.com/facebookresearch/detectron2/
Args:
masks (Tensor): N, 1, H, W
boxes (Tensor): N, 4
img_h (int): Height of the ima... | [
"def",
"_do_paste_mask",
"(",
"masks",
",",
"boxes",
",",
"img_h",
",",
"img_w",
",",
"skip_empty",
"=",
"True",
")",
":",
"# On GPU, paste all masks together (up to chunk size)",
"# by using the entire image to sample the masks",
"# Compared to pasting them one by one,",
"# th... | [
239,
0
] | [
307,
34
] | python | en | ['en', 'en', 'en'] | True |
at_server_start | () |
This is called every time the server starts up, regardless of
how it was shut down.
|
This is called every time the server starts up, regardless of
how it was shut down.
| def at_server_start():
"""
This is called every time the server starts up, regardless of
how it was shut down.
"""
pass | [
"def",
"at_server_start",
"(",
")",
":",
"pass"
] | [
19,
0
] | [
24,
8
] | python | en | ['en', 'error', 'th'] | False |
at_server_stop | () |
This is called just before the server is shut down, regardless
of it is for a reload, reset or shutdown.
|
This is called just before the server is shut down, regardless
of it is for a reload, reset or shutdown.
| def at_server_stop():
"""
This is called just before the server is shut down, regardless
of it is for a reload, reset or shutdown.
"""
pass | [
"def",
"at_server_stop",
"(",
")",
":",
"pass"
] | [
27,
0
] | [
32,
8
] | python | en | ['en', 'error', 'th'] | False |
at_server_reload_start | () |
This is called only when server starts back up after a reload.
|
This is called only when server starts back up after a reload.
| def at_server_reload_start():
"""
This is called only when server starts back up after a reload.
"""
pass | [
"def",
"at_server_reload_start",
"(",
")",
":",
"pass"
] | [
35,
0
] | [
39,
8
] | python | en | ['en', 'error', 'th'] | False |
at_server_reload_stop | () |
This is called only time the server stops before a reload.
|
This is called only time the server stops before a reload.
| def at_server_reload_stop():
"""
This is called only time the server stops before a reload.
"""
pass | [
"def",
"at_server_reload_stop",
"(",
")",
":",
"pass"
] | [
42,
0
] | [
46,
8
] | python | en | ['en', 'error', 'th'] | False |
at_server_cold_start | () |
This is called only when the server starts "cold", i.e. after a
shutdown or a reset.
|
This is called only when the server starts "cold", i.e. after a
shutdown or a reset.
| def at_server_cold_start():
"""
This is called only when the server starts "cold", i.e. after a
shutdown or a reset.
"""
pass | [
"def",
"at_server_cold_start",
"(",
")",
":",
"pass"
] | [
49,
0
] | [
54,
8
] | python | en | ['en', 'error', 'th'] | False |
at_server_cold_stop | () |
This is called only when the server goes down due to a shutdown or
reset.
|
This is called only when the server goes down due to a shutdown or
reset.
| def at_server_cold_stop():
"""
This is called only when the server goes down due to a shutdown or
reset.
"""
pass | [
"def",
"at_server_cold_stop",
"(",
")",
":",
"pass"
] | [
57,
0
] | [
62,
8
] | python | en | ['en', 'error', 'th'] | False |
test_scheduled_once_after_view_change | (nodeSet, validUpgrade, upgradeScheduled) |
Test that each node schedules update only once after each view change
|
Test that each node schedules update only once after each view change
| def test_scheduled_once_after_view_change(nodeSet, validUpgrade, upgradeScheduled):
'''
Test that each node schedules update only once after each view change
'''
# emulate view changes 1-4
emulate_view_change_pool_for_upgrade(nodeSet)
emulate_view_change_pool_for_upgrade(nodeSet)
emulate_vie... | [
"def",
"test_scheduled_once_after_view_change",
"(",
"nodeSet",
",",
"validUpgrade",
",",
"upgradeScheduled",
")",
":",
"# emulate view changes 1-4",
"emulate_view_change_pool_for_upgrade",
"(",
"nodeSet",
")",
"emulate_view_change_pool_for_upgrade",
"(",
"nodeSet",
")",
"emula... | [
12,
0
] | [
32,
64
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_object_with_account | (self, ostring, exact=True, candidates=None) |
Search for an object based on its account's name or dbref.
Args:
ostring (str or int): Search criterion or dbref. Searching
for an account is sometimes initiated by appending an `*` to
the beginning of the search criterion (e.g. in
local_and_... |
Search for an object based on its account's name or dbref. | def get_object_with_account(self, ostring, exact=True, candidates=None):
"""
Search for an object based on its account's name or dbref.
Args:
ostring (str or int): Search criterion or dbref. Searching
for an account is sometimes initiated by appending an `*` to
... | [
"def",
"get_object_with_account",
"(",
"self",
",",
"ostring",
",",
"exact",
"=",
"True",
",",
"candidates",
"=",
"None",
")",
":",
"ostring",
"=",
"to_unicode",
"(",
"ostring",
")",
".",
"lstrip",
"(",
"'*'",
")",
"# simplest case - search by dbref",
"dbref",... | [
57,
4
] | [
95,
83
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_objs_with_key_and_typeclass | (self, oname, otypeclass_path, candidates=None) |
Returns objects based on simultaneous key and typeclass match.
Args:
oname (str): Object key to search for
otypeclass_path (str): Full Python path to tyepclass to search for
candidates (list, optional): Only match among the given list of candidates.
Returns... |
Returns objects based on simultaneous key and typeclass match. | def get_objs_with_key_and_typeclass(self, oname, otypeclass_path, candidates=None):
"""
Returns objects based on simultaneous key and typeclass match.
Args:
oname (str): Object key to search for
otypeclass_path (str): Full Python path to tyepclass to search for
... | [
"def",
"get_objs_with_key_and_typeclass",
"(",
"self",
",",
"oname",
",",
"otypeclass_path",
",",
"candidates",
"=",
"None",
")",
":",
"cand_restriction",
"=",
"candidates",
"is",
"not",
"None",
"and",
"Q",
"(",
"pk__in",
"=",
"[",
"_GA",
"(",
"obj",
",",
... | [
97,
4
] | [
111,
112
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_objs_with_attr | (self, attribute_name, candidates=None) |
Get objects based on having a certain Attribute defined.
Args:
attribute_name (str): Attribute name to search for.
candidates (list, optional): Only match among the given list of candidates.
Returns:
matches (list): All objects having the given attribute_n... |
Get objects based on having a certain Attribute defined. | def get_objs_with_attr(self, attribute_name, candidates=None):
"""
Get objects based on having a certain Attribute defined.
Args:
attribute_name (str): Attribute name to search for.
candidates (list, optional): Only match among the given list of candidates.
Retu... | [
"def",
"get_objs_with_attr",
"(",
"self",
",",
"attribute_name",
",",
"candidates",
"=",
"None",
")",
":",
"cand_restriction",
"=",
"candidates",
"is",
"not",
"None",
"and",
"Q",
"(",
"db_attributes__db_obj__pk__in",
"=",
"[",
"_GA",
"(",
"obj",
",",
"\"id\"",... | [
115,
4
] | [
130,
92
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_objs_with_attr_value | (self, attribute_name, attribute_value, candidates=None, typeclasses=None) |
Get all objects having the given attrname set to the given value.
Args:
attribute_name (str): Attribute key to search for.
attribute_value (str): Attribute value to search for.
candidates (list, optional): Candidate objects to limit search to.
typeclass... |
Get all objects having the given attrname set to the given value. | def get_objs_with_attr_value(self, attribute_name, attribute_value, candidates=None, typeclasses=None):
"""
Get all objects having the given attrname set to the given value.
Args:
attribute_name (str): Attribute key to search for.
attribute_value (str): Attribute value ... | [
"def",
"get_objs_with_attr_value",
"(",
"self",
",",
"attribute_name",
",",
"attribute_value",
",",
"candidates",
"=",
"None",
",",
"typeclasses",
"=",
"None",
")",
":",
"cand_restriction",
"=",
"candidates",
"is",
"not",
"None",
"and",
"Q",
"(",
"pk__in",
"="... | [
132,
4
] | [
168,
34
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_objs_with_db_property | (self, property_name, candidates=None) |
Get all objects having a given db field property.
Args:
property_name (str): The name of the field to match for.
candidates (list, optional): Only search among th egiven candidates.
Returns:
matches (list): The found matches.
|
Get all objects having a given db field property. | def get_objs_with_db_property(self, property_name, candidates=None):
"""
Get all objects having a given db field property.
Args:
property_name (str): The name of the field to match for.
candidates (list, optional): Only search among th egiven candidates.
Returns... | [
"def",
"get_objs_with_db_property",
"(",
"self",
",",
"property_name",
",",
"candidates",
"=",
"None",
")",
":",
"property_name",
"=",
"\"db_%s\"",
"%",
"property_name",
".",
"lstrip",
"(",
"'db_'",
")",
"cand_restriction",
"=",
"candidates",
"is",
"not",
"None"... | [
170,
4
] | [
189,
21
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_objs_with_db_property_value | (self, property_name, property_value, candidates=None, typeclasses=None) |
Get objects with a specific field name and value.
Args:
property_name (str): Field name to search for.
property_value (any): Value required for field with `property_name` to have.
candidates (list, optional): List of objects to limit search to.
typeclass... |
Get objects with a specific field name and value. | def get_objs_with_db_property_value(self, property_name, property_value, candidates=None, typeclasses=None):
"""
Get objects with a specific field name and value.
Args:
property_name (str): Field name to search for.
property_value (any): Value required for field with `pr... | [
"def",
"get_objs_with_db_property_value",
"(",
"self",
",",
"property_name",
",",
"property_value",
",",
"candidates",
"=",
"None",
",",
"typeclasses",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"property_value",
",",
"basestring",
")",
":",
"property_value",... | [
191,
4
] | [
219,
21
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_contents | (self, location, excludeobj=None) |
Get all objects that has a location set to this one.
Args:
location (Object): Where to get contents from.
excludeobj (Object or list, optional): One or more objects
to exclude from the match.
Returns:
contents (list): Matching contents, with... |
Get all objects that has a location set to this one. | def get_contents(self, location, excludeobj=None):
"""
Get all objects that has a location set to this one.
Args:
location (Object): Where to get contents from.
excludeobj (Object or list, optional): One or more objects
to exclude from the match.
... | [
"def",
"get_contents",
"(",
"self",
",",
"location",
",",
"excludeobj",
"=",
"None",
")",
":",
"exclude_restriction",
"=",
"Q",
"(",
"pk__in",
"=",
"[",
"_GA",
"(",
"obj",
",",
"\"id\"",
")",
"for",
"obj",
"in",
"make_iter",
"(",
"excludeobj",
")",
"]"... | [
221,
4
] | [
234,
77
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.get_objs_with_key_or_alias | (self, ostring, exact=True,
candidates=None, typeclasses=None) |
Args:
ostring (str): A search criterion.
exact (bool, optional): Require exact match of ostring
(still case-insensitive). If `False`, will do fuzzy matching
using `evennia.utils.utils.string_partial_matching` algorithm.
candidates (list): Only... |
Args:
ostring (str): A search criterion.
exact (bool, optional): Require exact match of ostring
(still case-insensitive). If `False`, will do fuzzy matching
using `evennia.utils.utils.string_partial_matching` algorithm.
candidates (list): Only... | def get_objs_with_key_or_alias(self, ostring, exact=True,
candidates=None, typeclasses=None):
"""
Args:
ostring (str): A search criterion.
exact (bool, optional): Require exact match of ostring
(still case-insensitive). If `False... | [
"def",
"get_objs_with_key_or_alias",
"(",
"self",
",",
"ostring",
",",
"exact",
"=",
"True",
",",
"candidates",
"=",
"None",
",",
"typeclasses",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"ostring",
",",
"basestring",
")",
":",
"if",
"hasattr",... | [
236,
4
] | [
296,
21
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.search_object | (self, searchdata,
attribute_name=None,
typeclass=None,
candidates=None,
exact=True,
use_dbref=True) |
Search as an object globally or in a list of candidates and
return results. The result is always an Object. Always returns
a list.
Args:
searchdata (str or Object): The entity to match for. This is
usually a key string but may also be an object itself.
... |
Search as an object globally or in a list of candidates and
return results. The result is always an Object. Always returns
a list. | def search_object(self, searchdata,
attribute_name=None,
typeclass=None,
candidates=None,
exact=True,
use_dbref=True):
"""
Search as an object globally or in a list of candidates and
ret... | [
"def",
"search_object",
"(",
"self",
",",
"searchdata",
",",
"attribute_name",
"=",
"None",
",",
"typeclass",
"=",
"None",
",",
"candidates",
"=",
"None",
",",
"exact",
"=",
"True",
",",
"use_dbref",
"=",
"True",
")",
":",
"def",
"_searcher",
"(",
"searc... | [
300,
4
] | [
424,
22
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.copy_object | (self, original_object, new_key=None,
new_location=None, new_home=None,
new_permissions=None, new_locks=None,
new_aliases=None, new_destination=None) |
Create and return a new object as a copy of the original object. All
will be identical to the original except for the arguments given
specifically to this method. Object contents will not be copied.
Args:
original_object (Object): The object to make a copy from.
... |
Create and return a new object as a copy of the original object. All
will be identical to the original except for the arguments given
specifically to this method. Object contents will not be copied. | def copy_object(self, original_object, new_key=None,
new_location=None, new_home=None,
new_permissions=None, new_locks=None,
new_aliases=None, new_destination=None):
"""
Create and return a new object as a copy of the original object. All
... | [
"def",
"copy_object",
"(",
"self",
",",
"original_object",
",",
"new_key",
"=",
"None",
",",
"new_location",
"=",
"None",
",",
"new_home",
"=",
"None",
",",
"new_permissions",
"=",
"None",
",",
"new_locks",
"=",
"None",
",",
"new_aliases",
"=",
"None",
","... | [
432,
4
] | [
508,
25
] | python | en | ['en', 'error', 'th'] | False |
ObjectDBManager.clear_all_sessids | (self) |
Clear the db_sessid field of all objects having also the
db_account field set.
|
Clear the db_sessid field of all objects having also the
db_account field set.
| def clear_all_sessids(self):
"""
Clear the db_sessid field of all objects having also the
db_account field set.
"""
self.filter(db_sessid__isnull=False).update(db_sessid=None) | [
"def",
"clear_all_sessids",
"(",
"self",
")",
":",
"self",
".",
"filter",
"(",
"db_sessid__isnull",
"=",
"False",
")",
".",
"update",
"(",
"db_sessid",
"=",
"None",
")"
] | [
510,
4
] | [
515,
67
] | python | en | ['en', 'error', 'th'] | False |
initialize_control_information | (opt, build_task=True) |
Loads information from word2count.pkl, arora.pkl in data/controllable_dialogue, and
uses it to initialize objects for computing NIDF and response-relatedness controls.
By default (build_task=True) we will also build the controllable_dialogue task i.e.
download data/controllable_dialogue if necessary.
... |
Loads information from word2count.pkl, arora.pkl in data/controllable_dialogue, and
uses it to initialize objects for computing NIDF and response-relatedness controls. | def initialize_control_information(opt, build_task=True):
"""
Loads information from word2count.pkl, arora.pkl in data/controllable_dialogue, and
uses it to initialize objects for computing NIDF and response-relatedness controls.
By default (build_task=True) we will also build the controllable_dialogue... | [
"def",
"initialize_control_information",
"(",
"opt",
",",
"build_task",
"=",
"True",
")",
":",
"global",
"word2nidf",
",",
"nidf_feats",
",",
"arora_data",
",",
"sent_embedder",
"if",
"word2nidf",
"is",
"not",
"None",
":",
"# already loaded, no need to do anything",
... | [
81,
0
] | [
110,
5
] | python | en | ['en', 'error', 'th'] | False |
flatten | (list_of_lists) |
Flatten a list of lists.
|
Flatten a list of lists.
| def flatten(list_of_lists):
"""
Flatten a list of lists.
"""
return [item for sublist in list_of_lists for item in sublist] | [
"def",
"flatten",
"(",
"list_of_lists",
")",
":",
"return",
"[",
"item",
"for",
"sublist",
"in",
"list_of_lists",
"for",
"item",
"in",
"sublist",
"]"
] | [
118,
0
] | [
122,
66
] | python | en | ['en', 'error', 'th'] | False |
intrep_frac | (lst) |
Returns the fraction of items in the list that are repeated.
|
Returns the fraction of items in the list that are repeated.
| def intrep_frac(lst):
"""
Returns the fraction of items in the list that are repeated.
"""
if len(lst) == 0:
return 0
num_rep = 0
for idx in range(len(lst)):
if lst[idx] in lst[:idx]:
num_rep += 1
return num_rep / len(lst) | [
"def",
"intrep_frac",
"(",
"lst",
")",
":",
"if",
"len",
"(",
"lst",
")",
"==",
"0",
":",
"return",
"0",
"num_rep",
"=",
"0",
"for",
"idx",
"in",
"range",
"(",
"len",
"(",
"lst",
")",
")",
":",
"if",
"lst",
"[",
"idx",
"]",
"in",
"lst",
"[",
... | [
125,
0
] | [
135,
29
] | python | en | ['en', 'error', 'th'] | False |
extrep_frac | (lst1, lst2) |
Returns the fraction of items in lst1 that are in lst2.
|
Returns the fraction of items in lst1 that are in lst2.
| def extrep_frac(lst1, lst2):
"""
Returns the fraction of items in lst1 that are in lst2.
"""
if len(lst1) == 0:
return 0
num_rep = len([x for x in lst1 if x in lst2])
return num_rep / len(lst1) | [
"def",
"extrep_frac",
"(",
"lst1",
",",
"lst2",
")",
":",
"if",
"len",
"(",
"lst1",
")",
"==",
"0",
":",
"return",
"0",
"num_rep",
"=",
"len",
"(",
"[",
"x",
"for",
"x",
"in",
"lst1",
"if",
"x",
"in",
"lst2",
"]",
")",
"return",
"num_rep",
"/",... | [
138,
0
] | [
145,
30
] | python | en | ['en', 'error', 'th'] | False |
get_ngrams | (text, n) |
Returns all ngrams that are in the text.
Inputs:
text: string
n: int
Returns:
list of strings (each is a ngram)
|
Returns all ngrams that are in the text. | def get_ngrams(text, n):
"""
Returns all ngrams that are in the text.
Inputs:
text: string
n: int
Returns:
list of strings (each is a ngram)
"""
tokens = text.split()
return [
" ".join(tokens[i : i + n]) for i in range(len(tokens) - (n - 1))
] | [
"def",
"get_ngrams",
"(",
"text",
",",
"n",
")",
":",
"tokens",
"=",
"text",
".",
"split",
"(",
")",
"return",
"[",
"\" \"",
".",
"join",
"(",
"tokens",
"[",
"i",
":",
"i",
"+",
"n",
"]",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"toke... | [
148,
0
] | [
161,
5
] | python | en | ['en', 'error', 'th'] | False |
matching_ngram_completions | (comparison_seq, hypothesis, n) |
Return the list of words that if appended to hypothesis, would create a n-gram that
already exists in comparison_seq. For efficiency, this function represents words as
integers not strings.
Inputs:
comparison_seq: list of integers
hypothesis: list of integers or None
n: integer... |
Return the list of words that if appended to hypothesis, would create a n-gram that
already exists in comparison_seq. For efficiency, this function represents words as
integers not strings. | def matching_ngram_completions(comparison_seq, hypothesis, n):
"""
Return the list of words that if appended to hypothesis, would create a n-gram that
already exists in comparison_seq. For efficiency, this function represents words as
integers not strings.
Inputs:
comparison_seq: list of in... | [
"def",
"matching_ngram_completions",
"(",
"comparison_seq",
",",
"hypothesis",
",",
"n",
")",
":",
"if",
"hypothesis",
"is",
"None",
"or",
"len",
"(",
"hypothesis",
")",
"<",
"n",
"-",
"1",
"or",
"len",
"(",
"comparison_seq",
")",
"<",
"n",
":",
"return"... | [
164,
0
] | [
188,
20
] | python | en | ['en', 'error', 'th'] | False |
intrep_word_used_before | (dict, hypothesis, history, wt, feat, remove_stopwords) |
Weighted decoding feature function. See explanation above. This feature is 1 for
words that have already appeared within the hypothesis, 0 otherwise.
Additional inputs:
remove_stopwords: bool. If True, stopwords are not included when identifying words
that have already appeared.
|
Weighted decoding feature function. See explanation above. This feature is 1 for
words that have already appeared within the hypothesis, 0 otherwise. | def intrep_word_used_before(dict, hypothesis, history, wt, feat, remove_stopwords):
"""
Weighted decoding feature function. See explanation above. This feature is 1 for
words that have already appeared within the hypothesis, 0 otherwise.
Additional inputs:
remove_stopwords: bool. If True, stopwor... | [
"def",
"intrep_word_used_before",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wt",
",",
"feat",
",",
"remove_stopwords",
")",
":",
"if",
"hypothesis",
"is",
"not",
"None",
":",
"if",
"remove_stopwords",
":",
"hypothesis",
"=",
"[",
"idx",
"for",
... | [
215,
0
] | [
229,
15
] | python | en | ['en', 'error', 'th'] | False |
intrep_ngram_used_before | (dict, hypothesis, history, wt, feat, n) |
Weighted decoding feature function. See explanation above. This feature is 1 for
words that, if added to the hypothesis, will create a n-gram that has already
appeared in the hypothesis; otherwise 0.
Additional inputs:
n: int, the size of the n-grams considered.
|
Weighted decoding feature function. See explanation above. This feature is 1 for
words that, if added to the hypothesis, will create a n-gram that has already
appeared in the hypothesis; otherwise 0. | def intrep_ngram_used_before(dict, hypothesis, history, wt, feat, n):
"""
Weighted decoding feature function. See explanation above. This feature is 1 for
words that, if added to the hypothesis, will create a n-gram that has already
appeared in the hypothesis; otherwise 0.
Additional inputs:
... | [
"def",
"intrep_ngram_used_before",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wt",
",",
"feat",
",",
"n",
")",
":",
"if",
"hypothesis",
"is",
"not",
"None",
":",
"bad_words",
"=",
"matching_ngram_completions",
"(",
"hypothesis",
",",
"hypothesis",
... | [
232,
0
] | [
245,
15
] | python | en | ['en', 'error', 'th'] | False |
extrep_word_used_before | (
dict, hypothesis, history, wt, feat, remove_stopwords, person
) |
Weighted decoding feature function. See explanation above. This feature is 1 for
words that have already been used earlier in the conversation; otherwise 0.
Additional inputs:
remove_stopwords: bool. If True, stopwords are not included when identifying words
that have already appeared.
... |
Weighted decoding feature function. See explanation above. This feature is 1 for
words that have already been used earlier in the conversation; otherwise 0. | def extrep_word_used_before(
dict, hypothesis, history, wt, feat, remove_stopwords, person
):
"""
Weighted decoding feature function. See explanation above. This feature is 1 for
words that have already been used earlier in the conversation; otherwise 0.
Additional inputs:
remove_stopwords: b... | [
"def",
"extrep_word_used_before",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wt",
",",
"feat",
",",
"remove_stopwords",
",",
"person",
")",
":",
"if",
"person",
"==",
"'self'",
":",
"prev_utts",
"=",
"history",
".",
"own_utts",
"elif",
"person",
... | [
248,
0
] | [
275,
15
] | python | en | ['en', 'error', 'th'] | False |
extrep_ngram_used_before | (dict, hypothesis, history, wt, feat, n, person) |
Weighted decoding feature function. See explanation above. This feature is 1 for
words that, if added to hypothesis, would create a n-gram that has already been used
earlier in the conversation; otherwise 0.
Additional inputs:
n: int, the size of the n-grams considered.
person: If 'self', ... |
Weighted decoding feature function. See explanation above. This feature is 1 for
words that, if added to hypothesis, would create a n-gram that has already been used
earlier in the conversation; otherwise 0. | def extrep_ngram_used_before(dict, hypothesis, history, wt, feat, n, person):
"""
Weighted decoding feature function. See explanation above. This feature is 1 for
words that, if added to hypothesis, would create a n-gram that has already been used
earlier in the conversation; otherwise 0.
Additiona... | [
"def",
"extrep_ngram_used_before",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wt",
",",
"feat",
",",
"n",
",",
"person",
")",
":",
"if",
"person",
"==",
"'self'",
":",
"prev_utts",
"=",
"history",
".",
"own_utts",
"elif",
"person",
"==",
"'par... | [
278,
0
] | [
307,
15
] | python | en | ['en', 'error', 'th'] | False |
nidf | (dict, hypothesis, history, wt, feat) |
Weighted decoding feature function.
See explanation above. This feature is equal to the NIDF (normalized inverse
document frequency) score for each word. The score is always between 0 and 1.
|
Weighted decoding feature function. | def nidf(dict, hypothesis, history, wt, feat):
"""
Weighted decoding feature function.
See explanation above. This feature is equal to the NIDF (normalized inverse
document frequency) score for each word. The score is always between 0 and 1.
"""
feat += wt * nidf_feats.get_feat_vec(dict)
re... | [
"def",
"nidf",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wt",
",",
"feat",
")",
":",
"feat",
"+=",
"wt",
"*",
"nidf_feats",
".",
"get_feat_vec",
"(",
"dict",
")",
"return",
"feat"
] | [
310,
0
] | [
318,
15
] | python | en | ['en', 'error', 'th'] | False |
qn_words | (dict, hypothesis, history, wt, feat) |
Weighted decoding feature function.
See explanation above. This feature is 1 for 'interrogative words', 0 otherwise.
|
Weighted decoding feature function. | def qn_words(dict, hypothesis, history, wt, feat):
"""
Weighted decoding feature function.
See explanation above. This feature is 1 for 'interrogative words', 0 otherwise.
"""
qn_indices = [dict[w] for w in QN_WORDS]
feat[qn_indices] += wt
return feat | [
"def",
"qn_words",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wt",
",",
"feat",
")",
":",
"qn_indices",
"=",
"[",
"dict",
"[",
"w",
"]",
"for",
"w",
"in",
"QN_WORDS",
"]",
"feat",
"[",
"qn_indices",
"]",
"+=",
"wt",
"return",
"feat"
] | [
321,
0
] | [
329,
15
] | python | en | ['en', 'error', 'th'] | False |
lastutt_sim_arora_word | (dict, hypothesis, history, wt, feat) |
Weighted decoding feature function.
See explanation above. Given a word w, this feature is equal to cos_sim(word_emb(w),
sent_emb(l)) the cosine similarity between the GloVe vector for word w, and the
Arora-style sentence embedding for the partner's last utterance l.
|
Weighted decoding feature function. | def lastutt_sim_arora_word(dict, hypothesis, history, wt, feat):
"""
Weighted decoding feature function.
See explanation above. Given a word w, this feature is equal to cos_sim(word_emb(w),
sent_emb(l)) the cosine similarity between the GloVe vector for word w, and the
Arora-style sentence embeddin... | [
"def",
"lastutt_sim_arora_word",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wt",
",",
"feat",
")",
":",
"partner_utts",
"=",
"history",
".",
"partner_utts",
"if",
"len",
"(",
"partner_utts",
")",
"==",
"0",
":",
"# if bot goes first then do nothing",
... | [
332,
0
] | [
356,
15
] | python | en | ['en', 'error', 'th'] | False |
get_wd_features | (dict, hypothesis, history, wd_features, wd_weights) |
Given a conversational history and a hypothesis (i.e. partially generated response),
compute the Weighted Decoding features for all words in the vocabulary.
Inputs:
dict: parlai DictionaryAgent
hypothesis: list of ints or None
history: a ConvAI2History. This represents the conversa... |
Given a conversational history and a hypothesis (i.e. partially generated response),
compute the Weighted Decoding features for all words in the vocabulary. | def get_wd_features(dict, hypothesis, history, wd_features, wd_weights):
"""
Given a conversational history and a hypothesis (i.e. partially generated response),
compute the Weighted Decoding features for all words in the vocabulary.
Inputs:
dict: parlai DictionaryAgent
hypothesis: list... | [
"def",
"get_wd_features",
"(",
"dict",
",",
"hypothesis",
",",
"history",
",",
"wd_features",
",",
"wd_weights",
")",
":",
"wd_feat_vec",
"=",
"torch",
".",
"zeros",
"(",
"(",
"len",
"(",
"dict",
")",
")",
")",
"for",
"f",
",",
"w",
"in",
"zip",
"(",... | [
452,
0
] | [
470,
22
] | python | en | ['en', 'error', 'th'] | False |
intrep_repeated_word_frac | (utt, history, remove_stopwords) |
Sentence-level attribute function.
See explanation above.
Returns the fraction of words in utt that are repeated.
Additional inputs:
remove_stopwords: bool. If True, stopwords are removed before counting repetition.
|
Sentence-level attribute function. | def intrep_repeated_word_frac(utt, history, remove_stopwords):
"""
Sentence-level attribute function.
See explanation above.
Returns the fraction of words in utt that are repeated.
Additional inputs:
remove_stopwords: bool. If True, stopwords are removed before counting repetition.
"""
... | [
"def",
"intrep_repeated_word_frac",
"(",
"utt",
",",
"history",
",",
"remove_stopwords",
")",
":",
"assert",
"utt",
".",
"strip",
"(",
")",
"!=",
"\"\"",
"tokens",
"=",
"utt",
".",
"split",
"(",
")",
"if",
"remove_stopwords",
":",
"tokens",
"=",
"[",
"t"... | [
488,
0
] | [
501,
30
] | python | en | ['en', 'error', 'th'] | False |
intrep_repeated_ngram_frac | (utt, history, n) |
Sentence-level attribute function.
See explanation above.
Returns the fraction of n-grams in utt that are repeated.
Additional inputs:
n: int, the size of the n-grams considered.
|
Sentence-level attribute function. | def intrep_repeated_ngram_frac(utt, history, n):
"""
Sentence-level attribute function.
See explanation above.
Returns the fraction of n-grams in utt that are repeated.
Additional inputs:
n: int, the size of the n-grams considered.
"""
assert utt.strip() != ""
ngrams = get_ngrams(... | [
"def",
"intrep_repeated_ngram_frac",
"(",
"utt",
",",
"history",
",",
"n",
")",
":",
"assert",
"utt",
".",
"strip",
"(",
")",
"!=",
"\"\"",
"ngrams",
"=",
"get_ngrams",
"(",
"utt",
",",
"n",
")",
"return",
"intrep_frac",
"(",
"ngrams",
")"
] | [
504,
0
] | [
515,
30
] | python | en | ['en', 'error', 'th'] | False |
extrep_repeated_word_frac | (utt, history, remove_stopwords, person) |
Sentence-level attribute function.
See explanation above.
Returns the fraction of words in utt that already appeared in a previous utterance.
Additional inputs:
remove_stopwords: bool. If True, stopwords are removed from utt before counting
repetition.
person: If 'self', identify w... |
Sentence-level attribute function. | def extrep_repeated_word_frac(utt, history, remove_stopwords, person):
"""
Sentence-level attribute function.
See explanation above.
Returns the fraction of words in utt that already appeared in a previous utterance.
Additional inputs:
remove_stopwords: bool. If True, stopwords are removed fr... | [
"def",
"extrep_repeated_word_frac",
"(",
"utt",
",",
"history",
",",
"remove_stopwords",
",",
"person",
")",
":",
"assert",
"utt",
".",
"strip",
"(",
")",
"!=",
"\"\"",
"if",
"person",
"==",
"'self'",
":",
"prev_utts",
"=",
"history",
".",
"own_utts",
"# s... | [
518,
0
] | [
544,
42
] | python | en | ['en', 'error', 'th'] | False |
extrep_repeated_ngram_frac | (utt, history, n, person) |
Sentence-level attribute function.
See explanation above.
Returns fraction of n-grams in utt that already appeared in a previous utterance.
Additional inputs:
n: int, the size of the n-grams considered.
person: If 'self', identify n-grams that have already been used by self (bot).
... |
Sentence-level attribute function. | def extrep_repeated_ngram_frac(utt, history, n, person):
"""
Sentence-level attribute function.
See explanation above.
Returns fraction of n-grams in utt that already appeared in a previous utterance.
Additional inputs:
n: int, the size of the n-grams considered.
person: If 'self', iden... | [
"def",
"extrep_repeated_ngram_frac",
"(",
"utt",
",",
"history",
",",
"n",
",",
"person",
")",
":",
"assert",
"utt",
".",
"strip",
"(",
")",
"!=",
"\"\"",
"if",
"person",
"==",
"'self'",
":",
"prev_utts",
"=",
"history",
".",
"own_utts",
"# should already ... | [
547,
0
] | [
570,
47
] | python | en | ['en', 'error', 'th'] | False |
avg_nidf | (utt, history) |
Sentence-level attribute function.
See explanation above. Returns the mean NIDF of the words in utt.
|
Sentence-level attribute function. | def avg_nidf(utt, history):
"""
Sentence-level attribute function.
See explanation above. Returns the mean NIDF of the words in utt.
"""
words = utt.split()
problem_words = [w for w in words if w not in word2nidf]
ok_words = [w for w in words if w in word2nidf]
if len(ok_words) == 0:
... | [
"def",
"avg_nidf",
"(",
"utt",
",",
"history",
")",
":",
"words",
"=",
"utt",
".",
"split",
"(",
")",
"problem_words",
"=",
"[",
"w",
"for",
"w",
"in",
"words",
"if",
"w",
"not",
"in",
"word2nidf",
"]",
"ok_words",
"=",
"[",
"w",
"for",
"w",
"in"... | [
573,
0
] | [
596,
19
] | python | en | ['en', 'error', 'th'] | False |
contains_qmark | (utt, history) |
Sentence-level attribute function.
See explanation above. Returns 1 if utt contains a question mark, otherwise 0.
|
Sentence-level attribute function. | def contains_qmark(utt, history):
"""
Sentence-level attribute function.
See explanation above. Returns 1 if utt contains a question mark, otherwise 0.
"""
return int("?" in utt) | [
"def",
"contains_qmark",
"(",
"utt",
",",
"history",
")",
":",
"return",
"int",
"(",
"\"?\"",
"in",
"utt",
")"
] | [
599,
0
] | [
605,
26
] | python | en | ['en', 'error', 'th'] | False |
lastutt_sim_arora_sent | (utt, history) |
Sentence-level attribute function. See explanation above.
Returns
cos_sim(sent_emb(last_utt), sent_emb(utt))
the cosine similarity of the Arora-style sentence embeddings for the current
response (utt) and the partner's last utterance (last_utt, which is in history).
- If there is no last_ut... |
Sentence-level attribute function. See explanation above. | def lastutt_sim_arora_sent(utt, history):
"""
Sentence-level attribute function. See explanation above.
Returns
cos_sim(sent_emb(last_utt), sent_emb(utt))
the cosine similarity of the Arora-style sentence embeddings for the current
response (utt) and the partner's last utterance (last_utt, wh... | [
"def",
"lastutt_sim_arora_sent",
"(",
"utt",
",",
"history",
")",
":",
"partner_utts",
"=",
"history",
".",
"partner_utts",
"if",
"len",
"(",
"partner_utts",
")",
"==",
"0",
":",
"# print('WARNING: returning lastuttsim = None because bot goes first')",
"return",
"None",... | [
608,
0
] | [
641,
21
] | python | en | ['en', 'error', 'th'] | False |
wordlist_frac | (utt, history, word_list) |
Sentence-level attribute function.
See explanation above.
Returns the fraction of words in utt that are in word_list.
Additional inputs:
word_list: list of strings.
|
Sentence-level attribute function. | def wordlist_frac(utt, history, word_list):
"""
Sentence-level attribute function.
See explanation above.
Returns the fraction of words in utt that are in word_list.
Additional inputs:
word_list: list of strings.
"""
words = utt.split()
num_in_list = len([w for w in words if w in ... | [
"def",
"wordlist_frac",
"(",
"utt",
",",
"history",
",",
"word_list",
")",
":",
"words",
"=",
"utt",
".",
"split",
"(",
")",
"num_in_list",
"=",
"len",
"(",
"[",
"w",
"for",
"w",
"in",
"words",
"if",
"w",
"in",
"word_list",
"]",
")",
"return",
"num... | [
644,
0
] | [
655,
35
] | python | en | ['en', 'error', 'th'] | False |
eval_attr | (utt, history, attr) |
Given a conversational history and an utterance, compute the requested sentence-
level attribute for utt.
Inputs:
utt: string. The utterance, tokenized and lowercase
history: a ConvAI2History. This represents the conversation history.
attr: string. The name of the sentence-level at... |
Given a conversational history and an utterance, compute the requested sentence-
level attribute for utt. | def eval_attr(utt, history, attr):
"""
Given a conversational history and an utterance, compute the requested sentence-
level attribute for utt.
Inputs:
utt: string. The utterance, tokenized and lowercase
history: a ConvAI2History. This represents the conversation history.
attr:... | [
"def",
"eval_attr",
"(",
"utt",
",",
"history",
",",
"attr",
")",
":",
"# Check everything is lowercased already",
"assert",
"utt",
"==",
"utt",
".",
"lower",
"(",
")",
"for",
"thing",
"in",
"[",
"history",
".",
"persona_lines",
",",
"history",
".",
"partner... | [
724,
0
] | [
744,
49
] | python | en | ['en', 'error', 'th'] | False |
get_qn_bucket_probs | () |
Assuming we have 11 CT question buckets (0 to 10), compute P(bucket|question=1) and
P(bucket|question=0); this is needed so we can probabilistically assign incoming
training examples to buckets.
Returns:
prob_bucket_given_qn: list of floats length 11; P(bucket|question=1)
prob_bucket_given... |
Assuming we have 11 CT question buckets (0 to 10), compute P(bucket|question=1) and
P(bucket|question=0); this is needed so we can probabilistically assign incoming
training examples to buckets. | def get_qn_bucket_probs():
"""
Assuming we have 11 CT question buckets (0 to 10), compute P(bucket|question=1) and
P(bucket|question=0); this is needed so we can probabilistically assign incoming
training examples to buckets.
Returns:
prob_bucket_given_qn: list of floats length 11; P(bucket|q... | [
"def",
"get_qn_bucket_probs",
"(",
")",
":",
"prob_qn",
"=",
"41101",
"/",
"131438",
"# P(question=1), computed across ConvAI2 dataset. ~31%",
"# Compute P(bucket), i.e. the total sizes of the buckets.",
"# This is done by assuming that buckets 1 to 10 are equal in size, but bucket 0",
"# ... | [
754,
0
] | [
785,
56
] | python | en | ['en', 'error', 'th'] | False |
bucket_question | (ex, ctrl, num_buckets) |
Given an example (where the target response may or may not be a question) and its
history, probabilistically determine what question-asking CT bucket to use.
Inputs:
ex: message dictionary containing a bool field 'question'
ctrl: string. The name of the CT control. Should be 'question'.
... |
Given an example (where the target response may or may not be a question) and its
history, probabilistically determine what question-asking CT bucket to use. | def bucket_question(ex, ctrl, num_buckets):
"""
Given an example (where the target response may or may not be a question) and its
history, probabilistically determine what question-asking CT bucket to use.
Inputs:
ex: message dictionary containing a bool field 'question'
ctrl: string. The n... | [
"def",
"bucket_question",
"(",
"ex",
",",
"ctrl",
",",
"num_buckets",
")",
":",
"assert",
"num_buckets",
"==",
"11",
"is_qn",
"=",
"int",
"(",
"ex",
"[",
"'question'",
"]",
")",
"assert",
"is_qn",
"in",
"[",
"0",
",",
"1",
"]",
"is_qn",
"=",
"bool",
... | [
791,
0
] | [
812,
14
] | python | en | ['en', 'error', 'th'] | False |
sort_into_bucket | (val, bucket_lbs) |
Returns the highest bucket such that val >= lower bound for that bucket.
Inputs:
val: float. The value to be sorted into a bucket.
bucket_lbs: list of floats, sorted ascending.
Returns:
bucket_id: int in range(num_buckets); the bucket that val belongs to.
|
Returns the highest bucket such that val >= lower bound for that bucket. | def sort_into_bucket(val, bucket_lbs):
"""
Returns the highest bucket such that val >= lower bound for that bucket.
Inputs:
val: float. The value to be sorted into a bucket.
bucket_lbs: list of floats, sorted ascending.
Returns:
bucket_id: int in range(num_buckets); the bucket that v... | [
"def",
"sort_into_bucket",
"(",
"val",
",",
"bucket_lbs",
")",
":",
"num_buckets",
"=",
"len",
"(",
"bucket_lbs",
")",
"for",
"bucket_id",
"in",
"range",
"(",
"num_buckets",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"# iterate descending",
"lb",
... | [
815,
0
] | [
831,
88
] | python | en | ['en', 'error', 'th'] | False |
bucket_contvar | (ex, ctrl, num_buckets) |
Given ex, which contains a continuous value for a particular control variable,
return the bucketed version of that control value.
Inputs:
ex: message dictionary. Assume it has key ctrl, mapping to the value.
ctrl: string. The name of the CT control.
num_buckets: int. The number of bucket... |
Given ex, which contains a continuous value for a particular control variable,
return the bucketed version of that control value. | def bucket_contvar(ex, ctrl, num_buckets):
"""
Given ex, which contains a continuous value for a particular control variable,
return the bucketed version of that control value.
Inputs:
ex: message dictionary. Assume it has key ctrl, mapping to the value.
ctrl: string. The name of the CT con... | [
"def",
"bucket_contvar",
"(",
"ex",
",",
"ctrl",
",",
"num_buckets",
")",
":",
"if",
"ctrl",
"not",
"in",
"ex",
".",
"keys",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Control %s not found in example. Available keys in \"",
"\"this example: %s\"",
"%",
"(",
"... | [
834,
0
] | [
876,
49
] | python | en | ['en', 'error', 'th'] | False |
get_ctrl_vec | (exs, history, control_settings) |
Given a batch of examples with given history, return the bucketed CT control values.
This is used both when training and evaluating CT systems.
Inputs:
exs: list length batch_size of message dictionaries. Each dictionary contains
a 'text' field, and a field for each CT control we're using, a... |
Given a batch of examples with given history, return the bucketed CT control values.
This is used both when training and evaluating CT systems. | def get_ctrl_vec(exs, history, control_settings):
"""
Given a batch of examples with given history, return the bucketed CT control values.
This is used both when training and evaluating CT systems.
Inputs:
exs: list length batch_size of message dictionaries. Each dictionary contains
a 'te... | [
"def",
"get_ctrl_vec",
"(",
"exs",
",",
"history",
",",
"control_settings",
")",
":",
"if",
"len",
"(",
"control_settings",
")",
"==",
"0",
":",
"return",
"None",
"# ctrl_vec is shape (bsz, num_controls) filled with -1's",
"ctrl_vec",
"=",
"-",
"torch",
".",
"ones... | [
934,
0
] | [
979,
19
] | python | en | ['en', 'error', 'th'] | False |
NIDFFeats.make_feat_vec | (self, dict) |
Construct the NIDF feature vector for the given dict.
|
Construct the NIDF feature vector for the given dict.
| def make_feat_vec(self, dict):
"""
Construct the NIDF feature vector for the given dict.
"""
print("Constructing NIDF feature vector...")
self.NIDF_FEATS = torch.zeros((len(dict)))
num_oovs = 0
for idx in range(len(dict)):
word = dict[idx]
... | [
"def",
"make_feat_vec",
"(",
"self",
",",
"dict",
")",
":",
"print",
"(",
"\"Constructing NIDF feature vector...\"",
")",
"self",
".",
"NIDF_FEATS",
"=",
"torch",
".",
"zeros",
"(",
"(",
"len",
"(",
"dict",
")",
")",
")",
"num_oovs",
"=",
"0",
"for",
"id... | [
39,
4
] | [
62,
9
] | python | en | ['en', 'error', 'th'] | False |
NIDFFeats.get_feat_vec | (self, dict) |
Return the NIDF feature vector.
If necessary, construct it first.
|
Return the NIDF feature vector. | def get_feat_vec(self, dict):
"""
Return the NIDF feature vector.
If necessary, construct it first.
"""
if self.NIDF_FEATS is None:
self.make_feat_vec(dict)
return self.NIDF_FEATS | [
"def",
"get_feat_vec",
"(",
"self",
",",
"dict",
")",
":",
"if",
"self",
".",
"NIDF_FEATS",
"is",
"None",
":",
"self",
".",
"make_feat_vec",
"(",
"dict",
")",
"return",
"self",
".",
"NIDF_FEATS"
] | [
64,
4
] | [
72,
30
] | python | en | ['en', 'error', 'th'] | False |
retrieve_connection_menu | (
connection_id: str, context: InjectionContext
) | Retrieve the previously-received action menu. | Retrieve the previously-received action menu. | async def retrieve_connection_menu(
connection_id: str, context: InjectionContext
) -> Menu:
"""Retrieve the previously-received action menu."""
storage: BaseStorage = await context.inject(BaseStorage)
try:
record = await storage.search_records(
MENU_RECORD_TYPE, {"connection_id": co... | [
"async",
"def",
"retrieve_connection_menu",
"(",
"connection_id",
":",
"str",
",",
"context",
":",
"InjectionContext",
")",
"->",
"Menu",
":",
"storage",
":",
"BaseStorage",
"=",
"await",
"context",
".",
"inject",
"(",
"BaseStorage",
")",
"try",
":",
"record",... | [
11,
0
] | [
22,
59
] | python | en | ['en', 'pt', 'en'] | True |
save_connection_menu | (
menu: Menu, connection_id: str, context: InjectionContext
) | Save a received action menu. | Save a received action menu. | async def save_connection_menu(
menu: Menu, connection_id: str, context: InjectionContext
):
"""Save a received action menu."""
storage: BaseStorage = await context.inject(BaseStorage)
try:
record = await storage.search_records(
MENU_RECORD_TYPE, {"connection_id": connection_id}
... | [
"async",
"def",
"save_connection_menu",
"(",
"menu",
":",
"Menu",
",",
"connection_id",
":",
"str",
",",
"context",
":",
"InjectionContext",
")",
":",
"storage",
":",
"BaseStorage",
"=",
"await",
"context",
".",
"inject",
"(",
"BaseStorage",
")",
"try",
":",... | [
25,
0
] | [
57,
9
] | python | en | ['en', 'en', 'en'] | True |
build_dataloader | (dataset,
samples_per_gpu,
workers_per_gpu,
num_gpus=1,
dist=True,
shuffle=True,
seed=None,
**kwargs) | Build PyTorch DataLoader.
In distributed training, each GPU/process has a dataloader.
In non-distributed training, there is only one dataloader for all GPUs.
Args:
dataset (Dataset): A PyTorch dataset.
samples_per_gpu (int): Number of training samples on each GPU, i.e.,
batch s... | Build PyTorch DataLoader. | def build_dataloader(dataset,
samples_per_gpu,
workers_per_gpu,
num_gpus=1,
dist=True,
shuffle=True,
seed=None,
**kwargs):
"""Build PyTorch DataLoader.
In distribut... | [
"def",
"build_dataloader",
"(",
"dataset",
",",
"samples_per_gpu",
",",
"workers_per_gpu",
",",
"num_gpus",
"=",
"1",
",",
"dist",
"=",
"True",
",",
"shuffle",
"=",
"True",
",",
"seed",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"rank",
",",
"worl... | [
67,
0
] | [
126,
22
] | python | en | ['en', 'sv', 'en'] | True |
Lightposition.x | (self) |
Numeric vector, representing the X coordinate for each vertex.
The 'x' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
|
Numeric vector, representing the X coordinate for each vertex.
The 'x' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000] | def x(self):
"""
Numeric vector, representing the X coordinate for each vertex.
The 'x' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
"""
return self["x"] | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | [
15,
4
] | [
26,
24
] | python | en | ['en', 'error', 'th'] | False |
Lightposition.y | (self) |
Numeric vector, representing the Y coordinate for each vertex.
The 'y' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
|
Numeric vector, representing the Y coordinate for each vertex.
The 'y' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000] | def y(self):
"""
Numeric vector, representing the Y coordinate for each vertex.
The 'y' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
"""
return self["y"] | [
"def",
"y",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"y\"",
"]"
] | [
35,
4
] | [
46,
24
] | python | en | ['en', 'error', 'th'] | False |
Lightposition.z | (self) |
Numeric vector, representing the Z coordinate for each vertex.
The 'z' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
|
Numeric vector, representing the Z coordinate for each vertex.
The 'z' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000] | def z(self):
"""
Numeric vector, representing the Z coordinate for each vertex.
The 'z' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
"""
return self["z"] | [
"def",
"z",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"z\"",
"]"
] | [
55,
4
] | [
66,
24
] | python | en | ['en', 'error', 'th'] | False |
Lightposition.__init__ | (self, arg=None, x=None, y=None, z=None, **kwargs) |
Construct a new Lightposition object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.surface.Lightposition`
x
Numeric vector, representing the X coo... |
Construct a new Lightposition object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.surface.Lightposition`
x
Numeric vector, representing the X coo... | def __init__(self, arg=None, x=None, y=None, z=None, **kwargs):
"""
Construct a new Lightposition object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.surface.... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"z",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Lightposition",
",",
"self",
")",
".",
"__init__",
"(",
"\"lightpositi... | [
88,
4
] | [
160,
34
] | python | en | ['en', 'error', 'th'] | False |
Parcats.arrangement | (self) |
Sets the drag interaction mode for categories and dimensions.
If `perpendicular`, the categories can only move along a line
perpendicular to the paths. If `freeform`, the categories can
freely move on the plane. If `fixed`, the categories and
dimensions are stationary.
... |
Sets the drag interaction mode for categories and dimensions.
If `perpendicular`, the categories can only move along a line
perpendicular to the paths. If `freeform`, the categories can
freely move on the plane. If `fixed`, the categories and
dimensions are stationary.
... | def arrangement(self):
"""
Sets the drag interaction mode for categories and dimensions.
If `perpendicular`, the categories can only move along a line
perpendicular to the paths. If `freeform`, the categories can
freely move on the plane. If `fixed`, the categories and
di... | [
"def",
"arrangement",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"arrangement\"",
"]"
] | [
38,
4
] | [
54,
34
] | python | en | ['en', 'error', 'th'] | False |
Parcats.bundlecolors | (self) |
Sort paths so that like colors are bundled together within each
category.
The 'bundlecolors' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Sort paths so that like colors are bundled together within each
category.
The 'bundlecolors' property must be specified as a bool
(either True, or False) | def bundlecolors(self):
"""
Sort paths so that like colors are bundled together within each
category.
The 'bundlecolors' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["bundlecolors"] | [
"def",
"bundlecolors",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bundlecolors\"",
"]"
] | [
63,
4
] | [
75,
35
] | python | en | ['en', 'error', 'th'] | False |
Parcats.counts | (self) |
The number of observations represented by each state. Defaults
to 1 so that each state represents one observation
The 'counts' property is a number and may be specified as:
- An int or float in the interval [0, inf]
- A tuple, list, or one-dimensional numpy array of the... |
The number of observations represented by each state. Defaults
to 1 so that each state represents one observation
The 'counts' property is a number and may be specified as:
- An int or float in the interval [0, inf]
- A tuple, list, or one-dimensional numpy array of the... | def counts(self):
"""
The number of observations represented by each state. Defaults
to 1 so that each state represents one observation
The 'counts' property is a number and may be specified as:
- An int or float in the interval [0, inf]
- A tuple, list, or one-d... | [
"def",
"counts",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"counts\"",
"]"
] | [
84,
4
] | [
97,
29
] | python | en | ['en', 'error', 'th'] | False |
Parcats.countssrc | (self) |
Sets the source reference on Chart Studio Cloud for counts .
The 'countssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for counts .
The 'countssrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def countssrc(self):
"""
Sets the source reference on Chart Studio Cloud for counts .
The 'countssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["countssrc"] | [
"def",
"countssrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"countssrc\"",
"]"
] | [
106,
4
] | [
117,
32
] | python | en | ['en', 'error', 'th'] | False |
Parcats.dimensions | (self) |
The dimensions (variables) of the parallel categories diagram.
The 'dimensions' property is a tuple of instances of
Dimension that may be specified as:
- A list or tuple of instances of plotly.graph_objs.parcats.Dimension
- A list or tuple of dicts of string/value prope... |
The dimensions (variables) of the parallel categories diagram.
The 'dimensions' property is a tuple of instances of
Dimension that may be specified as:
- A list or tuple of instances of plotly.graph_objs.parcats.Dimension
- A list or tuple of dicts of string/value prope... | def dimensions(self):
"""
The dimensions (variables) of the parallel categories diagram.
The 'dimensions' property is a tuple of instances of
Dimension that may be specified as:
- A list or tuple of instances of plotly.graph_objs.parcats.Dimension
- A list or tup... | [
"def",
"dimensions",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dimensions\"",
"]"
] | [
126,
4
] | [
193,
33
] | python | en | ['en', 'error', 'th'] | False |
Parcats.dimensiondefaults | (self) |
When used in a template (as
layout.template.data.parcats.dimensiondefaults), sets the
default property values to use for elements of
parcats.dimensions
The 'dimensiondefaults' property is an instance of Dimension
that may be specified as:
- An instance of ... |
When used in a template (as
layout.template.data.parcats.dimensiondefaults), sets the
default property values to use for elements of
parcats.dimensions
The 'dimensiondefaults' property is an instance of Dimension
that may be specified as:
- An instance of ... | def dimensiondefaults(self):
"""
When used in a template (as
layout.template.data.parcats.dimensiondefaults), sets the
default property values to use for elements of
parcats.dimensions
The 'dimensiondefaults' property is an instance of Dimension
that may be s... | [
"def",
"dimensiondefaults",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dimensiondefaults\"",
"]"
] | [
202,
4
] | [
221,
40
] | python | en | ['en', 'error', 'th'] | False |
Parcats.domain | (self) |
The 'domain' property is an instance of Domain
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Domain`
- A dict of string/value properties that will be passed
to the Domain constructor
Supported dict properties:
... |
The 'domain' property is an instance of Domain
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Domain`
- A dict of string/value properties that will be passed
to the Domain constructor
Supported dict properties:
... | def domain(self):
"""
The 'domain' property is an instance of Domain
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Domain`
- A dict of string/value properties that will be passed
to the Domain constructor
Supported d... | [
"def",
"domain",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"domain\"",
"]"
] | [
230,
4
] | [
258,
29
] | python | en | ['en', 'error', 'th'] | False |
Parcats.hoverinfo | (self) |
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
... |
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
... | def hoverinfo(self):
"""
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
... | [
"def",
"hoverinfo",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverinfo\"",
"]"
] | [
267,
4
] | [
283,
32
] | python | en | ['en', 'error', 'th'] | False |
Parcats.hoveron | (self) |
Sets the hover interaction mode for the parcats diagram. If
`category`, hover interaction take place per category. If
`color`, hover interactions take place per color per category.
If `dimension`, hover interactions take place across all
categories per dimension.
Th... |
Sets the hover interaction mode for the parcats diagram. If
`category`, hover interaction take place per category. If
`color`, hover interactions take place per color per category.
If `dimension`, hover interactions take place across all
categories per dimension.
Th... | def hoveron(self):
"""
Sets the hover interaction mode for the parcats diagram. If
`category`, hover interaction take place per category. If
`color`, hover interactions take place per color per category.
If `dimension`, hover interactions take place across all
categories ... | [
"def",
"hoveron",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoveron\"",
"]"
] | [
292,
4
] | [
308,
30
] | python | en | ['en', 'error', 'th'] | False |
Parcats.hovertemplate | (self) |
Template string used for rendering the information that appear
on hover box. Note that this will override `hoverinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$... |
Template string used for rendering the information that appear
on hover box. Note that this will override `hoverinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$... | def hovertemplate(self):
"""
Template string used for rendering the information that appear
on hover box. Note that this will override `hoverinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d... | [
"def",
"hovertemplate",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hovertemplate\"",
"]"
] | [
317,
4
] | [
349,
36
] | python | en | ['en', 'error', 'th'] | False |
Parcats.labelfont | (self) |
Sets the font for the `dimension` labels.
The 'labelfont' property is an instance of Labelfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Labelfont`
- A dict of string/value properties that will be passed
to the Labelfont co... |
Sets the font for the `dimension` labels.
The 'labelfont' property is an instance of Labelfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Labelfont`
- A dict of string/value properties that will be passed
to the Labelfont co... | def labelfont(self):
"""
Sets the font for the `dimension` labels.
The 'labelfont' property is an instance of Labelfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Labelfont`
- A dict of string/value properties that will be passed... | [
"def",
"labelfont",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"labelfont\"",
"]"
] | [
358,
4
] | [
395,
32
] | python | en | ['en', 'error', 'th'] | False |
Parcats.line | (self) |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... | def line(self):
"""
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict proper... | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"line\"",
"]"
] | [
404,
4
] | [
538,
27
] | python | en | ['en', 'error', 'th'] | False |
Parcats.meta | (self) |
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To acce... |
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To acce... | def meta(self):
"""
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text ... | [
"def",
"meta",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"meta\"",
"]"
] | [
547,
4
] | [
566,
27
] | python | en | ['en', 'error', 'th'] | False |
Parcats.metasrc | (self) |
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def metasrc(self):
"""
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["metasrc"] | [
"def",
"metasrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"metasrc\"",
"]"
] | [
575,
4
] | [
586,
30
] | python | en | ['en', 'error', 'th'] | False |
Parcats.name | (self) |
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def name(self):
"""
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
... | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"name\"",
"]"
] | [
595,
4
] | [
608,
27
] | python | en | ['en', 'error', 'th'] | False |
Parcats.sortpaths | (self) |
Sets the path sorting algorithm. If `forward`, sort paths based
on dimension categories from left to right. If `backward`, sort
paths based on dimensions categories from right to left.
The 'sortpaths' property is an enumeration that may be specified as:
- One of the follo... |
Sets the path sorting algorithm. If `forward`, sort paths based
on dimension categories from left to right. If `backward`, sort
paths based on dimensions categories from right to left.
The 'sortpaths' property is an enumeration that may be specified as:
- One of the follo... | def sortpaths(self):
"""
Sets the path sorting algorithm. If `forward`, sort paths based
on dimension categories from left to right. If `backward`, sort
paths based on dimensions categories from right to left.
The 'sortpaths' property is an enumeration that may be specified ... | [
"def",
"sortpaths",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sortpaths\"",
"]"
] | [
617,
4
] | [
631,
32
] | python | en | ['en', 'error', 'th'] | False |
Parcats.stream | (self) |
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
... |
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
... | def stream(self):
"""
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported d... | [
"def",
"stream",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"stream\"",
"]"
] | [
640,
4
] | [
664,
29
] | python | en | ['en', 'error', 'th'] | False |
Parcats.tickfont | (self) |
Sets the font for the `category` labels.
The 'tickfont' property is an instance of Tickfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Tickfont`
- A dict of string/value properties that will be passed
to the Tickfont constru... |
Sets the font for the `category` labels.
The 'tickfont' property is an instance of Tickfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Tickfont`
- A dict of string/value properties that will be passed
to the Tickfont constru... | def tickfont(self):
"""
Sets the font for the `category` labels.
The 'tickfont' property is an instance of Tickfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.parcats.Tickfont`
- A dict of string/value properties that will be passed
... | [
"def",
"tickfont",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickfont\"",
"]"
] | [
673,
4
] | [
710,
31
] | python | en | ['en', 'error', 'th'] | False |
Parcats.uid | (self) |
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
... |
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def uid(self):
"""
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Return... | [
"def",
"uid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uid\"",
"]"
] | [
719,
4
] | [
732,
26
] | python | en | ['en', 'error', 'th'] | False |
Parcats.uirevision | (self) |
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are co... |
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are co... | def uirevision(self):
"""
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driv... | [
"def",
"uirevision",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uirevision\"",
"]"
] | [
741,
4
] | [
765,
33
] | python | en | ['en', 'error', 'th'] | False |
Parcats.visible | (self) |
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration va... |
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration va... | def visible(self):
"""
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One o... | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
774,
4
] | [
788,
30
] | python | en | ['en', 'error', 'th'] | False |
Parcats.__init__ | (
self,
arg=None,
arrangement=None,
bundlecolors=None,
counts=None,
countssrc=None,
dimensions=None,
dimensiondefaults=None,
domain=None,
hoverinfo=None,
hoveron=None,
hovertemplate=None,
labelfont=None,
line... |
Construct a new Parcats object
Parallel categories diagram for multidimensional categorical
data.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Parcats`
... |
Construct a new Parcats object
Parallel categories diagram for multidimensional categorical
data. | def __init__(
self,
arg=None,
arrangement=None,
bundlecolors=None,
counts=None,
countssrc=None,
dimensions=None,
dimensiondefaults=None,
domain=None,
hoverinfo=None,
hoveron=None,
hovertemplate=None,
labelfont=None,
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"arrangement",
"=",
"None",
",",
"bundlecolors",
"=",
"None",
",",
"counts",
"=",
"None",
",",
"countssrc",
"=",
"None",
",",
"dimensions",
"=",
"None",
",",
"dimensiondefaults",
"=",
"None",
... | [
933,
4
] | [
1227,
34
] | python | en | ['en', 'error', 'th'] | False |
Font.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Font.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
prefer... | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Font.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
Sets the default hover label font used by all traces on the
graph.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.h... |
Construct a new Font object
Sets the default hover label font used by all traces on the
graph. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
Sets the default hover label font used by all traces on the
graph.
Parameters
----------
arg
dict of properties compatible with this c... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",... | [
143,
4
] | [
227,
34
] | python | en | ['en', 'error', 'th'] | False |
precook | (s, n=4, out=False) |
Takes a string as input and returns an object that can be given to
either cook_refs or cook_test. This is optional: cook_refs and cook_test
can take string arguments as well.
:param s: string : sentence to be converted into ngrams
:param n: int : number of ngrams for which representation is calc... |
Takes a string as input and returns an object that can be given to
either cook_refs or cook_test. This is optional: cook_refs and cook_test
can take string arguments as well.
:param s: string : sentence to be converted into ngrams
:param n: int : number of ngrams for which representation is calc... | def precook(s, n=4, out=False):
"""
Takes a string as input and returns an object that can be given to
either cook_refs or cook_test. This is optional: cook_refs and cook_test
can take string arguments as well.
:param s: string : sentence to be converted into ngrams
:param n: int : number of ... | [
"def",
"precook",
"(",
"s",
",",
"n",
"=",
"4",
",",
"out",
"=",
"False",
")",
":",
"words",
"=",
"s",
".",
"split",
"(",
")",
"counts",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"k",
"in",
"range",
"(",
"1",
",",
"n",
"+",
"1",
")",
":",... | [
11,
0
] | [
26,
17
] | python | en | ['en', 'error', 'th'] | False |
cook_refs | (refs, n=4) | Takes a list of reference sentences for a single segment
and returns an object that encapsulates everything that BLEU
needs to know about them.
:param refs: list of string : reference sentences for some image
:param n: int : number of ngrams for which (ngram) representation is calculated
:return: re... | Takes a list of reference sentences for a single segment
and returns an object that encapsulates everything that BLEU
needs to know about them.
:param refs: list of string : reference sentences for some image
:param n: int : number of ngrams for which (ngram) representation is calculated
:return: re... | def cook_refs(refs, n=4): ## lhuang: oracle will call with "average"
"""Takes a list of reference sentences for a single segment
and returns an object that encapsulates everything that BLEU
needs to know about them.
:param refs: list of string : reference sentences for some image
:param n: int : nu... | [
"def",
"cook_refs",
"(",
"refs",
",",
"n",
"=",
"4",
")",
":",
"## lhuang: oracle will call with \"average\"",
"return",
"[",
"precook",
"(",
"ref",
",",
"n",
")",
"for",
"ref",
"in",
"refs",
"]"
] | [
29,
0
] | [
37,
44
] | python | en | ['en', 'en', 'en'] | True |
cook_test | (test, n=4) | Takes a test sentence and returns an object that
encapsulates everything that BLEU needs to know about it.
:param test: list of string : hypothesis sentence for some image
:param n: int : number of ngrams for which (ngram) representation is calculated
:return: result (dict)
| Takes a test sentence and returns an object that
encapsulates everything that BLEU needs to know about it.
:param test: list of string : hypothesis sentence for some image
:param n: int : number of ngrams for which (ngram) representation is calculated
:return: result (dict)
| def cook_test(test, n=4):
"""Takes a test sentence and returns an object that
encapsulates everything that BLEU needs to know about it.
:param test: list of string : hypothesis sentence for some image
:param n: int : number of ngrams for which (ngram) representation is calculated
:return: result (di... | [
"def",
"cook_test",
"(",
"test",
",",
"n",
"=",
"4",
")",
":",
"return",
"precook",
"(",
"test",
",",
"n",
",",
"True",
")"
] | [
40,
0
] | [
47,
33
] | python | en | ['en', 'en', 'en'] | True |
CiderScorer.copy | (self) | copy the refs. | copy the refs. | def copy(self):
""" copy the refs."""
new = CiderScorer(n=self.n)
new.ctest = copy.copy(self.ctest)
new.crefs = copy.copy(self.crefs)
return new | [
"def",
"copy",
"(",
"self",
")",
":",
"new",
"=",
"CiderScorer",
"(",
"n",
"=",
"self",
".",
"n",
")",
"new",
".",
"ctest",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"ctest",
")",
"new",
".",
"crefs",
"=",
"copy",
".",
"copy",
"(",
"self",
... | [
53,
4
] | [
58,
18
] | python | en | ['en', 'it', 'en'] | True |
CiderScorer.__init__ | (self, test=None, refs=None, n=4, sigma=6.0) | singular instance | singular instance | def __init__(self, test=None, refs=None, n=4, sigma=6.0):
""" singular instance """
self.n = n
self.sigma = sigma
self.crefs = []
self.ctest = []
self.document_frequency = defaultdict(float)
self.cook_append(test, refs)
self.ref_len = None | [
"def",
"__init__",
"(",
"self",
",",
"test",
"=",
"None",
",",
"refs",
"=",
"None",
",",
"n",
"=",
"4",
",",
"sigma",
"=",
"6.0",
")",
":",
"self",
".",
"n",
"=",
"n",
"self",
".",
"sigma",
"=",
"sigma",
"self",
".",
"crefs",
"=",
"[",
"]",
... | [
60,
4
] | [
68,
27
] | python | en | ['en', 'de', 'en'] | False |
CiderScorer.cook_append | (self, test, refs) | called by constructor and __iadd__ to avoid creating new instances. | called by constructor and __iadd__ to avoid creating new instances. | def cook_append(self, test, refs):
"""called by constructor and __iadd__ to avoid creating new instances."""
if refs is not None:
self.crefs.append(cook_refs(refs))
if test is not None:
self.ctest.append(cook_test(test)) ## N.B.: -1
else:
... | [
"def",
"cook_append",
"(",
"self",
",",
"test",
",",
"refs",
")",
":",
"if",
"refs",
"is",
"not",
"None",
":",
"self",
".",
"crefs",
".",
"append",
"(",
"cook_refs",
"(",
"refs",
")",
")",
"if",
"test",
"is",
"not",
"None",
":",
"self",
".",
"cte... | [
70,
4
] | [
78,
39
] | python | en | ['en', 'en', 'en'] | True |
CiderScorer.__iadd__ | (self, other) | add an instance (e.g., from another sentence). | add an instance (e.g., from another sentence). | def __iadd__(self, other):
"""add an instance (e.g., from another sentence)."""
if type(other) is tuple:
## avoid creating new CiderScorer instances
self.cook_append(other[0], other[1])
else:
self.ctest.extend(other.ctest)
self.crefs.extend(other.... | [
"def",
"__iadd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"type",
"(",
"other",
")",
"is",
"tuple",
":",
"## avoid creating new CiderScorer instances",
"self",
".",
"cook_append",
"(",
"other",
"[",
"0",
"]",
",",
"other",
"[",
"1",
"]",
")",
"else",... | [
87,
4
] | [
97,
19
] | python | en | ['en', 'en', 'en'] | True |
CiderScorer.compute_doc_freq | (self) |
Compute term frequency for reference data.
This will be used to compute idf (inverse document frequency later)
The term frequency is stored in the object
:return: None
|
Compute term frequency for reference data.
This will be used to compute idf (inverse document frequency later)
The term frequency is stored in the object
:return: None
| def compute_doc_freq(self):
"""
Compute term frequency for reference data.
This will be used to compute idf (inverse document frequency later)
The term frequency is stored in the object
:return: None
"""
for refs in self.crefs:
# refs, k ref captions o... | [
"def",
"compute_doc_freq",
"(",
"self",
")",
":",
"for",
"refs",
"in",
"self",
".",
"crefs",
":",
"# refs, k ref captions of one image",
"for",
"ngram",
"in",
"set",
"(",
"[",
"ngram",
"for",
"ref",
"in",
"refs",
"for",
"(",
"ngram",
",",
"count",
")",
"... | [
99,
4
] | [
109,
51
] | python | en | ['en', 'error', 'th'] | False |
grid_subsampling | (points, features=None, labels=None, sampleDl=0.1, verbose=0) |
CPP wrapper for a grid subsampling (method = barycenter for points and features)
:param points: (N, 3) matrix of input points
:param features: optional (N, d) matrix of features (floating number)
:param labels: optional (N,) matrix of integer labels
:param sampleDl: parameter defining the size of g... |
CPP wrapper for a grid subsampling (method = barycenter for points and features)
:param points: (N, 3) matrix of input points
:param features: optional (N, d) matrix of features (floating number)
:param labels: optional (N,) matrix of integer labels
:param sampleDl: parameter defining the size of g... | def grid_subsampling(points, features=None, labels=None, sampleDl=0.1, verbose=0):
"""
CPP wrapper for a grid subsampling (method = barycenter for points and features)
:param points: (N, 3) matrix of input points
:param features: optional (N, d) matrix of features (floating number)
:param labels: op... | [
"def",
"grid_subsampling",
"(",
"points",
",",
"features",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"sampleDl",
"=",
"0.1",
",",
"verbose",
"=",
"0",
")",
":",
"if",
"(",
"features",
"is",
"None",
")",
"and",
"(",
"labels",
"is",
"None",
")",
... | [
42,
0
] | [
72,
57
] | python | en | ['en', 'error', 'th'] | False |
batch_grid_subsampling | (points, batches_len, features=None, labels=None,
sampleDl=0.1, max_p=0, verbose=0, random_grid_orient=True) |
CPP wrapper for a grid subsampling (method = barycenter for points and features)
:param points: (N, 3) matrix of input points
:param features: optional (N, d) matrix of features (floating number)
:param labels: optional (N,) matrix of integer labels
:param sampleDl: parameter defining the size of g... |
CPP wrapper for a grid subsampling (method = barycenter for points and features)
:param points: (N, 3) matrix of input points
:param features: optional (N, d) matrix of features (floating number)
:param labels: optional (N,) matrix of integer labels
:param sampleDl: parameter defining the size of g... | def batch_grid_subsampling(points, batches_len, features=None, labels=None,
sampleDl=0.1, max_p=0, verbose=0, random_grid_orient=True):
"""
CPP wrapper for a grid subsampling (method = barycenter for points and features)
:param points: (N, 3) matrix of input points
:param feat... | [
"def",
"batch_grid_subsampling",
"(",
"points",
",",
"batches_len",
",",
"features",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"sampleDl",
"=",
"0.1",
",",
"max_p",
"=",
"0",
",",
"verbose",
"=",
"0",
",",
"random_grid_orient",
"=",
"True",
")",
":",... | [
75,
0
] | [
180,
52
] | python | en | ['en', 'error', 'th'] | False |
batch_neighbors | (queries, supports, q_batches, s_batches, radius) |
Computes neighbors for a batch of queries and supports
:param queries: (N1, 3) the query points
:param supports: (N2, 3) the support points
:param q_batches: (B) the list of lengths of batch elements in queries
:param s_batches: (B)the list of lengths of batch elements in supports
:param radius... |
Computes neighbors for a batch of queries and supports
:param queries: (N1, 3) the query points
:param supports: (N2, 3) the support points
:param q_batches: (B) the list of lengths of batch elements in queries
:param s_batches: (B)the list of lengths of batch elements in supports
:param radius... | def batch_neighbors(queries, supports, q_batches, s_batches, radius):
"""
Computes neighbors for a batch of queries and supports
:param queries: (N1, 3) the query points
:param supports: (N2, 3) the support points
:param q_batches: (B) the list of lengths of batch elements in queries
:param s_ba... | [
"def",
"batch_neighbors",
"(",
"queries",
",",
"supports",
",",
"q_batches",
",",
"s_batches",
",",
"radius",
")",
":",
"return",
"cpp_neighbors",
".",
"batch_query",
"(",
"queries",
",",
"supports",
",",
"q_batches",
",",
"s_batches",
",",
"radius",
"=",
"r... | [
183,
0
] | [
194,
92
] | python | en | ['en', 'error', 'th'] | False |
PointCloudDataset.__init__ | (self, name) |
Initialize parameters of the dataset here.
|
Initialize parameters of the dataset here.
| def __init__(self, name):
"""
Initialize parameters of the dataset here.
"""
self.name = name
self.path = ''
self.label_to_names = {}
self.num_classes = 0
self.label_values = np.zeros((0,), dtype=np.int32)
self.label_names = []
self.label_... | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"path",
"=",
"''",
"self",
".",
"label_to_names",
"=",
"{",
"}",
"self",
".",
"num_classes",
"=",
"0",
"self",
".",
"label_values",
"=",
"np",
"."... | [
206,
4
] | [
222,
14
] | python | en | ['en', 'error', 'th'] | False |
PointCloudDataset.__len__ | (self) |
Return the length of data here
|
Return the length of data here
| def __len__(self):
"""
Return the length of data here
"""
return 0 | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"0"
] | [
224,
4
] | [
228,
16
] | python | en | ['en', 'error', 'th'] | False |
PointCloudDataset.__getitem__ | (self, idx) |
Return the item at the given index
|
Return the item at the given index
| def __getitem__(self, idx):
"""
Return the item at the given index
"""
return 0 | [
"def",
"__getitem__",
"(",
"self",
",",
"idx",
")",
":",
"return",
"0"
] | [
230,
4
] | [
235,
16
] | python | en | ['en', 'error', 'th'] | False |
PointCloudDataset.augmentation_transform | (self, points, normals=None, verbose=False) | Implementation of an augmentation transform for point clouds. | Implementation of an augmentation transform for point clouds. | def augmentation_transform(self, points, normals=None, verbose=False):
"""Implementation of an augmentation transform for point clouds."""
##########
# Rotation
##########
# Initialize rotation matrix
R = np.eye(points.shape[1])
if points.shape[1] == 3:
... | [
"def",
"augmentation_transform",
"(",
"self",
",",
"points",
",",
"normals",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"##########",
"# Rotation",
"##########",
"# Initialize rotation matrix",
"R",
"=",
"np",
".",
"eye",
"(",
"points",
".",
"shape",... | [
247,
4
] | [
329,
64
] | python | en | ['en', 'en', 'en'] | True |
PointCloudDataset.big_neighborhood_filter | (self, neighbors, layer) |
Filter neighborhoods with max number of neighbors. Limit is set to keep XX% of the neighborhoods untouched.
Limit is computed at initialization
|
Filter neighborhoods with max number of neighbors. Limit is set to keep XX% of the neighborhoods untouched.
Limit is computed at initialization
| def big_neighborhood_filter(self, neighbors, layer):
"""
Filter neighborhoods with max number of neighbors. Limit is set to keep XX% of the neighborhoods untouched.
Limit is computed at initialization
"""
# crop neighbors matrix
if len(self.neighborhood_limits) > 0:
... | [
"def",
"big_neighborhood_filter",
"(",
"self",
",",
"neighbors",
",",
"layer",
")",
":",
"# crop neighbors matrix",
"if",
"len",
"(",
"self",
".",
"neighborhood_limits",
")",
">",
"0",
":",
"return",
"neighbors",
"[",
":",
",",
":",
"self",
".",
"neighborhoo... | [
331,
4
] | [
341,
28
] | python | en | ['en', 'error', 'th'] | False |
pathmaker | (first_segment, *in_path_segments, rev=False) |
Normalizes input path or path fragments, replaces '\\\\' with '/' and combines fragments.
Parameters
----------
first_segment : str
first path segment, if it is 'cwd' gets replaced by 'os.getcwd()'
rev : bool, optional
If 'True' reverts path back to Windows default, by default None... |
Normalizes input path or path fragments, replaces '\\\\' with '/' and combines fragments. | def pathmaker(first_segment, *in_path_segments, rev=False):
"""
Normalizes input path or path fragments, replaces '\\\\' with '/' and combines fragments.
Parameters
----------
first_segment : str
first path segment, if it is 'cwd' gets replaced by 'os.getcwd()'
rev : bool, optional
... | [
"def",
"pathmaker",
"(",
"first_segment",
",",
"*",
"in_path_segments",
",",
"rev",
"=",
"False",
")",
":",
"_path",
"=",
"first_segment",
"_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_path",
",",
"*",
"in_path_segments",
")",
"if",
"rev",
"is",
... | [
94,
0
] | [
116,
60
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.