hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c191f54e8df3fd4c02d34aac2777bc96d9a810d2 | shepherdpp/qteasy | qteasy/history.py | [
"CC0-1.0"
] | Python | csv_to_hp | null | def csv_to_hp():
""" read a csv file and convert its data to a HistoryPanel
:return:
"""
raise NotImplementedError | read a csv file and convert its data to a HistoryPanel
:return:
| read a csv file and convert its data to a HistoryPanel | [
"read",
"a",
"csv",
"file",
"and",
"convert",
"its",
"data",
"to",
"a",
"HistoryPanel"
] | def csv_to_hp():
raise NotImplementedError | [
"def",
"csv_to_hp",
"(",
")",
":",
"raise",
"NotImplementedError"
] | read a csv file and convert its data to a HistoryPanel | [
"read",
"a",
"csv",
"file",
"and",
"convert",
"its",
"data",
"to",
"a",
"HistoryPanel"
] | [
"\"\"\" read a csv file and convert its data to a HistoryPanel\n\n :return:\n \"\"\""
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
c191f54e8df3fd4c02d34aac2777bc96d9a810d2 | shepherdpp/qteasy | qteasy/history.py | [
"CC0-1.0"
] | Python | hdf_to_hp | null | def hdf_to_hp():
""" read a hdf file and convert its data to a HistoryPanel
:return:
"""
raise NotImplementedError | read a hdf file and convert its data to a HistoryPanel
:return:
| read a hdf file and convert its data to a HistoryPanel | [
"read",
"a",
"hdf",
"file",
"and",
"convert",
"its",
"data",
"to",
"a",
"HistoryPanel"
] | def hdf_to_hp():
raise NotImplementedError | [
"def",
"hdf_to_hp",
"(",
")",
":",
"raise",
"NotImplementedError"
] | read a hdf file and convert its data to a HistoryPanel | [
"read",
"a",
"hdf",
"file",
"and",
"convert",
"its",
"data",
"to",
"a",
"HistoryPanel"
] | [
"\"\"\" read a hdf file and convert its data to a HistoryPanel\n\n :return:\n \"\"\""
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fb1eeb84ab109aaf28c8259643a8ed31d9d2a192 | shepherdpp/qteasy | qteasy/finance.py | [
"CC0-1.0"
] | Python | _calculate_fee | <not_specific> | def _calculate_fee(trade_values, fixed_fees, is_buying, bf, sf, br, sr, bm, sm, slp):
"""calculate the transaction fee given all parameters
"""
if fixed_fees: # 采用固定费用模式计算, 返回固定费用及滑点成本,返回的是费用而不是费率
if is_buying:
return bf + slp * trade_values ** 2
else:
return sf + s... | calculate the transaction fee given all parameters
| calculate the transaction fee given all parameters | [
"calculate",
"the",
"transaction",
"fee",
"given",
"all",
"parameters"
] | def _calculate_fee(trade_values, fixed_fees, is_buying, bf, sf, br, sr, bm, sm, slp):
if fixed_fees:
if is_buying:
return bf + slp * trade_values ** 2
else:
return sf + slp * trade_values ** 2
else:
if is_buying:
if bm == 0.:
return... | [
"def",
"_calculate_fee",
"(",
"trade_values",
",",
"fixed_fees",
",",
"is_buying",
",",
"bf",
",",
"sf",
",",
"br",
",",
"sr",
",",
"bm",
",",
"sm",
",",
"slp",
")",
":",
"if",
"fixed_fees",
":",
"if",
"is_buying",
":",
"return",
"bf",
"+",
"slp",
... | calculate the transaction fee given all parameters | [
"calculate",
"the",
"transaction",
"fee",
"given",
"all",
"parameters"
] | [
"\"\"\"calculate the transaction fee given all parameters\n\n \"\"\"",
"# 采用固定费用模式计算, 返回固定费用及滑点成本,返回的是费用而不是费率",
"# 采用固定费率模式计算",
"# 当trade_values中有0值时,将产生inf,且传递到caller后会导致问题,因此需要清零"
] | [
{
"param": "trade_values",
"type": null
},
{
"param": "fixed_fees",
"type": null
},
{
"param": "is_buying",
"type": null
},
{
"param": "bf",
"type": null
},
{
"param": "sf",
"type": null
},
{
"param": "br",
"type": null
},
{
"param": "sr",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "trade_values",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fixed_fees",
"type": null,
"docstring": null,
"docstr... |
d7e279b24d45237786f5447972d84d66ddcc5b5f | shepherdpp/qteasy | qteasy/operator.py | [
"CC0-1.0"
] | Python | ready | null | def ready(self):
""" assess if the operator is ready to generate
:return:
"""
raise NotImplementedError | assess if the operator is ready to generate
:return:
| assess if the operator is ready to generate | [
"assess",
"if",
"the",
"operator",
"is",
"ready",
"to",
"generate"
] | def ready(self):
raise NotImplementedError | [
"def",
"ready",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | assess if the operator is ready to generate | [
"assess",
"if",
"the",
"operator",
"is",
"ready",
"to",
"generate"
] | [
"\"\"\" assess if the operator is ready to generate\n\n :return:\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b5fed8122cc37bb057bb8480f1eb896cbb373499 | shepherdpp/qteasy | qteasy/space.py | [
"CC0-1.0"
] | Python | types | <not_specific> | def types(self):
"""List of types of axis of the space"""
if self.dim > 0:
types = [ax.axis_type for ax in self.axis]
return types
else:
return None | List of types of axis of the space | List of types of axis of the space | [
"List",
"of",
"types",
"of",
"axis",
"of",
"the",
"space"
] | def types(self):
if self.dim > 0:
types = [ax.axis_type for ax in self.axis]
return types
else:
return None | [
"def",
"types",
"(",
"self",
")",
":",
"if",
"self",
".",
"dim",
">",
"0",
":",
"types",
"=",
"[",
"ax",
".",
"axis_type",
"for",
"ax",
"in",
"self",
".",
"axis",
"]",
"return",
"types",
"else",
":",
"return",
"None"
] | List of types of axis of the space | [
"List",
"of",
"types",
"of",
"axis",
"of",
"the",
"space"
] | [
"\"\"\"List of types of axis of the space\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b5fed8122cc37bb057bb8480f1eb896cbb373499 | shepherdpp/qteasy | qteasy/space.py | [
"CC0-1.0"
] | Python | boes | <not_specific> | def boes(self):
"""List of bounds of axis of the space"""
if self.dim > 0:
boes = [ax.axis_boe for ax in self.axis]
return boes
else:
return None | List of bounds of axis of the space | List of bounds of axis of the space | [
"List",
"of",
"bounds",
"of",
"axis",
"of",
"the",
"space"
] | def boes(self):
if self.dim > 0:
boes = [ax.axis_boe for ax in self.axis]
return boes
else:
return None | [
"def",
"boes",
"(",
"self",
")",
":",
"if",
"self",
".",
"dim",
">",
"0",
":",
"boes",
"=",
"[",
"ax",
".",
"axis_boe",
"for",
"ax",
"in",
"self",
".",
"axis",
"]",
"return",
"boes",
"else",
":",
"return",
"None"
] | List of bounds of axis of the space | [
"List",
"of",
"bounds",
"of",
"axis",
"of",
"the",
"space"
] | [
"\"\"\"List of bounds of axis of the space\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
70896e94a95a7945c578c92437fa32bc85fc8530 | digs1998/Image-Classifier | predict.py | [
"Apache-2.0"
] | Python | process_image | <not_specific> | def process_image(image):
''' Scales, crops, and normalizes a PIL image for a PyTorch model,
returns an Numpy array
'''
im = Image.open (image) #loading image
width, height = im.size #original size
# smallest part: width or height should be kept not more than 256
img_pil = Image.open(im... | Scales, crops, and normalizes a PIL image for a PyTorch model,
returns an Numpy array
| Scales, crops, and normalizes a PIL image for a PyTorch model,
returns an Numpy array | [
"Scales",
"crops",
"and",
"normalizes",
"a",
"PIL",
"image",
"for",
"a",
"PyTorch",
"model",
"returns",
"an",
"Numpy",
"array"
] | def process_image(image):
im = Image.open (image)
width, height = im.size
img_pil = Image.open(image)
img_transforms = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],std=[0.... | [
"def",
"process_image",
"(",
"image",
")",
":",
"im",
"=",
"Image",
".",
"open",
"(",
"image",
")",
"width",
",",
"height",
"=",
"im",
".",
"size",
"img_pil",
"=",
"Image",
".",
"open",
"(",
"image",
")",
"img_transforms",
"=",
"transforms",
".",
"Co... | Scales, crops, and normalizes a PIL image for a PyTorch model,
returns an Numpy array | [
"Scales",
"crops",
"and",
"normalizes",
"a",
"PIL",
"image",
"for",
"a",
"PyTorch",
"model",
"returns",
"an",
"Numpy",
"array"
] | [
"''' Scales, crops, and normalizes a PIL image for a PyTorch model,\n returns an Numpy array\n '''",
"#loading image",
"#original size",
"# smallest part: width or height should be kept not more than 256"
] | [
{
"param": "image",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "image",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
70896e94a95a7945c578c92437fa32bc85fc8530 | digs1998/Image-Classifier | predict.py | [
"Apache-2.0"
] | Python | predict | <not_specific> | def predict(image_path, model, topkl, device):
''' Predict the class (or classes) of an image using a trained deep learning model.
'''
model.to(device)
model.eval()
img = process_image(image_path)
img = img.numpy()
img = torch.from_numpy(np.array([img])).float()
with torch.no_grad():
... | Predict the class (or classes) of an image using a trained deep learning model.
| Predict the class (or classes) of an image using a trained deep learning model. | [
"Predict",
"the",
"class",
"(",
"or",
"classes",
")",
"of",
"an",
"image",
"using",
"a",
"trained",
"deep",
"learning",
"model",
"."
] | def predict(image_path, model, topkl, device):
model.to(device)
model.eval()
img = process_image(image_path)
img = img.numpy()
img = torch.from_numpy(np.array([img])).float()
with torch.no_grad():
output = model.forward(img.device())
probability = torch.exp(output).data
return pr... | [
"def",
"predict",
"(",
"image_path",
",",
"model",
",",
"topkl",
",",
"device",
")",
":",
"model",
".",
"to",
"(",
"device",
")",
"model",
".",
"eval",
"(",
")",
"img",
"=",
"process_image",
"(",
"image_path",
")",
"img",
"=",
"img",
".",
"numpy",
... | Predict the class (or classes) of an image using a trained deep learning model. | [
"Predict",
"the",
"class",
"(",
"or",
"classes",
")",
"of",
"an",
"image",
"using",
"a",
"trained",
"deep",
"learning",
"model",
"."
] | [
"''' Predict the class (or classes) of an image using a trained deep learning model.\n '''"
] | [
{
"param": "image_path",
"type": null
},
{
"param": "model",
"type": null
},
{
"param": "topkl",
"type": null
},
{
"param": "device",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "image_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tok... |
9b67aa75fec79a12034867928f4af5335f4151bf | niazwazir/WAZIR_ESPCN1 | source/models.py | [
"MIT"
] | Python | _initialize_weights | null | def _initialize_weights(self):
""" Initialize weights
Private function to initialize weights. Executes once when ESPCN object is made.
:return: None
"""
for m in self.modules():
if isinstance(m, nn.Conv2d):
if m.in_channels == 32:
... | Initialize weights
Private function to initialize weights. Executes once when ESPCN object is made.
:return: None
| Initialize weights
Private function to initialize weights. Executes once when ESPCN object is made. | [
"Initialize",
"weights",
"Private",
"function",
"to",
"initialize",
"weights",
".",
"Executes",
"once",
"when",
"ESPCN",
"object",
"is",
"made",
"."
] | def _initialize_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
if m.in_channels == 32:
nn.init.normal_(m.weight.data, mean=0.0, std=0.001)
nn.init.zeros_(m.bias.data)
else:
nn.init.norma... | [
"def",
"_initialize_weights",
"(",
"self",
")",
":",
"for",
"m",
"in",
"self",
".",
"modules",
"(",
")",
":",
"if",
"isinstance",
"(",
"m",
",",
"nn",
".",
"Conv2d",
")",
":",
"if",
"m",
".",
"in_channels",
"==",
"32",
":",
"nn",
".",
"init",
"."... | Initialize weights
Private function to initialize weights. | [
"Initialize",
"weights",
"Private",
"function",
"to",
"initialize",
"weights",
"."
] | [
"\"\"\" Initialize weights\n\n Private function to initialize weights. Executes once when ESPCN object is made.\n\n :return: None\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
94ad1fd53ef54d7f2dda45fb49b7915f1c3f559c | niazwazir/WAZIR_ESPCN1 | source/utils.py | [
"MIT"
] | Python | printconfig | null | def printconfig(config_dict):
""" Print configuration dictionary to console
Configuration values in yaml file (default= config.yaml) passed as a dictionary and printed to the console for convenient inspection. Command line arg is (-pc, --print-config). Terminates execution after printing.
:param config_di... | Print configuration dictionary to console
Configuration values in yaml file (default= config.yaml) passed as a dictionary and printed to the console for convenient inspection. Command line arg is (-pc, --print-config). Terminates execution after printing.
:param config_dict: Nested dictionary of configuratio... | Print configuration dictionary to console
Configuration values in yaml file (default= config.yaml) passed as a dictionary and printed to the console for convenient inspection. Command line arg is (-pc, --print-config). Terminates execution after printing. | [
"Print",
"configuration",
"dictionary",
"to",
"console",
"Configuration",
"values",
"in",
"yaml",
"file",
"(",
"default",
"=",
"config",
".",
"yaml",
")",
"passed",
"as",
"a",
"dictionary",
"and",
"printed",
"to",
"the",
"console",
"for",
"convenient",
"inspec... | def printconfig(config_dict):
print('\nConfiguration parameters-\n')
for i in config_dict:
print(i,':')
for key in config_dict[i]:
print(' ',key, ':', config_dict[i][key])
print()
sys.exit() | [
"def",
"printconfig",
"(",
"config_dict",
")",
":",
"print",
"(",
"'\\nConfiguration parameters-\\n'",
")",
"for",
"i",
"in",
"config_dict",
":",
"print",
"(",
"i",
",",
"':'",
")",
"for",
"key",
"in",
"config_dict",
"[",
"i",
"]",
":",
"print",
"(",
"' ... | Print configuration dictionary to console
Configuration values in yaml file (default= config.yaml) passed as a dictionary and printed to the console for convenient inspection. | [
"Print",
"configuration",
"dictionary",
"to",
"console",
"Configuration",
"values",
"in",
"yaml",
"file",
"(",
"default",
"=",
"config",
".",
"yaml",
")",
"passed",
"as",
"a",
"dictionary",
"and",
"printed",
"to",
"the",
"console",
"for",
"convenient",
"inspec... | [
"\"\"\" Print configuration dictionary to console\n\n Configuration values in yaml file (default= config.yaml) passed as a dictionary and printed to the console for convenient inspection. Command line arg is (-pc, --print-config). Terminates execution after printing.\n\n :param config_dict: Nested dictionary ... | [
{
"param": "config_dict",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "config_dict",
"type": null,
"docstring": "Nested dictionary of configuration values for using ESPCN",
"docstring_to... |
94ad1fd53ef54d7f2dda45fb49b7915f1c3f559c | niazwazir/WAZIR_ESPCN1 | source/utils.py | [
"MIT"
] | Python | visualize_filters | null | def visualize_filters(dict_vis):
""" Visualize and save filters of all the convolutional layers
Plot filters of the conv layers using matplotlib. Weights are loaded, after which the function extracts the weights to 'model_weights'. Filters visuals are plotted for each layer and saved in data/visualize_filters.... | Visualize and save filters of all the convolutional layers
Plot filters of the conv layers using matplotlib. Weights are loaded, after which the function extracts the weights to 'model_weights'. Filters visuals are plotted for each layer and saved in data/visualize_filters. Command line arg is (-f, --filter-vis).... | Visualize and save filters of all the convolutional layers
Plot filters of the conv layers using matplotlib. Weights are loaded, after which the function extracts the weights to 'model_weights'. Filters visuals are plotted for each layer and saved in data/visualize_filters. Command line arg is (-f, --filter-vis). Termi... | [
"Visualize",
"and",
"save",
"filters",
"of",
"all",
"the",
"convolutional",
"layers",
"Plot",
"filters",
"of",
"the",
"conv",
"layers",
"using",
"matplotlib",
".",
"Weights",
"are",
"loaded",
"after",
"which",
"the",
"function",
"extracts",
"the",
"weights",
"... | def visualize_filters(dict_vis):
weights_file= dict_vis['weights file']
scale= dict_vis['scale']
device = torch.device('cpu')
model = ESPCN(scale_factor=scale)
state_dict = model.state_dict()
for n, p in torch.load(weights_file, map_location=lambda storage, loc: storage).items():
if n in... | [
"def",
"visualize_filters",
"(",
"dict_vis",
")",
":",
"weights_file",
"=",
"dict_vis",
"[",
"'weights file'",
"]",
"scale",
"=",
"dict_vis",
"[",
"'scale'",
"]",
"device",
"=",
"torch",
".",
"device",
"(",
"'cpu'",
")",
"model",
"=",
"ESPCN",
"(",
"scale_... | Visualize and save filters of all the convolutional layers
Plot filters of the conv layers using matplotlib. | [
"Visualize",
"and",
"save",
"filters",
"of",
"all",
"the",
"convolutional",
"layers",
"Plot",
"filters",
"of",
"the",
"conv",
"layers",
"using",
"matplotlib",
"."
] | [
"\"\"\" Visualize and save filters of all the convolutional layers\n\n Plot filters of the conv layers using matplotlib. Weights are loaded, after which the function extracts the weights to 'model_weights'. Filters visuals are plotted for each layer and saved in data/visualize_filters. Command line arg is (-f, -... | [
{
"param": "dict_vis",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dict_vis",
"type": null,
"docstring": "dictionary containing scale value and path to weights file",
"docstring_toke... |
94ad1fd53ef54d7f2dda45fb49b7915f1c3f559c | niazwazir/WAZIR_ESPCN1 | source/utils.py | [
"MIT"
] | Python | is_image_file | <not_specific> | def is_image_file(filename):
""" Check if file is an image
:param filename: file name string
:return: Boolean toggle
"""
return any(filename.endswith(extension) for extension in ['.bmp', '.png', '.jpg', '.jpeg', '.JPG', '.JPEG', '.PNG']) | Check if file is an image
:param filename: file name string
:return: Boolean toggle
| Check if file is an image | [
"Check",
"if",
"file",
"is",
"an",
"image"
] | def is_image_file(filename):
return any(filename.endswith(extension) for extension in ['.bmp', '.png', '.jpg', '.jpeg', '.JPG', '.JPEG', '.PNG']) | [
"def",
"is_image_file",
"(",
"filename",
")",
":",
"return",
"any",
"(",
"filename",
".",
"endswith",
"(",
"extension",
")",
"for",
"extension",
"in",
"[",
"'.bmp'",
",",
"'.png'",
",",
"'.jpg'",
",",
"'.jpeg'",
",",
"'.JPG'",
",",
"'.JPEG'",
",",
"'.PNG... | Check if file is an image | [
"Check",
"if",
"file",
"is",
"an",
"image"
] | [
"\"\"\" Check if file is an image\n :param filename: file name string\n :return: Boolean toggle\n\n \"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "file name string",
"docstring_tokens": [
"file",
"name",
... |
94ad1fd53ef54d7f2dda45fb49b7915f1c3f559c | niazwazir/WAZIR_ESPCN1 | source/utils.py | [
"MIT"
] | Python | is_video_file | <not_specific> | def is_video_file(filename):
""" Check if file is a video
:param filename: file name string
:return: Boolean toggle
"""
return any(filename.endswith(extension) for extension in ['.mp4', '.avi', '.mpg', '.mkv', '.wmv', '.flv']) | Check if file is a video
:param filename: file name string
:return: Boolean toggle
| Check if file is a video | [
"Check",
"if",
"file",
"is",
"a",
"video"
] | def is_video_file(filename):
return any(filename.endswith(extension) for extension in ['.mp4', '.avi', '.mpg', '.mkv', '.wmv', '.flv']) | [
"def",
"is_video_file",
"(",
"filename",
")",
":",
"return",
"any",
"(",
"filename",
".",
"endswith",
"(",
"extension",
")",
"for",
"extension",
"in",
"[",
"'.mp4'",
",",
"'.avi'",
",",
"'.mpg'",
",",
"'.mkv'",
",",
"'.wmv'",
",",
"'.flv'",
"]",
")"
] | Check if file is a video | [
"Check",
"if",
"file",
"is",
"a",
"video"
] | [
"\"\"\" Check if file is a video\n :param filename: file name string\n :return: Boolean toggle\n\n \"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": "file name string",
"docstring_tokens": [
"file",
"name",
... |
94ad1fd53ef54d7f2dda45fb49b7915f1c3f559c | niazwazir/WAZIR_ESPCN1 | source/utils.py | [
"MIT"
] | Python | convert_rgb_to_y | <not_specific> | def convert_rgb_to_y(img, dim_order='hwc'):
""" Get Y(CbCr) value from RGB image (standard conversion)
:param img: input image array in RGB form
:return: array of Y values
"""
if dim_order == 'hwc':
return 16. + (64.738 * img[..., 0] + 129.057 * img[..., 1] + 25.064 * img[..., 2]) / 256.
... | Get Y(CbCr) value from RGB image (standard conversion)
:param img: input image array in RGB form
:return: array of Y values
| Get Y(CbCr) value from RGB image (standard conversion) | [
"Get",
"Y",
"(",
"CbCr",
")",
"value",
"from",
"RGB",
"image",
"(",
"standard",
"conversion",
")"
] | def convert_rgb_to_y(img, dim_order='hwc'):
if dim_order == 'hwc':
return 16. + (64.738 * img[..., 0] + 129.057 * img[..., 1] + 25.064 * img[..., 2]) / 256.
else:
return 16. + (64.738 * img[0] + 129.057 * img[1] + 25.064 * img[2]) / 256. | [
"def",
"convert_rgb_to_y",
"(",
"img",
",",
"dim_order",
"=",
"'hwc'",
")",
":",
"if",
"dim_order",
"==",
"'hwc'",
":",
"return",
"16.",
"+",
"(",
"64.738",
"*",
"img",
"[",
"...",
",",
"0",
"]",
"+",
"129.057",
"*",
"img",
"[",
"...",
",",
"1",
... | Get Y(CbCr) value from RGB image (standard conversion) | [
"Get",
"Y",
"(",
"CbCr",
")",
"value",
"from",
"RGB",
"image",
"(",
"standard",
"conversion",
")"
] | [
"\"\"\" Get Y(CbCr) value from RGB image (standard conversion)\n\n :param img: input image array in RGB form\n :return: array of Y values\n\n \"\"\""
] | [
{
"param": "img",
"type": null
},
{
"param": "dim_order",
"type": null
}
] | {
"returns": [
{
"docstring": "array of Y values",
"docstring_tokens": [
"array",
"of",
"Y",
"values"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "img",
"type": null,
"docstring": "input image array in RGB f... |
94ad1fd53ef54d7f2dda45fb49b7915f1c3f559c | niazwazir/WAZIR_ESPCN1 | source/utils.py | [
"MIT"
] | Python | convert_rgb_to_ycbcr | <not_specific> | def convert_rgb_to_ycbcr(img, dim_order='hwc'):
""" Convert to YCbCr from RGB (standard conversion)
:param img: input image array in RGB form
:return: out image array in YCbCr form
"""
if dim_order == 'hwc':
y = 16. + (64.738 * img[..., 0] + 129.057 * img[..., 1] + 25.064 * img[..., 2]) /... | Convert to YCbCr from RGB (standard conversion)
:param img: input image array in RGB form
:return: out image array in YCbCr form
| Convert to YCbCr from RGB (standard conversion) | [
"Convert",
"to",
"YCbCr",
"from",
"RGB",
"(",
"standard",
"conversion",
")"
] | def convert_rgb_to_ycbcr(img, dim_order='hwc'):
if dim_order == 'hwc':
y = 16. + (64.738 * img[..., 0] + 129.057 * img[..., 1] + 25.064 * img[..., 2]) / 256.
cb = 128. + (-37.945 * img[..., 0] - 74.494 * img[..., 1] + 112.439 * img[..., 2]) / 256.
cr = 128. + (112.439 * img[..., 0] - 94.154 ... | [
"def",
"convert_rgb_to_ycbcr",
"(",
"img",
",",
"dim_order",
"=",
"'hwc'",
")",
":",
"if",
"dim_order",
"==",
"'hwc'",
":",
"y",
"=",
"16.",
"+",
"(",
"64.738",
"*",
"img",
"[",
"...",
",",
"0",
"]",
"+",
"129.057",
"*",
"img",
"[",
"...",
",",
"... | Convert to YCbCr from RGB (standard conversion) | [
"Convert",
"to",
"YCbCr",
"from",
"RGB",
"(",
"standard",
"conversion",
")"
] | [
"\"\"\" Convert to YCbCr from RGB (standard conversion)\n\n :param img: input image array in RGB form\n :return: out image array in YCbCr form\n\n \"\"\""
] | [
{
"param": "img",
"type": null
},
{
"param": "dim_order",
"type": null
}
] | {
"returns": [
{
"docstring": "out image array in YCbCr form",
"docstring_tokens": [
"out",
"image",
"array",
"in",
"YCbCr",
"form"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "img",
"type": null,
... |
94ad1fd53ef54d7f2dda45fb49b7915f1c3f559c | niazwazir/WAZIR_ESPCN1 | source/utils.py | [
"MIT"
] | Python | convert_ycbcr_to_rgb | <not_specific> | def convert_ycbcr_to_rgb(img, dim_order='hwc'):
""" Convert to RGB from YCbCr (standard conversion)
:param img: input image array in YCbCr form
:return: out image array in RGB form
"""
if dim_order == 'hwc':
r = 298.082 * img[..., 0] / 256. + 408.583 * img[..., 2] / 256. - 222.921
... | Convert to RGB from YCbCr (standard conversion)
:param img: input image array in YCbCr form
:return: out image array in RGB form
| Convert to RGB from YCbCr (standard conversion) | [
"Convert",
"to",
"RGB",
"from",
"YCbCr",
"(",
"standard",
"conversion",
")"
] | def convert_ycbcr_to_rgb(img, dim_order='hwc'):
if dim_order == 'hwc':
r = 298.082 * img[..., 0] / 256. + 408.583 * img[..., 2] / 256. - 222.921
g = 298.082 * img[..., 0] / 256. - 100.291 * img[..., 1] / 256. - 208.120 * img[..., 2] / 256. + 135.576
b = 298.082 * img[..., 0] / 256. + 516.412... | [
"def",
"convert_ycbcr_to_rgb",
"(",
"img",
",",
"dim_order",
"=",
"'hwc'",
")",
":",
"if",
"dim_order",
"==",
"'hwc'",
":",
"r",
"=",
"298.082",
"*",
"img",
"[",
"...",
",",
"0",
"]",
"/",
"256.",
"+",
"408.583",
"*",
"img",
"[",
"...",
",",
"2",
... | Convert to RGB from YCbCr (standard conversion) | [
"Convert",
"to",
"RGB",
"from",
"YCbCr",
"(",
"standard",
"conversion",
")"
] | [
"\"\"\" Convert to RGB from YCbCr (standard conversion)\n\n :param img: input image array in YCbCr form\n :return: out image array in RGB form\n\n \"\"\""
] | [
{
"param": "img",
"type": null
},
{
"param": "dim_order",
"type": null
}
] | {
"returns": [
{
"docstring": "out image array in RGB form",
"docstring_tokens": [
"out",
"image",
"array",
"in",
"RGB",
"form"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "img",
"type": null,
... |
54aad5b0cc56d922848d44fd25423760969646ba | niazwazir/WAZIR_ESPCN1 | source/test_video.py | [
"MIT"
] | Python | testing_video | null | def testing_video(dict_video, batch_mode, psnr_plot):
""" Process video(s) through ESPCN
This function processes a video (file mode), or videos (batch mode) through ESPCN. Videos are processed frame by frame. These are first downscaled to lower resolution images. These are upscaled and saved using both (a) Bic... | Process video(s) through ESPCN
This function processes a video (file mode), or videos (batch mode) through ESPCN. Videos are processed frame by frame. These are first downscaled to lower resolution images. These are upscaled and saved using both (a) Bicubic interpolation and (b) ESPCN. The former is used for comp... | Process video(s) through ESPCN
This function processes a video (file mode), or videos (batch mode) through ESPCN. Videos are processed frame by frame. These are first downscaled to lower resolution images. These are upscaled and saved using both (a) Bicubic interpolation and (b) ESPCN. The former is used for comparison... | [
"Process",
"video",
"(",
"s",
")",
"through",
"ESPCN",
"This",
"function",
"processes",
"a",
"video",
"(",
"file",
"mode",
")",
"or",
"videos",
"(",
"batch",
"mode",
")",
"through",
"ESPCN",
".",
"Videos",
"are",
"processed",
"frame",
"by",
"frame",
".",... | def testing_video(dict_video, batch_mode, psnr_plot):
weights_file= dict_video['weights file']
scale= dict_video['scale']
video_dir= dict_video['video dir']
video_file= dict_video['video file'] if not batch_mode else None
cudnn.benchmark = True
device = torch.device('cpu')
model = ES... | [
"def",
"testing_video",
"(",
"dict_video",
",",
"batch_mode",
",",
"psnr_plot",
")",
":",
"weights_file",
"=",
"dict_video",
"[",
"'weights file'",
"]",
"scale",
"=",
"dict_video",
"[",
"'scale'",
"]",
"video_dir",
"=",
"dict_video",
"[",
"'video dir'",
"]",
"... | Process video(s) through ESPCN
This function processes a video (file mode), or videos (batch mode) through ESPCN. | [
"Process",
"video",
"(",
"s",
")",
"through",
"ESPCN",
"This",
"function",
"processes",
"a",
"video",
"(",
"file",
"mode",
")",
"or",
"videos",
"(",
"batch",
"mode",
")",
"through",
"ESPCN",
"."
] | [
"\"\"\" Process video(s) through ESPCN\n\n This function processes a video (file mode), or videos (batch mode) through ESPCN. Videos are processed frame by frame. These are first downscaled to lower resolution images. These are upscaled and saved using both (a) Bicubic interpolation and (b) ESPCN. The former is ... | [
{
"param": "dict_video",
"type": null
},
{
"param": "batch_mode",
"type": null
},
{
"param": "psnr_plot",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dict_video",
"type": null,
"docstring": "dictionary for configuration values (scale, location of weights file...)",
... |
54937f14adbb4867ef81766e780ffcd1f7356edb | niazwazir/WAZIR_ESPCN1 | source/train.py | [
"MIT"
] | Python | training | null | def training(dict_train):
""" Train the model
Trains the model using training and eval datasets. Output directory contains all weights marked by epoch number. The weights corresponding to the smallest lost value are saved as 'best.pth'. The script displays a progressbar and psnr values for each epoch as its ru... | Train the model
Trains the model using training and eval datasets. Output directory contains all weights marked by epoch number. The weights corresponding to the smallest lost value are saved as 'best.pth'. The script displays a progressbar and psnr values for each epoch as its running.
:param dict_train: di... | Train the model
Trains the model using training and eval datasets. Output directory contains all weights marked by epoch number. The weights corresponding to the smallest lost value are saved as 'best.pth'. The script displays a progressbar and psnr values for each epoch as its running. | [
"Train",
"the",
"model",
"Trains",
"the",
"model",
"using",
"training",
"and",
"eval",
"datasets",
".",
"Output",
"directory",
"contains",
"all",
"weights",
"marked",
"by",
"epoch",
"number",
".",
"The",
"weights",
"corresponding",
"to",
"the",
"smallest",
"lo... | def training(dict_train):
train_file= dict_train['training file']
eval_file= dict_train['eval file']
outputs_dir= dict_train['output dir']
scale= dict_train['scale']
lr= float(dict_train['lr'])
batch_size= dict_train['batch size']
num_epochs= dict_train['number of epochs']
num_workers= d... | [
"def",
"training",
"(",
"dict_train",
")",
":",
"train_file",
"=",
"dict_train",
"[",
"'training file'",
"]",
"eval_file",
"=",
"dict_train",
"[",
"'eval file'",
"]",
"outputs_dir",
"=",
"dict_train",
"[",
"'output dir'",
"]",
"scale",
"=",
"dict_train",
"[",
... | Train the model
Trains the model using training and eval datasets. | [
"Train",
"the",
"model",
"Trains",
"the",
"model",
"using",
"training",
"and",
"eval",
"datasets",
"."
] | [
"\"\"\" Train the model\n\n Trains the model using training and eval datasets. Output directory contains all weights marked by epoch number. The weights corresponding to the smallest lost value are saved as 'best.pth'. The script displays a progressbar and psnr values for each epoch as its running.\n\n :param... | [
{
"param": "dict_train",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dict_train",
"type": null,
"docstring": "dictionary containing all configuration values for training",
"docstring_t... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | valid_gameweek | <not_specific> | def valid_gameweek(gameweek):
"""Returns True if the gameweek is valid.
:param gameweek: The gameweek.
:type gameweek: int or string
:raises ValueError: if gameweek is not a number between 1 and 38
"""
gameweek = int(gameweek)
if (gameweek < MIN_GAMEWEEK) or (gameweek > MAX_GAMEWEEK):
... | Returns True if the gameweek is valid.
:param gameweek: The gameweek.
:type gameweek: int or string
:raises ValueError: if gameweek is not a number between 1 and 38
| Returns True if the gameweek is valid. | [
"Returns",
"True",
"if",
"the",
"gameweek",
"is",
"valid",
"."
] | def valid_gameweek(gameweek):
gameweek = int(gameweek)
if (gameweek < MIN_GAMEWEEK) or (gameweek > MAX_GAMEWEEK):
raise ValueError(f"Gameweek must be a number between {MIN_GAMEWEEK} and {MAX_GAMEWEEK}.")
return True | [
"def",
"valid_gameweek",
"(",
"gameweek",
")",
":",
"gameweek",
"=",
"int",
"(",
"gameweek",
")",
"if",
"(",
"gameweek",
"<",
"MIN_GAMEWEEK",
")",
"or",
"(",
"gameweek",
">",
"MAX_GAMEWEEK",
")",
":",
"raise",
"ValueError",
"(",
"f\"Gameweek must be a number b... | Returns True if the gameweek is valid. | [
"Returns",
"True",
"if",
"the",
"gameweek",
"is",
"valid",
"."
] | [
"\"\"\"Returns True if the gameweek is valid.\n\n :param gameweek: The gameweek.\n :type gameweek: int or string\n :raises ValueError: if gameweek is not a number between 1 and 38\n \"\"\""
] | [
{
"param": "gameweek",
"type": null
}
] | {
"returns": [],
"raises": [
{
"docstring": "if gameweek is not a number between 1 and 38",
"docstring_tokens": [
"if",
"gameweek",
"is",
"not",
"a",
"number",
"between",
"1",
"and",
"38"
],
"type": "ValueErr... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _ids_to_lineup | <not_specific> | def _ids_to_lineup(player_ids, user_team):
"""Helper for converting list of player IDs to usable lineup.
:param player_ids: List of player IDS.
:type player_ids: list
:param user_team: The user's current team.
:type user_team: list
:return: A usable lineup.
:rtype: list
"""
return [... | Helper for converting list of player IDs to usable lineup.
:param player_ids: List of player IDS.
:type player_ids: list
:param user_team: The user's current team.
:type user_team: list
:return: A usable lineup.
:rtype: list
| Helper for converting list of player IDs to usable lineup. | [
"Helper",
"for",
"converting",
"list",
"of",
"player",
"IDs",
"to",
"usable",
"lineup",
"."
] | def _ids_to_lineup(player_ids, user_team):
return [next(player for player in user_team
if player["element"] == player_id)
for player_id in player_ids] | [
"def",
"_ids_to_lineup",
"(",
"player_ids",
",",
"user_team",
")",
":",
"return",
"[",
"next",
"(",
"player",
"for",
"player",
"in",
"user_team",
"if",
"player",
"[",
"\"element\"",
"]",
"==",
"player_id",
")",
"for",
"player_id",
"in",
"player_ids",
"]"
] | Helper for converting list of player IDs to usable lineup. | [
"Helper",
"for",
"converting",
"list",
"of",
"player",
"IDs",
"to",
"usable",
"lineup",
"."
] | [
"\"\"\"Helper for converting list of player IDs to usable lineup.\n\n :param player_ids: List of player IDS.\n :type player_ids: list\n :param user_team: The user's current team.\n :type user_team: list\n :return: A usable lineup.\n :rtype: list\n \"\"\""
] | [
{
"param": "player_ids",
"type": null
},
{
"param": "user_team",
"type": null
}
] | {
"returns": [
{
"docstring": "A usable lineup.",
"docstring_tokens": [
"A",
"usable",
"lineup",
"."
],
"type": "list"
}
],
"raises": [],
"params": [
{
"identifier": "player_ids",
"type": null,
"docstring": "List of player IDS... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _id_to_element_type | <not_specific> | def _id_to_element_type(player_id, players):
"""Helper for converting a player's ID to their respective element type:
1, 2, 3 or 4.
:param player_id: A player's ID.
:type player_id: int
:param players: List of all players in the Fantasy Premier League.
:type players: list
:return: The playe... | Helper for converting a player's ID to their respective element type:
1, 2, 3 or 4.
:param player_id: A player's ID.
:type player_id: int
:param players: List of all players in the Fantasy Premier League.
:type players: list
:return: The player's element type.
:rtype: int
| Helper for converting a player's ID to their respective element type:
1, 2, 3 or 4. | [
"Helper",
"for",
"converting",
"a",
"player",
"'",
"s",
"ID",
"to",
"their",
"respective",
"element",
"type",
":",
"1",
"2",
"3",
"or",
"4",
"."
] | def _id_to_element_type(player_id, players):
player = next(player for player in players
if player["id"] == player_id)
return player["element_type"] | [
"def",
"_id_to_element_type",
"(",
"player_id",
",",
"players",
")",
":",
"player",
"=",
"next",
"(",
"player",
"for",
"player",
"in",
"players",
"if",
"player",
"[",
"\"id\"",
"]",
"==",
"player_id",
")",
"return",
"player",
"[",
"\"element_type\"",
"]"
] | Helper for converting a player's ID to their respective element type:
1, 2, 3 or 4. | [
"Helper",
"for",
"converting",
"a",
"player",
"'",
"s",
"ID",
"to",
"their",
"respective",
"element",
"type",
":",
"1",
"2",
"3",
"or",
"4",
"."
] | [
"\"\"\"Helper for converting a player's ID to their respective element type:\n 1, 2, 3 or 4.\n\n :param player_id: A player's ID.\n :type player_id: int\n :param players: List of all players in the Fantasy Premier League.\n :type players: list\n :return: The player's element type.\n :rtype: int... | [
{
"param": "player_id",
"type": null
},
{
"param": "players",
"type": null
}
] | {
"returns": [
{
"docstring": "The player's element type.",
"docstring_tokens": [
"The",
"player",
"'",
"s",
"element",
"type",
"."
],
"type": "int"
}
],
"raises": [],
"params": [
{
"identifier": "player_id",
... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _set_element_type | null | def _set_element_type(lineup, players):
"""Helper for setting the players' element types.
:param lineup: The user's current lineup.
:type lineup: list
:param players: List of all players in the Fantasy Premier League.
:type players: list
"""
for player in lineup:
element_type = _id_... | Helper for setting the players' element types.
:param lineup: The user's current lineup.
:type lineup: list
:param players: List of all players in the Fantasy Premier League.
:type players: list
| Helper for setting the players' element types. | [
"Helper",
"for",
"setting",
"the",
"players",
"'",
"element",
"types",
"."
] | def _set_element_type(lineup, players):
for player in lineup:
element_type = _id_to_element_type(player["element"], players)
player["element_type"] = element_type | [
"def",
"_set_element_type",
"(",
"lineup",
",",
"players",
")",
":",
"for",
"player",
"in",
"lineup",
":",
"element_type",
"=",
"_id_to_element_type",
"(",
"player",
"[",
"\"element\"",
"]",
",",
"players",
")",
"player",
"[",
"\"element_type\"",
"]",
"=",
"... | Helper for setting the players' element types. | [
"Helper",
"for",
"setting",
"the",
"players",
"'",
"element",
"types",
"."
] | [
"\"\"\"Helper for setting the players' element types.\n\n :param lineup: The user's current lineup.\n :type lineup: list\n :param players: List of all players in the Fantasy Premier League.\n :type players: list\n \"\"\""
] | [
{
"param": "lineup",
"type": null
},
{
"param": "players",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lineup",
"type": null,
"docstring": "The user's current lineup.",
"docstring_tokens": [
"The",
"user",
"'",
"s",
"current",
"lineup",
"."
],
"default": null,
... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _set_captain | null | def _set_captain(lineup, captain, captain_type, player_ids):
"""Sets the given captain's captain_type to True.
:param lineup: List of players.
:type lineup: list
:param captain: ID of the captain.
:type captain: int or str
:param captain_type: The captain type: 'is_captain' or 'is_vice_captain'... | Sets the given captain's captain_type to True.
:param lineup: List of players.
:type lineup: list
:param captain: ID of the captain.
:type captain: int or str
:param captain_type: The captain type: 'is_captain' or 'is_vice_captain'.
:type captain_type: string
:param player_ids: List of the ... | Sets the given captain's captain_type to True. | [
"Sets",
"the",
"given",
"captain",
"'",
"s",
"captain_type",
"to",
"True",
"."
] | def _set_captain(lineup, captain, captain_type, player_ids):
if captain and captain not in player_ids:
raise ValueError(
"Cannot (vice) captain player who isn't in user's team.")
current_captain = next(player for player in lineup if player[captain_type])
chosen_captain = next(player for ... | [
"def",
"_set_captain",
"(",
"lineup",
",",
"captain",
",",
"captain_type",
",",
"player_ids",
")",
":",
"if",
"captain",
"and",
"captain",
"not",
"in",
"player_ids",
":",
"raise",
"ValueError",
"(",
"\"Cannot (vice) captain player who isn't in user's team.\"",
")",
... | Sets the given captain's captain_type to True. | [
"Sets",
"the",
"given",
"captain",
"'",
"s",
"captain_type",
"to",
"True",
"."
] | [
"\"\"\"Sets the given captain's captain_type to True.\n\n :param lineup: List of players.\n :type lineup: list\n :param captain: ID of the captain.\n :type captain: int or str\n :param captain_type: The captain type: 'is_captain' or 'is_vice_captain'.\n :type captain_type: string\n :param playe... | [
{
"param": "lineup",
"type": null
},
{
"param": "captain",
"type": null
},
{
"param": "captain_type",
"type": null
},
{
"param": "player_ids",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lineup",
"type": null,
"docstring": "List of players.",
"docstring_tokens": [
"List",
"of",
"players",
"."
],
"default": null,
"is_optional": null
},
{
"identifie... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _get_transfer_payload | <not_specific> | def _get_transfer_payload(
self, players_out, players_in, user_team, players, wildcard,
free_hit):
"""Returns the payload needed to make the desired transfers."""
event = 0
if (self.current_event):
event = self.current_event
payload = {
"co... | Returns the payload needed to make the desired transfers. | Returns the payload needed to make the desired transfers. | [
"Returns",
"the",
"payload",
"needed",
"to",
"make",
"the",
"desired",
"transfers",
"."
] | def _get_transfer_payload(
self, players_out, players_in, user_team, players, wildcard,
free_hit):
event = 0
if (self.current_event):
event = self.current_event
payload = {
"confirmed": False,
"entry": self.id,
"event": even... | [
"def",
"_get_transfer_payload",
"(",
"self",
",",
"players_out",
",",
"players_in",
",",
"user_team",
",",
"players",
",",
"wildcard",
",",
"free_hit",
")",
":",
"event",
"=",
"0",
"if",
"(",
"self",
".",
"current_event",
")",
":",
"event",
"=",
"self",
... | Returns the payload needed to make the desired transfers. | [
"Returns",
"the",
"payload",
"needed",
"to",
"make",
"the",
"desired",
"transfers",
"."
] | [
"\"\"\"Returns the payload needed to make the desired transfers.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "players_out",
"type": null
},
{
"param": "players_in",
"type": null
},
{
"param": "user_team",
"type": null
},
{
"param": "players",
"type": null
},
{
"param": "wildcard",
"type": null
},
{
"pa... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "players_out",
"type": null,
"docstring": null,
"docstring_tok... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | transfer | <not_specific> | async def transfer(self, players_out, players_in, max_hit=60,
wildcard=False, free_hit=False):
"""Transfers given players out and transfers given players in.
:param players_out: List of IDs of players who will be transferred out.
:type players_out: list
:param pla... | Transfers given players out and transfers given players in.
:param players_out: List of IDs of players who will be transferred out.
:type players_out: list
:param players_in: List of IDs of players who will be transferred in.
:type players_in: list
:param max_hit: Maximum hit th... | Transfers given players out and transfers given players in. | [
"Transfers",
"given",
"players",
"out",
"and",
"transfers",
"given",
"players",
"in",
"."
] | async def transfer(self, players_out, players_in, max_hit=60,
wildcard=False, free_hit=False):
if wildcard and free_hit:
raise Exception("Can only use 1 of wildcard and free hit.")
if not logged_in(self._session):
raise Exception("User must be logged in.")
... | [
"async",
"def",
"transfer",
"(",
"self",
",",
"players_out",
",",
"players_in",
",",
"max_hit",
"=",
"60",
",",
"wildcard",
"=",
"False",
",",
"free_hit",
"=",
"False",
")",
":",
"if",
"wildcard",
"and",
"free_hit",
":",
"raise",
"Exception",
"(",
"\"Can... | Transfers given players out and transfers given players in. | [
"Transfers",
"given",
"players",
"out",
"and",
"transfers",
"given",
"players",
"in",
"."
] | [
"\"\"\"Transfers given players out and transfers given players in.\n\n :param players_out: List of IDs of players who will be transferred out.\n :type players_out: list\n :param players_in: List of IDs of players who will be transferred in.\n :type players_in: list\n :param max_hi... | [
{
"param": "self",
"type": null
},
{
"param": "players_out",
"type": null
},
{
"param": "players_in",
"type": null
},
{
"param": "max_hit",
"type": null
},
{
"param": "wildcard",
"type": null
},
{
"param": "free_hit",
"type": null
}
] | {
"returns": [
{
"docstring": "Returns the response given by a succesful transfer.",
"docstring_tokens": [
"Returns",
"the",
"response",
"given",
"by",
"a",
"succesful",
"transfer",
"."
],
"type": "dict"
}
],
"... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _create_new_lineup | <not_specific> | async def _create_new_lineup(self, players_in, players_out, lineup):
"""Helper for creating the new lineup of players.
:param players_in: List of IDs of players who will be substituted in.
:type players_in: list
:param players_out: List of IDs of players who will be substituted out.
... | Helper for creating the new lineup of players.
:param players_in: List of IDs of players who will be substituted in.
:type players_in: list
:param players_out: List of IDs of players who will be substituted out.
:type players_out: list
:param lineup: List containing the user's c... | Helper for creating the new lineup of players. | [
"Helper",
"for",
"creating",
"the",
"new",
"lineup",
"of",
"players",
"."
] | async def _create_new_lineup(self, players_in, players_out, lineup):
players = await fetch(self._session, API_URLS["static"])
players = players["elements"]
_set_element_type(lineup, players)
subs_in = _ids_to_lineup(players_in, lineup)
subs_out = _ids_to_lineup(players_out, lineu... | [
"async",
"def",
"_create_new_lineup",
"(",
"self",
",",
"players_in",
",",
"players_out",
",",
"lineup",
")",
":",
"players",
"=",
"await",
"fetch",
"(",
"self",
".",
"_session",
",",
"API_URLS",
"[",
"\"static\"",
"]",
")",
"players",
"=",
"players",
"[",... | Helper for creating the new lineup of players. | [
"Helper",
"for",
"creating",
"the",
"new",
"lineup",
"of",
"players",
"."
] | [
"\"\"\"Helper for creating the new lineup of players.\n\n :param players_in: List of IDs of players who will be substituted in.\n :type players_in: list\n :param players_out: List of IDs of players who will be substituted out.\n :type players_out: list\n :param lineup: List contai... | [
{
"param": "self",
"type": null
},
{
"param": "players_in",
"type": null
},
{
"param": "players_out",
"type": null
},
{
"param": "lineup",
"type": null
}
] | {
"returns": [
{
"docstring": "Returns the new lineup.",
"docstring_tokens": [
"Returns",
"the",
"new",
"lineup",
"."
],
"type": "list"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": ... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _post_substitutions | null | async def _post_substitutions(self, lineup):
"""Helper for sending the POST requests with the new lineup.
:param lineup: The new lineup.
:type lineup: list
"""
# Get CSRF token and create payload + headers
payload = json.dumps({"chip": None, "picks": lineup})
hea... | Helper for sending the POST requests with the new lineup.
:param lineup: The new lineup.
:type lineup: list
| Helper for sending the POST requests with the new lineup. | [
"Helper",
"for",
"sending",
"the",
"POST",
"requests",
"with",
"the",
"new",
"lineup",
"."
] | async def _post_substitutions(self, lineup):
payload = json.dumps({"chip": None, "picks": lineup})
headers = get_headers("https://fantasy.premierleague.com/a/team/my")
await post(
self._session, API_URLS["user_team"].format(self.id) + "/",
payload=payload, headers=headers... | [
"async",
"def",
"_post_substitutions",
"(",
"self",
",",
"lineup",
")",
":",
"payload",
"=",
"json",
".",
"dumps",
"(",
"{",
"\"chip\"",
":",
"None",
",",
"\"picks\"",
":",
"lineup",
"}",
")",
"headers",
"=",
"get_headers",
"(",
"\"https://fantasy.premierlea... | Helper for sending the POST requests with the new lineup. | [
"Helper",
"for",
"sending",
"the",
"POST",
"requests",
"with",
"the",
"new",
"lineup",
"."
] | [
"\"\"\"Helper for sending the POST requests with the new lineup.\n\n :param lineup: The new lineup.\n :type lineup: list\n \"\"\"",
"# Get CSRF token and create payload + headers"
] | [
{
"param": "self",
"type": null
},
{
"param": "lineup",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lineup",
"type": null,
"docstring": "The new lineup.",
"docst... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | _captain_helper | null | async def _captain_helper(self, captain, captain_type):
"""Helper for setting the (vice) captain of the user's team."""
if not logged_in(self._session):
raise Exception("User must be logged in.")
user_team = await self.get_team()
team_ids = [player["element"] for player in u... | Helper for setting the (vice) captain of the user's team. | Helper for setting the (vice) captain of the user's team. | [
"Helper",
"for",
"setting",
"the",
"(",
"vice",
")",
"captain",
"of",
"the",
"user",
"'",
"s",
"team",
"."
] | async def _captain_helper(self, captain, captain_type):
if not logged_in(self._session):
raise Exception("User must be logged in.")
user_team = await self.get_team()
team_ids = [player["element"] for player in user_team]
_set_captain(user_team, captain, captain_type, team_ids... | [
"async",
"def",
"_captain_helper",
"(",
"self",
",",
"captain",
",",
"captain_type",
")",
":",
"if",
"not",
"logged_in",
"(",
"self",
".",
"_session",
")",
":",
"raise",
"Exception",
"(",
"\"User must be logged in.\"",
")",
"user_team",
"=",
"await",
"self",
... | Helper for setting the (vice) captain of the user's team. | [
"Helper",
"for",
"setting",
"the",
"(",
"vice",
")",
"captain",
"of",
"the",
"user",
"'",
"s",
"team",
"."
] | [
"\"\"\"Helper for setting the (vice) captain of the user's team.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "captain",
"type": null
},
{
"param": "captain_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "captain",
"type": null,
"docstring": null,
"docstring_tokens"... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | captain | null | async def captain(self, captain):
"""Set the captain of the user's team.
:param captain: ID of the captain.
:type captain: int
"""
await self._captain_helper(captain, is_c) | Set the captain of the user's team.
:param captain: ID of the captain.
:type captain: int
| Set the captain of the user's team. | [
"Set",
"the",
"captain",
"of",
"the",
"user",
"'",
"s",
"team",
"."
] | async def captain(self, captain):
await self._captain_helper(captain, is_c) | [
"async",
"def",
"captain",
"(",
"self",
",",
"captain",
")",
":",
"await",
"self",
".",
"_captain_helper",
"(",
"captain",
",",
"is_c",
")"
] | Set the captain of the user's team. | [
"Set",
"the",
"captain",
"of",
"the",
"user",
"'",
"s",
"team",
"."
] | [
"\"\"\"Set the captain of the user's team.\n\n :param captain: ID of the captain.\n :type captain: int\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "captain",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "captain",
"type": null,
"docstring": "ID of the captain.",
"d... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | vice_captain | null | async def vice_captain(self, vice_captain):
"""Set the vice captain of the user's team.
:param vice_captain: ID of the vice captain.
:type vice_captain: int
"""
await self._captain_helper(vice_captain, is_vc) | Set the vice captain of the user's team.
:param vice_captain: ID of the vice captain.
:type vice_captain: int
| Set the vice captain of the user's team. | [
"Set",
"the",
"vice",
"captain",
"of",
"the",
"user",
"'",
"s",
"team",
"."
] | async def vice_captain(self, vice_captain):
await self._captain_helper(vice_captain, is_vc) | [
"async",
"def",
"vice_captain",
"(",
"self",
",",
"vice_captain",
")",
":",
"await",
"self",
".",
"_captain_helper",
"(",
"vice_captain",
",",
"is_vc",
")"
] | Set the vice captain of the user's team. | [
"Set",
"the",
"vice",
"captain",
"of",
"the",
"user",
"'",
"s",
"team",
"."
] | [
"\"\"\"Set the vice captain of the user's team.\n\n :param vice_captain: ID of the vice captain.\n :type vice_captain: int\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "vice_captain",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vice_captain",
"type": null,
"docstring": "ID of the vice captain."... |
946ea1a54722767d8191a3ba4eb80633c8abad1a | ido222/fpl | fpl/models/user.py | [
"MIT"
] | Python | substitute | null | async def substitute(self, players_in, players_out, captain=None,
vice_captain=None):
"""Substitute players on the bench for players in the starting eleven.
Also allows the user to simultaneously set the new (vice) captain(s).
A maximum of 4 substitutes is set to force p... | Substitute players on the bench for players in the starting eleven.
Also allows the user to simultaneously set the new (vice) captain(s).
A maximum of 4 substitutes is set to force proper usage.
:param players_in: List of IDs of players who will be substituted in.
:type players_in: list... | Substitute players on the bench for players in the starting eleven.
Also allows the user to simultaneously set the new (vice) captain(s).
A maximum of 4 substitutes is set to force proper usage. | [
"Substitute",
"players",
"on",
"the",
"bench",
"for",
"players",
"in",
"the",
"starting",
"eleven",
".",
"Also",
"allows",
"the",
"user",
"to",
"simultaneously",
"set",
"the",
"new",
"(",
"vice",
")",
"captain",
"(",
"s",
")",
".",
"A",
"maximum",
"of",
... | async def substitute(self, players_in, players_out, captain=None,
vice_captain=None):
if not logged_in(self._session):
raise Exception("User must be logged in.")
if len(players_out) > 4 or len(players_in) > 4:
raise Exception("Can only substitute a maximu... | [
"async",
"def",
"substitute",
"(",
"self",
",",
"players_in",
",",
"players_out",
",",
"captain",
"=",
"None",
",",
"vice_captain",
"=",
"None",
")",
":",
"if",
"not",
"logged_in",
"(",
"self",
".",
"_session",
")",
":",
"raise",
"Exception",
"(",
"\"Use... | Substitute players on the bench for players in the starting eleven. | [
"Substitute",
"players",
"on",
"the",
"bench",
"for",
"players",
"in",
"the",
"starting",
"eleven",
"."
] | [
"\"\"\"Substitute players on the bench for players in the starting eleven.\n Also allows the user to simultaneously set the new (vice) captain(s).\n A maximum of 4 substitutes is set to force proper usage.\n\n :param players_in: List of IDs of players who will be substituted in.\n :type ... | [
{
"param": "self",
"type": null
},
{
"param": "players_in",
"type": null
},
{
"param": "players_out",
"type": null
},
{
"param": "captain",
"type": null
},
{
"param": "vice_captain",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "players_in",
"type": null,
"docstring": "List of IDs of players who... |
b873af6c401fb8df3cc7ef8c9b3956891642e663 | ido222/fpl | fpl/fpl.py | [
"MIT"
] | Python | login | null | async def login(self, email=None, password=None):
"""Returns a requests session with FPL login authentication.
:param string email: Email address for the user's Fantasy Premier
League account.
:param string password: Password for the user's Fantasy Premier League
account... | Returns a requests session with FPL login authentication.
:param string email: Email address for the user's Fantasy Premier
League account.
:param string password: Password for the user's Fantasy Premier League
account.
| Returns a requests session with FPL login authentication. | [
"Returns",
"a",
"requests",
"session",
"with",
"FPL",
"login",
"authentication",
"."
] | async def login(self, email=None, password=None):
if not email and not password:
email = os.getenv("FPL_EMAIL", None)
password = os.getenv("FPL_PASSWORD", None)
if not email or not password:
raise ValueError("Email and password must be set")
payload = {
... | [
"async",
"def",
"login",
"(",
"self",
",",
"email",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"not",
"email",
"and",
"not",
"password",
":",
"email",
"=",
"os",
".",
"getenv",
"(",
"\"FPL_EMAIL\"",
",",
"None",
")",
"password",
"=",
... | Returns a requests session with FPL login authentication. | [
"Returns",
"a",
"requests",
"session",
"with",
"FPL",
"login",
"authentication",
"."
] | [
"\"\"\"Returns a requests session with FPL login authentication.\n\n :param string email: Email address for the user's Fantasy Premier\n League account.\n :param string password: Password for the user's Fantasy Premier League\n account.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "email",
"type": null
},
{
"param": "password",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "email",
"type": null,
"docstring": "Email address for the user's Fa... |
b873af6c401fb8df3cc7ef8c9b3956891642e663 | ido222/fpl | fpl/fpl.py | [
"MIT"
] | Python | FDR | <not_specific> | async def FDR(self):
"""Creates a new Fixture Difficulty Ranking (FDR) based on the number
of points each team gives up to players in the Fantasy Premier League.
These numbers are also between 1.0 and 5.0 to give a similar ranking
system to the official FDR.
An example:
... | Creates a new Fixture Difficulty Ranking (FDR) based on the number
of points each team gives up to players in the Fantasy Premier League.
These numbers are also between 1.0 and 5.0 to give a similar ranking
system to the official FDR.
An example:
.. code-block:: javascript
... | Creates a new Fixture Difficulty Ranking (FDR) based on the number
of points each team gives up to players in the Fantasy Premier League.
These numbers are also between 1.0 and 5.0 to give a similar ranking
system to the official FDR.
An example.
code-block:: javascript
| [
"Creates",
"a",
"new",
"Fixture",
"Difficulty",
"Ranking",
"(",
"FDR",
")",
"based",
"on",
"the",
"number",
"of",
"points",
"each",
"team",
"gives",
"up",
"to",
"players",
"in",
"the",
"Fantasy",
"Premier",
"League",
".",
"These",
"numbers",
"are",
"also",... | async def FDR(self):
def average_points_against(points_against):
for team, positions in points_against.items():
for position in positions.values():
position["H"] = average(position["H"])
position["A"] = average(position["A"])
po... | [
"async",
"def",
"FDR",
"(",
"self",
")",
":",
"def",
"average_points_against",
"(",
"points_against",
")",
":",
"\"\"\"Returns a dict with the average points scored against all teams,\n per position and location.\n\n :param dict points_against: A dict containing the p... | Creates a new Fixture Difficulty Ranking (FDR) based on the number
of points each team gives up to players in the Fantasy Premier League. | [
"Creates",
"a",
"new",
"Fixture",
"Difficulty",
"Ranking",
"(",
"FDR",
")",
"based",
"on",
"the",
"number",
"of",
"points",
"each",
"team",
"gives",
"up",
"to",
"players",
"in",
"the",
"Fantasy",
"Premier",
"League",
"."
] | [
"\"\"\"Creates a new Fixture Difficulty Ranking (FDR) based on the number\n of points each team gives up to players in the Fantasy Premier League.\n These numbers are also between 1.0 and 5.0 to give a similar ranking\n system to the official FDR.\n\n An example:\n\n .. code-block... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "dict"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b873af6c401fb8df3cc7ef8c9b3956891642e663 | ido222/fpl | fpl/fpl.py | [
"MIT"
] | Python | average_points_against | <not_specific> | def average_points_against(points_against):
"""Returns a dict with the average points scored against all teams,
per position and location.
:param dict points_against: A dict containing the points scored
against each team in the Premier League.
:rtype: dic... | Returns a dict with the average points scored against all teams,
per position and location.
:param dict points_against: A dict containing the points scored
against each team in the Premier League.
:rtype: dict
| Returns a dict with the average points scored against all teams,
per position and location. | [
"Returns",
"a",
"dict",
"with",
"the",
"average",
"points",
"scored",
"against",
"all",
"teams",
"per",
"position",
"and",
"location",
"."
] | def average_points_against(points_against):
for team, positions in points_against.items():
for position in positions.values():
position["H"] = average(position["H"])
position["A"] = average(position["A"])
points_against[team] = position... | [
"def",
"average_points_against",
"(",
"points_against",
")",
":",
"for",
"team",
",",
"positions",
"in",
"points_against",
".",
"items",
"(",
")",
":",
"for",
"position",
"in",
"positions",
".",
"values",
"(",
")",
":",
"position",
"[",
"\"H\"",
"]",
"=",
... | Returns a dict with the average points scored against all teams,
per position and location. | [
"Returns",
"a",
"dict",
"with",
"the",
"average",
"points",
"scored",
"against",
"all",
"teams",
"per",
"position",
"and",
"location",
"."
] | [
"\"\"\"Returns a dict with the average points scored against all teams,\n per position and location.\n\n :param dict points_against: A dict containing the points scored\n against each team in the Premier League.\n :rtype: dict\n \"\"\""
] | [
{
"param": "points_against",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "dict"
}
],
"raises": [],
"params": [
{
"identifier": "points_against",
"type": null,
"docstring": "A dict containing the points scored\nagainst each team in the Premier Leag... |
b873af6c401fb8df3cc7ef8c9b3956891642e663 | ido222/fpl | fpl/fpl.py | [
"MIT"
] | Python | calculate_fdr | <not_specific> | def calculate_fdr(average_points, extrema):
"""Returns a dict containing the FDR for each team, which is
calculated by scaling the average points conceded per position
between 1.0 and 5.0 using the given extrema.
:param dict points_against: A dict containing the points s... | Returns a dict containing the FDR for each team, which is
calculated by scaling the average points conceded per position
between 1.0 and 5.0 using the given extrema.
:param dict points_against: A dict containing the points scored
against each team in the Premier Leag... | Returns a dict containing the FDR for each team, which is
calculated by scaling the average points conceded per position
between 1.0 and 5.0 using the given extrema. | [
"Returns",
"a",
"dict",
"containing",
"the",
"FDR",
"for",
"each",
"team",
"which",
"is",
"calculated",
"by",
"scaling",
"the",
"average",
"points",
"conceded",
"per",
"position",
"between",
"1",
".",
"0",
"and",
"5",
".",
"0",
"using",
"the",
"given",
"... | def calculate_fdr(average_points, extrema):
for team, positions in average_points.items():
for position, locations in positions.items():
min_h, max_h = extrema[position]["H"]
min_a, max_a = extrema[position]["A"]
fdr_h = scale(locat... | [
"def",
"calculate_fdr",
"(",
"average_points",
",",
"extrema",
")",
":",
"for",
"team",
",",
"positions",
"in",
"average_points",
".",
"items",
"(",
")",
":",
"for",
"position",
",",
"locations",
"in",
"positions",
".",
"items",
"(",
")",
":",
"min_h",
"... | Returns a dict containing the FDR for each team, which is
calculated by scaling the average points conceded per position
between 1.0 and 5.0 using the given extrema. | [
"Returns",
"a",
"dict",
"containing",
"the",
"FDR",
"for",
"each",
"team",
"which",
"is",
"calculated",
"by",
"scaling",
"the",
"average",
"points",
"conceded",
"per",
"position",
"between",
"1",
".",
"0",
"and",
"5",
".",
"0",
"using",
"the",
"given",
"... | [
"\"\"\"Returns a dict containing the FDR for each team, which is\n calculated by scaling the average points conceded per position\n between 1.0 and 5.0 using the given extrema.\n\n :param dict points_against: A dict containing the points scored\n against each team in ... | [
{
"param": "average_points",
"type": null
},
{
"param": "extrema",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "dict"
}
],
"raises": [],
"params": [
{
"identifier": "average_points",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_option... |
5a5822084f5070af0705b91923d95d7c243837f0 | karaposu/dlcourse_ai | assignments/assignment1/knn.py | [
"MIT"
] | Python | compute_distances_two_loops | <not_specific> | def compute_distances_two_loops(self, X):
'''
Computes L1 distance from every sample of X to every training sample
Uses simplest implementation with 2 Python loops
Arguments:
X, np array (num_test_samples, num_features) - samples to run
Returns:
dists, n... |
Computes L1 distance from every sample of X to every training sample
Uses simplest implementation with 2 Python loops
Arguments:
X, np array (num_test_samples, num_features) - samples to run
Returns:
dists, np array (num_test_samples, num_train_samples) - array... | Computes L1 distance from every sample of X to every training sample
Uses simplest implementation with 2 Python loops
X, np array (num_test_samples, num_features) - samples to run
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample | [
"Computes",
"L1",
"distance",
"from",
"every",
"sample",
"of",
"X",
"to",
"every",
"training",
"sample",
"Uses",
"simplest",
"implementation",
"with",
"2",
"Python",
"loops",
"X",
"np",
"array",
"(",
"num_test_samples",
"num_features",
")",
"-",
"samples",
"to... | def compute_distances_two_loops(self, X):
num_train = self.train_X.shape[0]
num_test = X.shape[0]
dists = np.zeros((num_test, num_train), np.float32)
for i_test in range(num_test):
for i_train in range(num_train):
dists[i_test,i_train]=np.sum(np.abs([ X[i_test... | [
"def",
"compute_distances_two_loops",
"(",
"self",
",",
"X",
")",
":",
"num_train",
"=",
"self",
".",
"train_X",
".",
"shape",
"[",
"0",
"]",
"num_test",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"dists",
"=",
"np",
".",
"zeros",
"(",
"(",
"num_test",
... | Computes L1 distance from every sample of X to every training sample
Uses simplest implementation with 2 Python loops | [
"Computes",
"L1",
"distance",
"from",
"every",
"sample",
"of",
"X",
"to",
"every",
"training",
"sample",
"Uses",
"simplest",
"implementation",
"with",
"2",
"Python",
"loops"
] | [
"'''\n Computes L1 distance from every sample of X to every training sample\n Uses simplest implementation with 2 Python loops\n\n Arguments:\n X, np array (num_test_samples, num_features) - samples to run\n \n Returns:\n dists, np array (num_test_samples, num_train_... | [
{
"param": "self",
"type": null
},
{
"param": "X",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
5a5822084f5070af0705b91923d95d7c243837f0 | karaposu/dlcourse_ai | assignments/assignment1/knn.py | [
"MIT"
] | Python | compute_distances_one_loop | <not_specific> | def compute_distances_one_loop(self, X):
'''
Computes L1 distance from every sample of X to every training sample
Vectorizes some of the calculations, so only 1 loop is used
Arguments:
X, np array (num_test_samples, num_features) - samples to run
Returns:
... |
Computes L1 distance from every sample of X to every training sample
Vectorizes some of the calculations, so only 1 loop is used
Arguments:
X, np array (num_test_samples, num_features) - samples to run
Returns:
dists, np array (num_test_samples, num_train_sampl... | Computes L1 distance from every sample of X to every training sample
Vectorizes some of the calculations, so only 1 loop is used
X, np array (num_test_samples, num_features) - samples to run
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample | [
"Computes",
"L1",
"distance",
"from",
"every",
"sample",
"of",
"X",
"to",
"every",
"training",
"sample",
"Vectorizes",
"some",
"of",
"the",
"calculations",
"so",
"only",
"1",
"loop",
"is",
"used",
"X",
"np",
"array",
"(",
"num_test_samples",
"num_features",
... | def compute_distances_one_loop(self, X):
num_train = self.train_X.shape[0]
num_test = X.shape[0]
dists = np.zeros((num_test, num_train), np.float32)
for i_test in range(num_test):
distance = np.abs(X[i_test] - self.train_X)
distance = distance.sum(axis=1).reshape(... | [
"def",
"compute_distances_one_loop",
"(",
"self",
",",
"X",
")",
":",
"num_train",
"=",
"self",
".",
"train_X",
".",
"shape",
"[",
"0",
"]",
"num_test",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"dists",
"=",
"np",
".",
"zeros",
"(",
"(",
"num_test",
... | Computes L1 distance from every sample of X to every training sample
Vectorizes some of the calculations, so only 1 loop is used | [
"Computes",
"L1",
"distance",
"from",
"every",
"sample",
"of",
"X",
"to",
"every",
"training",
"sample",
"Vectorizes",
"some",
"of",
"the",
"calculations",
"so",
"only",
"1",
"loop",
"is",
"used"
] | [
"'''\n Computes L1 distance from every sample of X to every training sample\n Vectorizes some of the calculations, so only 1 loop is used\n\n Arguments:\n X, np array (num_test_samples, num_features) - samples to run\n \n Returns:\n dists, np array (num_test_samples,... | [
{
"param": "self",
"type": null
},
{
"param": "X",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
5a5822084f5070af0705b91923d95d7c243837f0 | karaposu/dlcourse_ai | assignments/assignment1/knn.py | [
"MIT"
] | Python | compute_distances_no_loops | <not_specific> | def compute_distances_no_loops(self, X):
'''
Computes L1 distance from every sample of X to every training sample
Fully vectorizes the calculations using numpy
Arguments:
X, np array (num_test_samples, num_features) - samples to run
Returns:
dists, np ar... |
Computes L1 distance from every sample of X to every training sample
Fully vectorizes the calculations using numpy
Arguments:
X, np array (num_test_samples, num_features) - samples to run
Returns:
dists, np array (num_test_samples, num_train_samples) - array
... | Computes L1 distance from every sample of X to every training sample
Fully vectorizes the calculations using numpy
X, np array (num_test_samples, num_features) - samples to run
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample | [
"Computes",
"L1",
"distance",
"from",
"every",
"sample",
"of",
"X",
"to",
"every",
"training",
"sample",
"Fully",
"vectorizes",
"the",
"calculations",
"using",
"numpy",
"X",
"np",
"array",
"(",
"num_test_samples",
"num_features",
")",
"-",
"samples",
"to",
"ru... | def compute_distances_no_loops(self, X):
num_train = self.train_X.shape[0]
num_test = X.shape[0]
print("train_X.shape:",self.train_X.shape)
Using float32 to to save memory - the default is float64
dists = np.zeros((num_test, num_train), np.float32)
TODO: Implement comp... | [
"def",
"compute_distances_no_loops",
"(",
"self",
",",
"X",
")",
":",
"num_train",
"=",
"self",
".",
"train_X",
".",
"shape",
"[",
"0",
"]",
"num_test",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"'''\n num_train: 121\n num_test: 16\n X.shape: (16... | Computes L1 distance from every sample of X to every training sample
Fully vectorizes the calculations using numpy | [
"Computes",
"L1",
"distance",
"from",
"every",
"sample",
"of",
"X",
"to",
"every",
"training",
"sample",
"Fully",
"vectorizes",
"the",
"calculations",
"using",
"numpy"
] | [
"'''\n Computes L1 distance from every sample of X to every training sample\n Fully vectorizes the calculations using numpy\n\n Arguments:\n X, np array (num_test_samples, num_features) - samples to run\n \n Returns:\n dists, np array (num_test_samples, num_train_sam... | [
{
"param": "self",
"type": null
},
{
"param": "X",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
5a5822084f5070af0705b91923d95d7c243837f0 | karaposu/dlcourse_ai | assignments/assignment1/knn.py | [
"MIT"
] | Python | predict_labels_binary | <not_specific> | def predict_labels_binary(self, dists):
'''
Returns model predictions for binary classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample
Returns:
pred, np arra... |
Returns model predictions for binary classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample
Returns:
pred, np array of bool (num_test_samples) - binary predictions
... | Returns model predictions for binary classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample
pred, np array of bool (num_test_samples) - binary predictions
for every test sample | [
"Returns",
"model",
"predictions",
"for",
"binary",
"classification",
"case",
"Arguments",
":",
"dists",
"np",
"array",
"(",
"num_test_samples",
"num_train_samples",
")",
"-",
"array",
"with",
"distances",
"between",
"each",
"test",
"and",
"each",
"train",
"sample... | def predict_labels_binary(self, dists):
num_test = dists.shape[0]
pred = np.zeros(num_test, np.bool)
for i in range(num_test):
indexes_of_k_smallest_values= np.argpartition(dists[i], self.k)[:self.k]
filter_indices = indexes_of_k_smallest_values
axis = 0
... | [
"def",
"predict_labels_binary",
"(",
"self",
",",
"dists",
")",
":",
"num_test",
"=",
"dists",
".",
"shape",
"[",
"0",
"]",
"pred",
"=",
"np",
".",
"zeros",
"(",
"num_test",
",",
"np",
".",
"bool",
")",
"for",
"i",
"in",
"range",
"(",
"num_test",
"... | Returns model predictions for binary classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample | [
"Returns",
"model",
"predictions",
"for",
"binary",
"classification",
"case",
"Arguments",
":",
"dists",
"np",
"array",
"(",
"num_test_samples",
"num_train_samples",
")",
"-",
"array",
"with",
"distances",
"between",
"each",
"test",
"and",
"each",
"train",
"sample... | [
"'''\n Returns model predictions for binary classification case\n \n Arguments:\n dists, np array (num_test_samples, num_train_samples) - array\n with distances between each test and each train sample\n\n Returns:\n pred, np array of bool (num_test_samples) - bina... | [
{
"param": "self",
"type": null
},
{
"param": "dists",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dists",
"type": null,
"docstring": null,
"docstring_tokens": ... |
5a5822084f5070af0705b91923d95d7c243837f0 | karaposu/dlcourse_ai | assignments/assignment1/knn.py | [
"MIT"
] | Python | predict_labels_multiclass | <not_specific> | def predict_labels_multiclass(self, dists):
'''
Returns model predictions for multi-class classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample
Returns:
pred... |
Returns model predictions for multi-class classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample
Returns:
pred, np array of int (num_test_samples) - predicted class ... | Returns model predictions for multi-class classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample
pred, np array of int (num_test_samples) - predicted class index
for every test sample | [
"Returns",
"model",
"predictions",
"for",
"multi",
"-",
"class",
"classification",
"case",
"Arguments",
":",
"dists",
"np",
"array",
"(",
"num_test_samples",
"num_train_samples",
")",
"-",
"array",
"with",
"distances",
"between",
"each",
"test",
"and",
"each",
"... | def predict_labels_multiclass(self, dists):
num_test = dists.shape[0]
num_test = dists.shape[0]
pred = np.zeros(num_test, np.int)
for i in range(num_test):
indexes_of_k_smallest_values = np.argpartition(dists[i], self.k)[:self.k]
filter_indices = indexes_of_k_smal... | [
"def",
"predict_labels_multiclass",
"(",
"self",
",",
"dists",
")",
":",
"num_test",
"=",
"dists",
".",
"shape",
"[",
"0",
"]",
"num_test",
"=",
"dists",
".",
"shape",
"[",
"0",
"]",
"pred",
"=",
"np",
".",
"zeros",
"(",
"num_test",
",",
"np",
".",
... | Returns model predictions for multi-class classification case
Arguments:
dists, np array (num_test_samples, num_train_samples) - array
with distances between each test and each train sample | [
"Returns",
"model",
"predictions",
"for",
"multi",
"-",
"class",
"classification",
"case",
"Arguments",
":",
"dists",
"np",
"array",
"(",
"num_test_samples",
"num_train_samples",
")",
"-",
"array",
"with",
"distances",
"between",
"each",
"test",
"and",
"each",
"... | [
"'''\n Returns model predictions for multi-class classification case\n \n Arguments:\n dists, np array (num_test_samples, num_train_samples) - array\n with distances between each test and each train sample\n\n Returns:\n pred, np array of int (num_test_samples) - ... | [
{
"param": "self",
"type": null
},
{
"param": "dists",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dists",
"type": null,
"docstring": null,
"docstring_tokens": ... |
34ec6584dbe37b9e9fa39003d265ae473fd0a4e8 | karaposu/dlcourse_ai | assignments/assignment1/metrics.py | [
"MIT"
] | Python | multiclass_accuracy | <not_specific> | def multiclass_accuracy(prediction, ground_truth):
'''
Computes metrics for multiclass classification
Arguments:
prediction, np array of int (num_samples) - model predictions
ground_truth, np array of int (num_samples) - true labels
Returns:
accuracy - ratio of accurate predictions to tota... |
Computes metrics for multiclass classification
Arguments:
prediction, np array of int (num_samples) - model predictions
ground_truth, np array of int (num_samples) - true labels
Returns:
accuracy - ratio of accurate predictions to total samples
| Computes metrics for multiclass classification
Arguments:
prediction, np array of int (num_samples) - model predictions
ground_truth, np array of int (num_samples) - true labels
ratio of accurate predictions to total samples | [
"Computes",
"metrics",
"for",
"multiclass",
"classification",
"Arguments",
":",
"prediction",
"np",
"array",
"of",
"int",
"(",
"num_samples",
")",
"-",
"model",
"predictions",
"ground_truth",
"np",
"array",
"of",
"int",
"(",
"num_samples",
")",
"-",
"true",
"l... | def multiclass_accuracy(prediction, ground_truth):
accuracy = 0
nTruePositives = 0
nFalsePositives = 0
for i in range(len(prediction)):
if prediction[i] == ground_truth[i]:
nTruePositives = nTruePositives + 1
else:
nFalsePositives = nFalsePositives + 1
accurac... | [
"def",
"multiclass_accuracy",
"(",
"prediction",
",",
"ground_truth",
")",
":",
"accuracy",
"=",
"0",
"nTruePositives",
"=",
"0",
"nFalsePositives",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"prediction",
")",
")",
":",
"if",
"prediction",
"[",... | Computes metrics for multiclass classification
Arguments:
prediction, np array of int (num_samples) - model predictions
ground_truth, np array of int (num_samples) - true labels | [
"Computes",
"metrics",
"for",
"multiclass",
"classification",
"Arguments",
":",
"prediction",
"np",
"array",
"of",
"int",
"(",
"num_samples",
")",
"-",
"model",
"predictions",
"ground_truth",
"np",
"array",
"of",
"int",
"(",
"num_samples",
")",
"-",
"true",
"l... | [
"'''\n Computes metrics for multiclass classification\n\n Arguments:\n prediction, np array of int (num_samples) - model predictions\n ground_truth, np array of int (num_samples) - true labels\n\n Returns:\n accuracy - ratio of accurate predictions to total samples\n '''"
] | [
{
"param": "prediction",
"type": null
},
{
"param": "ground_truth",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prediction",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ground_truth",
"type": null,
"docstring": null,
"docstr... |
9368e9c4103bf9d8869b9bd4ca782ac8a80aafb4 | Zxynine/fusion360-thomasa88lib | timeline.py | [
"MIT"
] | Python | flatten_timeline | <not_specific> | def flatten_timeline(timeline_collection):
'''
A flat timeline representation, with all objects except any group objects.
(Groups disappear when expanded - The icon is no longer there in the timeline.)
'''
flat_collection = []
for obj in timeline_collection:
if obj.isGroup:
... |
A flat timeline representation, with all objects except any group objects.
(Groups disappear when expanded - The icon is no longer there in the timeline.)
| A flat timeline representation, with all objects except any group objects.
(Groups disappear when expanded - The icon is no longer there in the timeline.) | [
"A",
"flat",
"timeline",
"representation",
"with",
"all",
"objects",
"except",
"any",
"group",
"objects",
".",
"(",
"Groups",
"disappear",
"when",
"expanded",
"-",
"The",
"icon",
"is",
"no",
"longer",
"there",
"in",
"the",
"timeline",
".",
")"
] | def flatten_timeline(timeline_collection):
flat_collection = []
for obj in timeline_collection:
if obj.isGroup:
flat_collection += flatten_timeline(obj)
else:
flat_collection.append(obj)
return flat_collection | [
"def",
"flatten_timeline",
"(",
"timeline_collection",
")",
":",
"flat_collection",
"=",
"[",
"]",
"for",
"obj",
"in",
"timeline_collection",
":",
"if",
"obj",
".",
"isGroup",
":",
"flat_collection",
"+=",
"flatten_timeline",
"(",
"obj",
")",
"else",
":",
"fla... | A flat timeline representation, with all objects except any group objects. | [
"A",
"flat",
"timeline",
"representation",
"with",
"all",
"objects",
"except",
"any",
"group",
"objects",
"."
] | [
"'''\n A flat timeline representation, with all objects except any group objects.\n (Groups disappear when expanded - The icon is no longer there in the timeline.)\n '''",
"# Groups only appear in the timeline if they are collapsed",
"# In that case, the features inside the group are only listed within... | [
{
"param": "timeline_collection",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "timeline_collection",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DEBUG | <not_specific> | def LF_DEBUG(c):
"""
This label function is for debugging purposes. Feel free to ignore.
keyword arguments:
c - The candidate object to be labeled
"""
print(c)
print()
print("Left Tokens")
print(list(get_left_tokens(c[0], window=5)))
print()
print("Right Tokens")
print(li... |
This label function is for debugging purposes. Feel free to ignore.
keyword arguments:
c - The candidate object to be labeled
| This label function is for debugging purposes. Feel free to ignore.
keyword arguments:
c - The candidate object to be labeled | [
"This",
"label",
"function",
"is",
"for",
"debugging",
"purposes",
".",
"Feel",
"free",
"to",
"ignore",
".",
"keyword",
"arguments",
":",
"c",
"-",
"The",
"candidate",
"object",
"to",
"be",
"labeled"
] | def LF_DEBUG(c):
print(c)
print()
print("Left Tokens")
print(list(get_left_tokens(c[0], window=5)))
print()
print("Right Tokens")
print(list(get_right_tokens(c[0])))
print()
print("Between Tokens")
print(list(get_between_tokens(c)))
print()
print("Tagged Text")
print... | [
"def",
"LF_DEBUG",
"(",
"c",
")",
":",
"print",
"(",
"c",
")",
"print",
"(",
")",
"print",
"(",
"\"Left Tokens\"",
")",
"print",
"(",
"list",
"(",
"get_left_tokens",
"(",
"c",
"[",
"0",
"]",
",",
"window",
"=",
"5",
")",
")",
")",
"print",
"(",
... | This label function is for debugging purposes. | [
"This",
"label",
"function",
"is",
"for",
"debugging",
"purposes",
"."
] | [
"\"\"\"\n This label function is for debugging purposes. Feel free to ignore.\n keyword arguments:\n c - The candidate object to be labeled\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_DISEASES | <not_specific> | def LF_HETNET_DISEASES(c):
"""
This label function returns 1 if the given Disease Gene pair is
located in the Diseases database
"""
return 1 if (c.Gene_cid, c.Disease_cid, "DISEASES") in knowledge_base else 0 |
This label function returns 1 if the given Disease Gene pair is
located in the Diseases database
| This label function returns 1 if the given Disease Gene pair is
located in the Diseases database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"Diseases",
"database"
] | def LF_HETNET_DISEASES(c):
return 1 if (c.Gene_cid, c.Disease_cid, "DISEASES") in knowledge_base else 0 | [
"def",
"LF_HETNET_DISEASES",
"(",
"c",
")",
":",
"return",
"1",
"if",
"(",
"c",
".",
"Gene_cid",
",",
"c",
".",
"Disease_cid",
",",
"\"DISEASES\"",
")",
"in",
"knowledge_base",
"else",
"0"
] | This label function returns 1 if the given Disease Gene pair is
located in the Diseases database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"Diseases",
"database"
] | [
"\"\"\"\n This label function returns 1 if the given Disease Gene pair is\n located in the Diseases database\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_DOAF | <not_specific> | def LF_HETNET_DOAF(c):
"""
This label function returns 1 if the given Disease Gene pair is
located in the DOAF database
"""
return 1 if (c.Gene_cid, c.Disease_cid, "DOAF") in knowledge_base else 0 |
This label function returns 1 if the given Disease Gene pair is
located in the DOAF database
| This label function returns 1 if the given Disease Gene pair is
located in the DOAF database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"DOAF",
"database"
] | def LF_HETNET_DOAF(c):
return 1 if (c.Gene_cid, c.Disease_cid, "DOAF") in knowledge_base else 0 | [
"def",
"LF_HETNET_DOAF",
"(",
"c",
")",
":",
"return",
"1",
"if",
"(",
"c",
".",
"Gene_cid",
",",
"c",
".",
"Disease_cid",
",",
"\"DOAF\"",
")",
"in",
"knowledge_base",
"else",
"0"
] | This label function returns 1 if the given Disease Gene pair is
located in the DOAF database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"DOAF",
"database"
] | [
"\"\"\"\n This label function returns 1 if the given Disease Gene pair is\n located in the DOAF database\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_DisGeNET | <not_specific> | def LF_HETNET_DisGeNET(c):
"""
This label function returns 1 if the given Disease Gene pair is
located in the DisGeNET database
"""
return 1 if (c.Gene_cid, c.Disease_cid, "DisGeNET") in knowledge_base else 0 |
This label function returns 1 if the given Disease Gene pair is
located in the DisGeNET database
| This label function returns 1 if the given Disease Gene pair is
located in the DisGeNET database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"DisGeNET",
"database"
] | def LF_HETNET_DisGeNET(c):
return 1 if (c.Gene_cid, c.Disease_cid, "DisGeNET") in knowledge_base else 0 | [
"def",
"LF_HETNET_DisGeNET",
"(",
"c",
")",
":",
"return",
"1",
"if",
"(",
"c",
".",
"Gene_cid",
",",
"c",
".",
"Disease_cid",
",",
"\"DisGeNET\"",
")",
"in",
"knowledge_base",
"else",
"0"
] | This label function returns 1 if the given Disease Gene pair is
located in the DisGeNET database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"DisGeNET",
"database"
] | [
"\"\"\"\n This label function returns 1 if the given Disease Gene pair is\n located in the DisGeNET database\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_GWAS | <not_specific> | def LF_HETNET_GWAS(c):
"""
This label function returns 1 if the given Disease Gene pair is
located in the GWAS database
"""
return 1 if (c.Gene_cid, c.Disease_cid, "GWAS Catalog") in knowledge_base else 0 |
This label function returns 1 if the given Disease Gene pair is
located in the GWAS database
| This label function returns 1 if the given Disease Gene pair is
located in the GWAS database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"GWAS",
"database"
] | def LF_HETNET_GWAS(c):
return 1 if (c.Gene_cid, c.Disease_cid, "GWAS Catalog") in knowledge_base else 0 | [
"def",
"LF_HETNET_GWAS",
"(",
"c",
")",
":",
"return",
"1",
"if",
"(",
"c",
".",
"Gene_cid",
",",
"c",
".",
"Disease_cid",
",",
"\"GWAS Catalog\"",
")",
"in",
"knowledge_base",
"else",
"0"
] | This label function returns 1 if the given Disease Gene pair is
located in the GWAS database | [
"This",
"label",
"function",
"returns",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"is",
"located",
"in",
"the",
"GWAS",
"database"
] | [
"\"\"\"\n This label function returns 1 if the given Disease Gene pair is\n located in the GWAS database\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_DaG_ABSENT | <not_specific> | def LF_HETNET_DaG_ABSENT(c):
"""
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
"""
return 0 if any([
LF_HETNET_DISEASES(c),
LF_HETNET_DOAF(c),
LF_HETNET_DisGeNET(c),
LF_HETNET_GWAS(c)
]) else -1 |
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
| This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | def LF_HETNET_DaG_ABSENT(c):
return 0 if any([
LF_HETNET_DISEASES(c),
LF_HETNET_DOAF(c),
LF_HETNET_DisGeNET(c),
LF_HETNET_GWAS(c)
]) else -1 | [
"def",
"LF_HETNET_DaG_ABSENT",
"(",
"c",
")",
":",
"return",
"0",
"if",
"any",
"(",
"[",
"LF_HETNET_DISEASES",
"(",
"c",
")",
",",
"LF_HETNET_DOAF",
"(",
"c",
")",
",",
"LF_HETNET_DisGeNET",
"(",
"c",
")",
",",
"LF_HETNET_GWAS",
"(",
"c",
")",
"]",
")"... | This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | [
"\"\"\"\n This label function fires -1 if the given Disease Gene pair does not appear \n in the databases above.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_DuG_ABSENT | <not_specific> | def LF_HETNET_DuG_ABSENT(c):
"""
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
"""
return 0 if LF_HETNET_STARGEO_UP(c) else -1 |
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
| This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | def LF_HETNET_DuG_ABSENT(c):
return 0 if LF_HETNET_STARGEO_UP(c) else -1 | [
"def",
"LF_HETNET_DuG_ABSENT",
"(",
"c",
")",
":",
"return",
"0",
"if",
"LF_HETNET_STARGEO_UP",
"(",
"c",
")",
"else",
"-",
"1"
] | This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | [
"\"\"\"\n This label function fires -1 if the given Disease Gene pair does not appear \n in the databases above.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_DdG_ABSENT | <not_specific> | def LF_HETNET_DdG_ABSENT(c):
"""
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
"""
return 0 if LF_HETNET_STARGEO_DOWN(c) else -1 |
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
| This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | def LF_HETNET_DdG_ABSENT(c):
return 0 if LF_HETNET_STARGEO_DOWN(c) else -1 | [
"def",
"LF_HETNET_DdG_ABSENT",
"(",
"c",
")",
":",
"return",
"0",
"if",
"LF_HETNET_STARGEO_DOWN",
"(",
"c",
")",
"else",
"-",
"1"
] | This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | [
"\"\"\"\n This label function fires -1 if the given Disease Gene pair does not appear \n in the databases above.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_CHECK_GENE_TAG | <not_specific> | def LF_DG_CHECK_GENE_TAG(c):
"""
This label function is used for labeling each passed candidate as either pos or neg.
Keyword Args:
c- the candidate object to be passed in.
"""
sen = c[1].get_parent()
gene_name = re.sub("\)", "", c[1].get_span().lower())
gene_id = sen.entity_cids[c[1].ge... |
This label function is used for labeling each passed candidate as either pos or neg.
Keyword Args:
c- the candidate object to be passed in.
| This label function is used for labeling each passed candidate as either pos or neg.
Keyword Args:
c- the candidate object to be passed in. | [
"This",
"label",
"function",
"is",
"used",
"for",
"labeling",
"each",
"passed",
"candidate",
"as",
"either",
"pos",
"or",
"neg",
".",
"Keyword",
"Args",
":",
"c",
"-",
"the",
"candidate",
"object",
"to",
"be",
"passed",
"in",
"."
] | def LF_DG_CHECK_GENE_TAG(c):
sen = c[1].get_parent()
gene_name = re.sub("\)", "", c[1].get_span().lower())
gene_id = sen.entity_cids[c[1].get_word_start()]
gene_entry_df = gene_desc.query("GeneID == @gene_id")
if gene_entry_df.empty:
return -1
for token in gene_name.split(" "):
i... | [
"def",
"LF_DG_CHECK_GENE_TAG",
"(",
"c",
")",
":",
"sen",
"=",
"c",
"[",
"1",
"]",
".",
"get_parent",
"(",
")",
"gene_name",
"=",
"re",
".",
"sub",
"(",
"\"\\)\"",
",",
"\"\"",
",",
"c",
"[",
"1",
"]",
".",
"get_span",
"(",
")",
".",
"lower",
"... | This label function is used for labeling each passed candidate as either pos or neg. | [
"This",
"label",
"function",
"is",
"used",
"for",
"labeling",
"each",
"passed",
"candidate",
"as",
"either",
"pos",
"or",
"neg",
"."
] | [
"\"\"\"\n This label function is used for labeling each passed candidate as either pos or neg.\n Keyword Args:\n c- the candidate object to be passed in.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_CHECK_DISEASE_TAG | <not_specific> | def LF_DG_CHECK_DISEASE_TAG(c):
"""
This label function is used for labeling each passed candidate as either pos or neg.
Keyword Args:
c- the candidate object to be passed in.
"""
sen = c[0].get_parent()
disease_name = re.sub("\) ?", "", c[0].get_span())
disease_name = re.sub(r"(\w)-(\w)... |
This label function is used for labeling each passed candidate as either pos or neg.
Keyword Args:
c- the candidate object to be passed in.
| This label function is used for labeling each passed candidate as either pos or neg.
Keyword Args:
c- the candidate object to be passed in. | [
"This",
"label",
"function",
"is",
"used",
"for",
"labeling",
"each",
"passed",
"candidate",
"as",
"either",
"pos",
"or",
"neg",
".",
"Keyword",
"Args",
":",
"c",
"-",
"the",
"candidate",
"object",
"to",
"be",
"passed",
"in",
"."
] | def LF_DG_CHECK_DISEASE_TAG(c):
sen = c[0].get_parent()
disease_name = re.sub("\) ?", "", c[0].get_span())
disease_name = re.sub(r"(\w)-(\w)", r"\g<1> \g<2>", disease_name)
disease_name = " ".join([word for word in word_tokenize(disease_name) if word not in set(stop_word_list)])
if len(disease_name)... | [
"def",
"LF_DG_CHECK_DISEASE_TAG",
"(",
"c",
")",
":",
"sen",
"=",
"c",
"[",
"0",
"]",
".",
"get_parent",
"(",
")",
"disease_name",
"=",
"re",
".",
"sub",
"(",
"\"\\) ?\"",
",",
"\"\"",
",",
"c",
"[",
"0",
"]",
".",
"get_span",
"(",
")",
")",
"dis... | This label function is used for labeling each passed candidate as either pos or neg. | [
"This",
"label",
"function",
"is",
"used",
"for",
"labeling",
"each",
"passed",
"candidate",
"as",
"either",
"pos",
"or",
"neg",
"."
] | [
"\"\"\"\n This label function is used for labeling each passed candidate as either pos or neg.\n Keyword Args:\n c- the candidate object to be passed in.\n \"\"\"",
"# If abbreviation skip since no means of easy resolution",
"# If no match then return -1",
"# check the reverse direction e.g. carci... | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_IS_BIOMARKER | <not_specific> | def LF_DG_IS_BIOMARKER(c):
"""
This label function examines a sentences to determine of a sentence
is talking about a biomarker. (A biomarker leads towards D-G assocation
c - The candidate obejct being passed in
"""
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
elif re.search(l... |
This label function examines a sentences to determine of a sentence
is talking about a biomarker. (A biomarker leads towards D-G assocation
c - The candidate obejct being passed in
| This label function examines a sentences to determine of a sentence
is talking about a biomarker. (A biomarker leads towards D-G assocation
c - The candidate obejct being passed in | [
"This",
"label",
"function",
"examines",
"a",
"sentences",
"to",
"determine",
"of",
"a",
"sentence",
"is",
"talking",
"about",
"a",
"biomarker",
".",
"(",
"A",
"biomarker",
"leads",
"towards",
"D",
"-",
"G",
"assocation",
"c",
"-",
"The",
"candidate",
"obe... | def LF_DG_IS_BIOMARKER(c):
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
elif re.search(ltp(biomarker_indicators), " ".join(get_left_tokens(c[1], window=10)), flags=re.I):
return 1
elif re.search(ltp(biomarker_indicators), " ".join(get_right_tokens(c[1], window=10)), flags=re.I):
... | [
"def",
"LF_DG_IS_BIOMARKER",
"(",
"c",
")",
":",
"if",
"LF_DG_METHOD_DESC",
"(",
"c",
")",
"or",
"LF_DG_TITLE",
"(",
"c",
")",
":",
"return",
"0",
"elif",
"re",
".",
"search",
"(",
"ltp",
"(",
"biomarker_indicators",
")",
",",
"\" \"",
".",
"join",
"("... | This label function examines a sentences to determine of a sentence
is talking about a biomarker. | [
"This",
"label",
"function",
"examines",
"a",
"sentences",
"to",
"determine",
"of",
"a",
"sentence",
"is",
"talking",
"about",
"a",
"biomarker",
"."
] | [
"\"\"\"\n This label function examines a sentences to determine of a sentence\n is talking about a biomarker. (A biomarker leads towards D-G assocation\n c - The candidate obejct being passed in\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DaG_ASSOCIATION | <not_specific> | def LF_DaG_ASSOCIATION(c):
"""
This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association.
"""
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + "... |
This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association.
| This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"an",
"association",
"."
] | def LF_DaG_ASSOCIATION(c):
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + " ".join(get_right_tokens(c[1], window=10))
found_negation = not re.search(r'\b(not|no)\b', left_window, flags=re.I)
... | [
"def",
"LF_DaG_ASSOCIATION",
"(",
"c",
")",
":",
"left_window",
"=",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"0",
"]",
",",
"window",
"=",
"10",
")",
")",
"+",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"1",
"... | This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"an",
"association",
"."
] | [
"\"\"\"\n This LF is designed to test if there is a key phrase that suggests\n a d-g pair is an association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DaG_WEAK_ASSOCIATION | <not_specific> | def LF_DaG_WEAK_ASSOCIATION(c):
"""
This label function is design to search for phrases that indicate a
weak association between the disease and gene
"""
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_token... |
This label function is design to search for phrases that indicate a
weak association between the disease and gene
| This label function is design to search for phrases that indicate a
weak association between the disease and gene | [
"This",
"label",
"function",
"is",
"design",
"to",
"search",
"for",
"phrases",
"that",
"indicate",
"a",
"weak",
"association",
"between",
"the",
"disease",
"and",
"gene"
] | def LF_DaG_WEAK_ASSOCIATION(c):
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + " ".join(get_right_tokens(c[1], window=10))
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
elif ... | [
"def",
"LF_DaG_WEAK_ASSOCIATION",
"(",
"c",
")",
":",
"left_window",
"=",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"0",
"]",
",",
"window",
"=",
"10",
")",
")",
"+",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"1"... | This label function is design to search for phrases that indicate a
weak association between the disease and gene | [
"This",
"label",
"function",
"is",
"design",
"to",
"search",
"for",
"phrases",
"that",
"indicate",
"a",
"weak",
"association",
"between",
"the",
"disease",
"and",
"gene"
] | [
"\"\"\"\n This label function is design to search for phrases that indicate a \n weak association between the disease and gene\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DaG_NO_ASSOCIATION | <not_specific> | def LF_DaG_NO_ASSOCIATION(c):
"""
This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association.
"""
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10... |
This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association.
| This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"no",
"an",
"association",
"."
] | def LF_DaG_NO_ASSOCIATION(c):
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + " ".join(get_right_tokens(c[1], window=10))
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
elif re... | [
"def",
"LF_DaG_NO_ASSOCIATION",
"(",
"c",
")",
":",
"left_window",
"=",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"0",
"]",
",",
"window",
"=",
"10",
")",
")",
"+",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"1",
... | This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"no",
"an",
"association",
"."
] | [
"\"\"\"\n This LF is designed to test if there is a key phrase that suggests\n a d-g pair is no an association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DaG_CELLULAR_ACTIVITY | <not_specific> | def LF_DaG_CELLULAR_ACTIVITY(c):
"""
This LF is designed to look for key phrases that indicate activity within a cell.
e.x. positive immunostating for an experiment
"""
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(g... |
This LF is designed to look for key phrases that indicate activity within a cell.
e.x. positive immunostating for an experiment
| This LF is designed to look for key phrases that indicate activity within a cell. | [
"This",
"LF",
"is",
"designed",
"to",
"look",
"for",
"key",
"phrases",
"that",
"indicate",
"activity",
"within",
"a",
"cell",
"."
] | def LF_DaG_CELLULAR_ACTIVITY(c):
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + " ".join(get_right_tokens(c[1], window=10))
if re.search(ltp(cellular_activity), get_tagged_text(c), flags=re.I)... | [
"def",
"LF_DaG_CELLULAR_ACTIVITY",
"(",
"c",
")",
":",
"left_window",
"=",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"0",
"]",
",",
"window",
"=",
"10",
")",
")",
"+",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"1... | This LF is designed to look for key phrases that indicate activity within a cell. | [
"This",
"LF",
"is",
"designed",
"to",
"look",
"for",
"key",
"phrases",
"that",
"indicate",
"activity",
"within",
"a",
"cell",
"."
] | [
"\"\"\"\n This LF is designed to look for key phrases that indicate activity within a cell.\n e.x. positive immunostating for an experiment\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DaG_DISEASE_SAMPLE | <not_specific> | def LF_DaG_DISEASE_SAMPLE(c):
"""
This LF is designed to look for key phrases that indicate a sentence talking about tissue samples
ex. cell line etc
"""
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens... |
This LF is designed to look for key phrases that indicate a sentence talking about tissue samples
ex. cell line etc
| This LF is designed to look for key phrases that indicate a sentence talking about tissue samples
ex. cell line etc | [
"This",
"LF",
"is",
"designed",
"to",
"look",
"for",
"key",
"phrases",
"that",
"indicate",
"a",
"sentence",
"talking",
"about",
"tissue",
"samples",
"ex",
".",
"cell",
"line",
"etc"
] | def LF_DaG_DISEASE_SAMPLE(c):
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + " ".join(get_right_tokens(c[1], window=10))
if re.search(ltp(disease_sample_indicators), left_window, flags=re.I):
... | [
"def",
"LF_DaG_DISEASE_SAMPLE",
"(",
"c",
")",
":",
"left_window",
"=",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"0",
"]",
",",
"window",
"=",
"10",
")",
")",
"+",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"1",
... | This LF is designed to look for key phrases that indicate a sentence talking about tissue samples
ex. | [
"This",
"LF",
"is",
"designed",
"to",
"look",
"for",
"key",
"phrases",
"that",
"indicate",
"a",
"sentence",
"talking",
"about",
"tissue",
"samples",
"ex",
"."
] | [
"\"\"\"\n This LF is designed to look for key phrases that indicate a sentence talking about tissue samples\n ex. cell line etc\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_METHOD_DESC | <not_specific> | def LF_DG_METHOD_DESC(c):
"""
This label function is designed to look for phrases
that imply a sentence is description an experimental design
"""
sentence_tokens = " ".join(c.get_parent().words[0:20])
if re.search(ltp(method_indication), sentence_tokens, flags=re.I):
return -1
elif ... |
This label function is designed to look for phrases
that imply a sentence is description an experimental design
| This label function is designed to look for phrases
that imply a sentence is description an experimental design | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"imply",
"a",
"sentence",
"is",
"description",
"an",
"experimental",
"design"
] | def LF_DG_METHOD_DESC(c):
sentence_tokens = " ".join(c.get_parent().words[0:20])
if re.search(ltp(method_indication), sentence_tokens, flags=re.I):
return -1
elif re.search(ltp(method_indication), " ".join(get_between_tokens(c)), flags=re.I):
return -1
else:
return 0 | [
"def",
"LF_DG_METHOD_DESC",
"(",
"c",
")",
":",
"sentence_tokens",
"=",
"\" \"",
".",
"join",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"words",
"[",
"0",
":",
"20",
"]",
")",
"if",
"re",
".",
"search",
"(",
"ltp",
"(",
"method_indication",
")",
... | This label function is designed to look for phrases
that imply a sentence is description an experimental design | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"imply",
"a",
"sentence",
"is",
"description",
"an",
"experimental",
"design"
] | [
"\"\"\"\n This label function is designed to look for phrases \n that imply a sentence is description an experimental design\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_TITLE | <not_specific> | def LF_DG_TITLE(c):
"""
This label function is designed to look for phrases that inditcates
a paper title
"""
if re.search(r'^(\[|\[ )?'+ltp(title_indication), get_tagged_text(c), flags=re.I):
return -1
elif re.search(ltp(title_indication)+r'$', get_tagged_text(c), flags=re.I):
r... |
This label function is designed to look for phrases that inditcates
a paper title
| This label function is designed to look for phrases that inditcates
a paper title | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"inditcates",
"a",
"paper",
"title"
] | def LF_DG_TITLE(c):
if re.search(r'^(\[|\[ )?'+ltp(title_indication), get_tagged_text(c), flags=re.I):
return -1
elif re.search(ltp(title_indication)+r'$', get_tagged_text(c), flags=re.I):
return -1
elif "(author's transl)" in get_tagged_text(c):
return -1
elif ":" in get_between... | [
"def",
"LF_DG_TITLE",
"(",
"c",
")",
":",
"if",
"re",
".",
"search",
"(",
"r'^(\\[|\\[ )?'",
"+",
"ltp",
"(",
"title_indication",
")",
",",
"get_tagged_text",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
":",
"return",
"-",
"1",
"elif",
"... | This label function is designed to look for phrases that inditcates
a paper title | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"inditcates",
"a",
"paper",
"title"
] | [
"\"\"\"\n This label function is designed to look for phrases that inditcates\n a paper title\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DuG_UPREGULATES | <not_specific> | def LF_DuG_UPREGULATES(c):
"""
This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association
"""
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
else:
if rule_regex_search_btw_AB(c, r'.*'+ltp(upregulates)+r'.... |
This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association
| This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"positive",
"response",
"or",
"imply",
"an",
"upregulates",
"association"
] | def LF_DuG_UPREGULATES(c):
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
else:
if rule_regex_search_btw_AB(c, r'.*'+ltp(upregulates)+r'.*', 1):
return 1
elif rule_regex_search_btw_BA(c, r'.*'+ltp(upregulates)+r'.*', 1):
return 1
elif re.search(r'({{A... | [
"def",
"LF_DuG_UPREGULATES",
"(",
"c",
")",
":",
"if",
"LF_DG_METHOD_DESC",
"(",
"c",
")",
"or",
"LF_DG_TITLE",
"(",
"c",
")",
":",
"return",
"0",
"else",
":",
"if",
"rule_regex_search_btw_AB",
"(",
"c",
",",
"r'.*'",
"+",
"ltp",
"(",
"upregulates",
")",... | This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"positive",
"response",
"or",
"imply",
"an",
"upregulates",
"association"
] | [
"\"\"\"\n This label function is designed to search for words that indicate\n a sort of positive response or imply an upregulates association\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DdG_DOWNREGULATES | <not_specific> | def LF_DdG_DOWNREGULATES(c):
"""
This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association
"""
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
else:
if rule_regex_search_btw_AB(c, r'.*'+ltp(downregulate... |
This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association
| This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"negative",
"response",
"or",
"imply",
"an",
"downregulates",
"association"
] | def LF_DdG_DOWNREGULATES(c):
if LF_DG_METHOD_DESC(c) or LF_DG_TITLE(c):
return 0
else:
if rule_regex_search_btw_AB(c, r'.*'+ltp(downregulates)+r'.*', 1):
return 1
elif rule_regex_search_btw_BA(c, r'.*'+ltp(downregulates)+r'.*', 1):
return 1
elif re.search(... | [
"def",
"LF_DdG_DOWNREGULATES",
"(",
"c",
")",
":",
"if",
"LF_DG_METHOD_DESC",
"(",
"c",
")",
"or",
"LF_DG_TITLE",
"(",
"c",
")",
":",
"return",
"0",
"else",
":",
"if",
"rule_regex_search_btw_AB",
"(",
"c",
",",
"r'.*'",
"+",
"ltp",
"(",
"downregulates",
... | This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"negative",
"response",
"or",
"imply",
"an",
"downregulates",
"association"
] | [
"\"\"\"\n This label function is designed to search for words that indicate\n a sort of negative response or imply an downregulates association\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_GENETIC_ABNORMALITIES | <not_specific> | def LF_DG_GENETIC_ABNORMALITIES(c):
"""
This LF searches for key phraes that indicate a genetic abnormality
"""
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + " ".join(get_right_tokens... |
This LF searches for key phraes that indicate a genetic abnormality
| This LF searches for key phraes that indicate a genetic abnormality | [
"This",
"LF",
"searches",
"for",
"key",
"phraes",
"that",
"indicate",
"a",
"genetic",
"abnormality"
] | def LF_DG_GENETIC_ABNORMALITIES(c):
left_window = " ".join(get_left_tokens(c[0], window=10)) + " ".join(get_left_tokens(c[1], window=10))
right_window = " ".join(get_right_tokens(c[0], window=10)) + " ".join(get_right_tokens(c[1], window=10))
if re.search(ltp(genetic_abnormalities), get_text_between(c), fla... | [
"def",
"LF_DG_GENETIC_ABNORMALITIES",
"(",
"c",
")",
":",
"left_window",
"=",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
"0",
"]",
",",
"window",
"=",
"10",
")",
")",
"+",
"\" \"",
".",
"join",
"(",
"get_left_tokens",
"(",
"c",
"[",
... | This LF searches for key phraes that indicate a genetic abnormality | [
"This",
"LF",
"searches",
"for",
"key",
"phraes",
"that",
"indicate",
"a",
"genetic",
"abnormality"
] | [
"\"\"\"\n This LF searches for key phraes that indicate a genetic abnormality\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_DIAGNOSIS | <not_specific> | def LF_DG_DIAGNOSIS(c):
"""
This label function is designed to search for words that imply a patient diagnosis
which will provide evidence for possible disease gene association.
"""
return 1 if any([rule_regex_search_btw_AB(c, r'.*'+ltp(diagnosis_indicators) + r".*", 1), rule_regex_search_btw_BA(c, ... |
This label function is designed to search for words that imply a patient diagnosis
which will provide evidence for possible disease gene association.
| This label function is designed to search for words that imply a patient diagnosis
which will provide evidence for possible disease gene association. | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"imply",
"a",
"patient",
"diagnosis",
"which",
"will",
"provide",
"evidence",
"for",
"possible",
"disease",
"gene",
"association",
"."
] | def LF_DG_DIAGNOSIS(c):
return 1 if any([rule_regex_search_btw_AB(c, r'.*'+ltp(diagnosis_indicators) + r".*", 1), rule_regex_search_btw_BA(c, r'.*'+ltp(diagnosis_indicators) + r".*", 1)]) or \
re.search(r'({{A}}|{{B}}).*({{A}}|{{B}}).*' + ltp(diagnosis_indicators), get_tagged_text(c)) else 0 | [
"def",
"LF_DG_DIAGNOSIS",
"(",
"c",
")",
":",
"return",
"1",
"if",
"any",
"(",
"[",
"rule_regex_search_btw_AB",
"(",
"c",
",",
"r'.*'",
"+",
"ltp",
"(",
"diagnosis_indicators",
")",
"+",
"r\".*\"",
",",
"1",
")",
",",
"rule_regex_search_btw_BA",
"(",
"c",
... | This label function is designed to search for words that imply a patient diagnosis
which will provide evidence for possible disease gene association. | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"imply",
"a",
"patient",
"diagnosis",
"which",
"will",
"provide",
"evidence",
"for",
"possible",
"disease",
"gene",
"association",
"."
] | [
"\"\"\"\n This label function is designed to search for words that imply a patient diagnosis\n which will provide evidence for possible disease gene association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_PATIENT_WITH | <not_specific> | def LF_DG_PATIENT_WITH(c):
"""
This label function looks for the phrase " with" disease.
"""
return 1 if re.search(r"patient(s)? with.{1,200}{{A}}", get_tagged_text(c), flags=re.I) else 0 |
This label function looks for the phrase " with" disease.
| This label function looks for the phrase " with" disease. | [
"This",
"label",
"function",
"looks",
"for",
"the",
"phrase",
"\"",
"with",
"\"",
"disease",
"."
] | def LF_DG_PATIENT_WITH(c):
return 1 if re.search(r"patient(s)? with.{1,200}{{A}}", get_tagged_text(c), flags=re.I) else 0 | [
"def",
"LF_DG_PATIENT_WITH",
"(",
"c",
")",
":",
"return",
"1",
"if",
"re",
".",
"search",
"(",
"r\"patient(s)? with.{1,200}{{A}}\"",
",",
"get_tagged_text",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
"else",
"0"
] | This label function looks for the phrase " with" disease. | [
"This",
"label",
"function",
"looks",
"for",
"the",
"phrase",
"\"",
"with",
"\"",
"disease",
"."
] | [
"\"\"\"\n This label function looks for the phrase \" with\" disease.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_CONCLUSION_TITLE | <not_specific> | def LF_DG_CONCLUSION_TITLE(c):
""""
This label function searches for the word conclusion at the beginning of the sentence.
Some abstracts are written in this format.
"""
return 1 if "CONCLUSION:" in get_tagged_text(c) or "concluded" in get_tagged_text(c) else 0 |
This label function searches for the word conclusion at the beginning of the sentence.
Some abstracts are written in this format.
| This label function searches for the word conclusion at the beginning of the sentence.
Some abstracts are written in this format. | [
"This",
"label",
"function",
"searches",
"for",
"the",
"word",
"conclusion",
"at",
"the",
"beginning",
"of",
"the",
"sentence",
".",
"Some",
"abstracts",
"are",
"written",
"in",
"this",
"format",
"."
] | def LF_DG_CONCLUSION_TITLE(c):
return 1 if "CONCLUSION:" in get_tagged_text(c) or "concluded" in get_tagged_text(c) else 0 | [
"def",
"LF_DG_CONCLUSION_TITLE",
"(",
"c",
")",
":",
"return",
"1",
"if",
"\"CONCLUSION:\"",
"in",
"get_tagged_text",
"(",
"c",
")",
"or",
"\"concluded\"",
"in",
"get_tagged_text",
"(",
"c",
")",
"else",
"0"
] | This label function searches for the word conclusion at the beginning of the sentence. | [
"This",
"label",
"function",
"searches",
"for",
"the",
"word",
"conclusion",
"at",
"the",
"beginning",
"of",
"the",
"sentence",
"."
] | [
"\"\"\"\"\n This label function searches for the word conclusion at the beginning of the sentence.\n Some abstracts are written in this format.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DaG_NO_CONCLUSION | <not_specific> | def LF_DaG_NO_CONCLUSION(c):
"""
This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association.
"""
p... |
This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association.
| This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association. | [
"This",
"label",
"function",
"fires",
"a",
"-",
"1",
"if",
"the",
"number",
"of",
"negative",
"label",
"functinos",
"is",
"greater",
"than",
"the",
"number",
"of",
"positive",
"label",
"functions",
".",
"The",
"main",
"idea",
"behind",
"this",
"label",
"fu... | def LF_DaG_NO_CONCLUSION(c):
positive_num = np.sum([
LF_DaG_ASSOCIATION(c), LF_DG_IS_BIOMARKER(c), LF_DG_DIAGNOSIS(c),
LF_DaG_CELLULAR_ACTIVITY(c),
np.abs(LF_DaG_WEAK_ASSOCIATION(c)), np.abs(LF_DaG_NO_ASSOCIATION(c))
])
negative_num = np.abs(np.sum([
LF_DG_METHOD_DESC(c), LF_... | [
"def",
"LF_DaG_NO_CONCLUSION",
"(",
"c",
")",
":",
"positive_num",
"=",
"np",
".",
"sum",
"(",
"[",
"LF_DaG_ASSOCIATION",
"(",
"c",
")",
",",
"LF_DG_IS_BIOMARKER",
"(",
"c",
")",
",",
"LF_DG_DIAGNOSIS",
"(",
"c",
")",
",",
"LF_DaG_CELLULAR_ACTIVITY",
"(",
... | This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions. | [
"This",
"label",
"function",
"fires",
"a",
"-",
"1",
"if",
"the",
"number",
"of",
"negative",
"label",
"functinos",
"is",
"greater",
"than",
"the",
"number",
"of",
"positive",
"label",
"functions",
"."
] | [
"\"\"\"\n This label function fires a -1 if the number of negative label functinos is greater than the number\n of positive label functions.\n The main idea behind this label function is add support to sentences that could\n mention a possible disease gene association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DaG_CONCLUSION | <not_specific> | def LF_DaG_CONCLUSION(c):
"""
This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association
"""
if LF_... |
This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association
| This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association | [
"This",
"label",
"function",
"fires",
"a",
"1",
"if",
"the",
"number",
"of",
"positive",
"label",
"functions",
"is",
"greater",
"than",
"the",
"number",
"of",
"negative",
"label",
"functions",
".",
"The",
"main",
"idea",
"behind",
"this",
"label",
"function"... | def LF_DaG_CONCLUSION(c):
if LF_DaG_NO_ASSOCIATION(c) or LF_DaG_WEAK_ASSOCIATION(c):
return -1
elif not LF_DaG_NO_CONCLUSION(c):
return 1
else:
return 0 | [
"def",
"LF_DaG_CONCLUSION",
"(",
"c",
")",
":",
"if",
"LF_DaG_NO_ASSOCIATION",
"(",
"c",
")",
"or",
"LF_DaG_WEAK_ASSOCIATION",
"(",
"c",
")",
":",
"return",
"-",
"1",
"elif",
"not",
"LF_DaG_NO_CONCLUSION",
"(",
"c",
")",
":",
"return",
"1",
"else",
":",
... | This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions. | [
"This",
"label",
"function",
"fires",
"a",
"1",
"if",
"the",
"number",
"of",
"positive",
"label",
"functions",
"is",
"greater",
"than",
"the",
"number",
"of",
"negative",
"label",
"functions",
"."
] | [
"\"\"\"\n This label function fires a 1 if the number of positive label functions is greater than the number\n of negative label functions.\n The main idea behind this label function is add support to sentences that could\n mention a possible disease gene association\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DuG_NO_CONCLUSION | <not_specific> | def LF_DuG_NO_CONCLUSION(c):
"""
This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association.
"""
p... |
This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association.
| This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association. | [
"This",
"label",
"function",
"fires",
"a",
"-",
"1",
"if",
"the",
"number",
"of",
"negative",
"label",
"functinos",
"is",
"greater",
"than",
"the",
"number",
"of",
"positive",
"label",
"functions",
".",
"The",
"main",
"idea",
"behind",
"this",
"label",
"fu... | def LF_DuG_NO_CONCLUSION(c):
positive_num = np.sum([
LF_DuG_UPREGULATES(c)
])
negative_num = np.abs(np.sum(LF_DG_METHOD_DESC(c), LF_DG_TITLE(c)))
if positive_num - negative_num >= 1:
return 0
return -1 | [
"def",
"LF_DuG_NO_CONCLUSION",
"(",
"c",
")",
":",
"positive_num",
"=",
"np",
".",
"sum",
"(",
"[",
"LF_DuG_UPREGULATES",
"(",
"c",
")",
"]",
")",
"negative_num",
"=",
"np",
".",
"abs",
"(",
"np",
".",
"sum",
"(",
"LF_DG_METHOD_DESC",
"(",
"c",
")",
... | This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions. | [
"This",
"label",
"function",
"fires",
"a",
"-",
"1",
"if",
"the",
"number",
"of",
"negative",
"label",
"functinos",
"is",
"greater",
"than",
"the",
"number",
"of",
"positive",
"label",
"functions",
"."
] | [
"\"\"\"\n This label function fires a -1 if the number of negative label functinos is greater than the number\n of positive label functions.\n The main idea behind this label function is add support to sentences that could\n mention a possible disease gene association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DuG_CONCLUSION | <not_specific> | def LF_DuG_CONCLUSION(c):
"""
This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association
"""
if not... |
This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association
| This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association | [
"This",
"label",
"function",
"fires",
"a",
"1",
"if",
"the",
"number",
"of",
"positive",
"label",
"functions",
"is",
"greater",
"than",
"the",
"number",
"of",
"negative",
"label",
"functions",
".",
"The",
"main",
"idea",
"behind",
"this",
"label",
"function"... | def LF_DuG_CONCLUSION(c):
if not LF_DuG_NO_CONCLUSION(c):
return 1
else:
return 0 | [
"def",
"LF_DuG_CONCLUSION",
"(",
"c",
")",
":",
"if",
"not",
"LF_DuG_NO_CONCLUSION",
"(",
"c",
")",
":",
"return",
"1",
"else",
":",
"return",
"0"
] | This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions. | [
"This",
"label",
"function",
"fires",
"a",
"1",
"if",
"the",
"number",
"of",
"positive",
"label",
"functions",
"is",
"greater",
"than",
"the",
"number",
"of",
"negative",
"label",
"functions",
"."
] | [
"\"\"\"\n This label function fires a 1 if the number of positive label functions is greater than the number\n of negative label functions.\n The main idea behind this label function is add support to sentences that could\n mention a possible disease gene association\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DdG_NO_CONCLUSION | <not_specific> | def LF_DdG_NO_CONCLUSION(c):
"""
This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association.
"""
p... |
This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association.
| This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association. | [
"This",
"label",
"function",
"fires",
"a",
"-",
"1",
"if",
"the",
"number",
"of",
"negative",
"label",
"functinos",
"is",
"greater",
"than",
"the",
"number",
"of",
"positive",
"label",
"functions",
".",
"The",
"main",
"idea",
"behind",
"this",
"label",
"fu... | def LF_DdG_NO_CONCLUSION(c):
positive_num = np.sum([
LF_DdG_DOWNREGULATES(c)
])
negative_num = np.abs(np.sum(LF_DG_METHOD_DESC(c), LF_DG_TITLE(c)))
if positive_num - negative_num >= 1:
return 0
return -1 | [
"def",
"LF_DdG_NO_CONCLUSION",
"(",
"c",
")",
":",
"positive_num",
"=",
"np",
".",
"sum",
"(",
"[",
"LF_DdG_DOWNREGULATES",
"(",
"c",
")",
"]",
")",
"negative_num",
"=",
"np",
".",
"abs",
"(",
"np",
".",
"sum",
"(",
"LF_DG_METHOD_DESC",
"(",
"c",
")",
... | This label function fires a -1 if the number of negative label functinos is greater than the number
of positive label functions. | [
"This",
"label",
"function",
"fires",
"a",
"-",
"1",
"if",
"the",
"number",
"of",
"negative",
"label",
"functinos",
"is",
"greater",
"than",
"the",
"number",
"of",
"positive",
"label",
"functions",
"."
] | [
"\"\"\"\n This label function fires a -1 if the number of negative label functinos is greater than the number\n of positive label functions.\n The main idea behind this label function is add support to sentences that could\n mention a possible disease gene association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DdG_CONCLUSION | <not_specific> | def LF_DdG_CONCLUSION(c):
"""
This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association
"""
if not... |
This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association
| This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions.
The main idea behind this label function is add support to sentences that could
mention a possible disease gene association | [
"This",
"label",
"function",
"fires",
"a",
"1",
"if",
"the",
"number",
"of",
"positive",
"label",
"functions",
"is",
"greater",
"than",
"the",
"number",
"of",
"negative",
"label",
"functions",
".",
"The",
"main",
"idea",
"behind",
"this",
"label",
"function"... | def LF_DdG_CONCLUSION(c):
if not LF_DdG_NO_CONCLUSION(c):
return 1
else:
return 0 | [
"def",
"LF_DdG_CONCLUSION",
"(",
"c",
")",
":",
"if",
"not",
"LF_DdG_NO_CONCLUSION",
"(",
"c",
")",
":",
"return",
"1",
"else",
":",
"return",
"0"
] | This label function fires a 1 if the number of positive label functions is greater than the number
of negative label functions. | [
"This",
"label",
"function",
"fires",
"a",
"1",
"if",
"the",
"number",
"of",
"positive",
"label",
"functions",
"is",
"greater",
"than",
"the",
"number",
"of",
"negative",
"label",
"functions",
"."
] | [
"\"\"\"\n This label function fires a 1 if the number of positive label functions is greater than the number\n of negative label functions.\n The main idea behind this label function is add support to sentences that could\n mention a possible disease gene association\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_DISTANCE_SHORT | <not_specific> | def LF_DG_DISTANCE_SHORT(c):
"""
This LF is designed to make sure that the disease mention
and the gene mention aren't right next to each other.
"""
return -1 if len(list(get_between_tokens(c))) <= 2 else 0 |
This LF is designed to make sure that the disease mention
and the gene mention aren't right next to each other.
| This LF is designed to make sure that the disease mention
and the gene mention aren't right next to each other. | [
"This",
"LF",
"is",
"designed",
"to",
"make",
"sure",
"that",
"the",
"disease",
"mention",
"and",
"the",
"gene",
"mention",
"aren",
"'",
"t",
"right",
"next",
"to",
"each",
"other",
"."
] | def LF_DG_DISTANCE_SHORT(c):
return -1 if len(list(get_between_tokens(c))) <= 2 else 0 | [
"def",
"LF_DG_DISTANCE_SHORT",
"(",
"c",
")",
":",
"return",
"-",
"1",
"if",
"len",
"(",
"list",
"(",
"get_between_tokens",
"(",
"c",
")",
")",
")",
"<=",
"2",
"else",
"0"
] | This LF is designed to make sure that the disease mention
and the gene mention aren't right next to each other. | [
"This",
"LF",
"is",
"designed",
"to",
"make",
"sure",
"that",
"the",
"disease",
"mention",
"and",
"the",
"gene",
"mention",
"aren",
"'",
"t",
"right",
"next",
"to",
"each",
"other",
"."
] | [
"\"\"\"\n This LF is designed to make sure that the disease mention\n and the gene mention aren't right next to each other.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_DISTANCE_LONG | <not_specific> | def LF_DG_DISTANCE_LONG(c):
"""
This LF is designed to make sure that the disease mention
and the gene mention aren't too far from each other.
"""
return -1 if len(list(get_between_tokens(c))) > 50 else 0 |
This LF is designed to make sure that the disease mention
and the gene mention aren't too far from each other.
| This LF is designed to make sure that the disease mention
and the gene mention aren't too far from each other. | [
"This",
"LF",
"is",
"designed",
"to",
"make",
"sure",
"that",
"the",
"disease",
"mention",
"and",
"the",
"gene",
"mention",
"aren",
"'",
"t",
"too",
"far",
"from",
"each",
"other",
"."
] | def LF_DG_DISTANCE_LONG(c):
return -1 if len(list(get_between_tokens(c))) > 50 else 0 | [
"def",
"LF_DG_DISTANCE_LONG",
"(",
"c",
")",
":",
"return",
"-",
"1",
"if",
"len",
"(",
"list",
"(",
"get_between_tokens",
"(",
"c",
")",
")",
")",
">",
"50",
"else",
"0"
] | This LF is designed to make sure that the disease mention
and the gene mention aren't too far from each other. | [
"This",
"LF",
"is",
"designed",
"to",
"make",
"sure",
"that",
"the",
"disease",
"mention",
"and",
"the",
"gene",
"mention",
"aren",
"'",
"t",
"too",
"far",
"from",
"each",
"other",
"."
] | [
"\"\"\"\n This LF is designed to make sure that the disease mention\n and the gene mention aren't too far from each other.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_ALLOWED_DISTANCE | <not_specific> | def LF_DG_ALLOWED_DISTANCE(c):
"""
This LF is designed to make sure that the disease mention
and the gene mention are in an acceptable distance between
each other
"""
return 0 if any([
LF_DG_DISTANCE_LONG(c),
LF_DG_DISTANCE_SHORT(c)
]) else 1 |
This LF is designed to make sure that the disease mention
and the gene mention are in an acceptable distance between
each other
| This LF is designed to make sure that the disease mention
and the gene mention are in an acceptable distance between
each other | [
"This",
"LF",
"is",
"designed",
"to",
"make",
"sure",
"that",
"the",
"disease",
"mention",
"and",
"the",
"gene",
"mention",
"are",
"in",
"an",
"acceptable",
"distance",
"between",
"each",
"other"
] | def LF_DG_ALLOWED_DISTANCE(c):
return 0 if any([
LF_DG_DISTANCE_LONG(c),
LF_DG_DISTANCE_SHORT(c)
]) else 1 | [
"def",
"LF_DG_ALLOWED_DISTANCE",
"(",
"c",
")",
":",
"return",
"0",
"if",
"any",
"(",
"[",
"LF_DG_DISTANCE_LONG",
"(",
"c",
")",
",",
"LF_DG_DISTANCE_SHORT",
"(",
"c",
")",
"]",
")",
"else",
"1"
] | This LF is designed to make sure that the disease mention
and the gene mention are in an acceptable distance between
each other | [
"This",
"LF",
"is",
"designed",
"to",
"make",
"sure",
"that",
"the",
"disease",
"mention",
"and",
"the",
"gene",
"mention",
"are",
"in",
"an",
"acceptable",
"distance",
"between",
"each",
"other"
] | [
"\"\"\"\n This LF is designed to make sure that the disease mention\n and the gene mention are in an acceptable distance between \n each other\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_NO_VERB | <not_specific> | def LF_DG_NO_VERB(c):
"""
This label function is designed to fire if a given
sentence doesn't contain a verb. Helps cut out some of the titles
hidden in Pubtator abstracts
"""
if len([x for x in c.get_parent().pos_tags if "VB" in x and x != "VBG"]) == 0:
return -1
return 0 |
This label function is designed to fire if a given
sentence doesn't contain a verb. Helps cut out some of the titles
hidden in Pubtator abstracts
| This label function is designed to fire if a given
sentence doesn't contain a verb. Helps cut out some of the titles
hidden in Pubtator abstracts | [
"This",
"label",
"function",
"is",
"designed",
"to",
"fire",
"if",
"a",
"given",
"sentence",
"doesn",
"'",
"t",
"contain",
"a",
"verb",
".",
"Helps",
"cut",
"out",
"some",
"of",
"the",
"titles",
"hidden",
"in",
"Pubtator",
"abstracts"
] | def LF_DG_NO_VERB(c):
if len([x for x in c.get_parent().pos_tags if "VB" in x and x != "VBG"]) == 0:
return -1
return 0 | [
"def",
"LF_DG_NO_VERB",
"(",
"c",
")",
":",
"if",
"len",
"(",
"[",
"x",
"for",
"x",
"in",
"c",
".",
"get_parent",
"(",
")",
".",
"pos_tags",
"if",
"\"VB\"",
"in",
"x",
"and",
"x",
"!=",
"\"VBG\"",
"]",
")",
"==",
"0",
":",
"return",
"-",
"1",
... | This label function is designed to fire if a given
sentence doesn't contain a verb. | [
"This",
"label",
"function",
"is",
"designed",
"to",
"fire",
"if",
"a",
"given",
"sentence",
"doesn",
"'",
"t",
"contain",
"a",
"verb",
"."
] | [
"\"\"\"\n This label function is designed to fire if a given\n sentence doesn't contain a verb. Helps cut out some of the titles\n hidden in Pubtator abstracts\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_CASUAL_MUTATIONS | <not_specific> | def LF_DG_BICLUSTER_CASUAL_MUTATIONS(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in causal_mutations_base:
... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_CASUAL_MUTATIONS(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in causal_mutations_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_CASUAL_MUTATIONS",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_MUTATIONS | <not_specific> | def LF_DG_BICLUSTER_MUTATIONS(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in mutations_base:
return 1
r... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_MUTATIONS(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in mutations_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_MUTATIONS",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
",",
... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_DRUG_TARGETS | <not_specific> | def LF_DG_BICLUSTER_DRUG_TARGETS(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in drug_targets_base:
return 1... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_DRUG_TARGETS(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in drug_targets_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_DRUG_TARGETS",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
","... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_PATHOGENESIS | <not_specific> | def LF_DG_BICLUSTER_PATHOGENESIS(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in pathogenesis_base:
return 1... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_PATHOGENESIS(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in pathogenesis_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_PATHOGENESIS",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
","... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_THERAPEUTIC | <not_specific> | def LF_DG_BICLUSTER_THERAPEUTIC(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in therapeutic_base:
return 1
... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_THERAPEUTIC(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in therapeutic_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_THERAPEUTIC",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
",",... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_POLYMORPHISMS | <not_specific> | def LF_DG_BICLUSTER_POLYMORPHISMS(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in polymorphisms_base:
return... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_POLYMORPHISMS(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in polymorphisms_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_POLYMORPHISMS",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
",... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_PROGRESSION | <not_specific> | def LF_DG_BICLUSTER_PROGRESSION(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in progression_base:
return 1
... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_PROGRESSION(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in progression_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_PROGRESSION",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
",",... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_BIOMARKERS | <not_specific> | def LF_DG_BICLUSTER_BIOMARKERS(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in biomarkers_base:
return 1
... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_BIOMARKERS(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in biomarkers_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_BIOMARKERS",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
",",
... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_OVEREXPRESSION | <not_specific> | def LF_DG_BICLUSTER_OVEREXPRESSION(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in overexpression_base:
retu... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_OVEREXPRESSION(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in overexpression_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_OVEREXPRESSION",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
"... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
983b2e6f7f22e3acf81091870788b531f6c94e5d | ajlee21/snorkeling | disease_gene/disease_associates_gene/data/label_functions/disease_gene_lfs.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_BICLUSTER_REGULATION | <not_specific> | def LF_DG_BICLUSTER_REGULATION(c):
"""
This label function uses the bicluster data located in the
A global network of biomedical relationships
"""
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in regulation_base:
return 1
... |
This label function uses the bicluster data located in the
A global network of biomedical relationships
| This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | def LF_DG_BICLUSTER_REGULATION(c):
sen_pos = c.get_parent().position
pubmed_id = int(c.get_parent().document.name)
if (pubmed_id, sen_pos) in regulation_base:
return 1
return 0 | [
"def",
"LF_DG_BICLUSTER_REGULATION",
"(",
"c",
")",
":",
"sen_pos",
"=",
"c",
".",
"get_parent",
"(",
")",
".",
"position",
"pubmed_id",
"=",
"int",
"(",
"c",
".",
"get_parent",
"(",
")",
".",
"document",
".",
"name",
")",
"if",
"(",
"pubmed_id",
",",
... | This label function uses the bicluster data located in the
A global network of biomedical relationships | [
"This",
"label",
"function",
"uses",
"the",
"bicluster",
"data",
"located",
"in",
"the",
"A",
"global",
"network",
"of",
"biomedical",
"relationships"
] | [
"\"\"\"\n This label function uses the bicluster data located in the \n A global network of biomedical relationships\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
054d5b905ca3e260f967b37f358e343af8588544 | ajlee21/snorkeling | gene_gene/gene_interacts_gene/datafile/gene_gene_datafile_generator.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | partitioner | <not_specific> | def partitioner(df):
"""
This function creates a parition rank for the current dataset.
This algorithm assigns a rank [0-1) for each datapoint inside each group (outlined below):
1,1 -in hetionet and has sentences
1,0 - in hetionet and doesn't have sentences
0,1 - not in hetionet and... |
This function creates a parition rank for the current dataset.
This algorithm assigns a rank [0-1) for each datapoint inside each group (outlined below):
1,1 -in hetionet and has sentences
1,0 - in hetionet and doesn't have sentences
0,1 - not in hetionet and does have sentences
... | This function creates a parition rank for the current dataset.
This ranking will be used in the get split function to assign each datapoint
into its corresponding category (train, dev, test) | [
"This",
"function",
"creates",
"a",
"parition",
"rank",
"for",
"the",
"current",
"dataset",
".",
"This",
"ranking",
"will",
"be",
"used",
"in",
"the",
"get",
"split",
"function",
"to",
"assign",
"each",
"datapoint",
"into",
"its",
"corresponding",
"category",
... | def partitioner(df):
partition_rank = pd.np.linspace(0, 1, num=len(df), endpoint=False)
pd.np.random.shuffle(partition_rank)
df['partition_rank'] = partition_rank
return df | [
"def",
"partitioner",
"(",
"df",
")",
":",
"partition_rank",
"=",
"pd",
".",
"np",
".",
"linspace",
"(",
"0",
",",
"1",
",",
"num",
"=",
"len",
"(",
"df",
")",
",",
"endpoint",
"=",
"False",
")",
"pd",
".",
"np",
".",
"random",
".",
"shuffle",
... | This function creates a parition rank for the current dataset. | [
"This",
"function",
"creates",
"a",
"parition",
"rank",
"for",
"the",
"current",
"dataset",
"."
] | [
"\"\"\"\n This function creates a parition rank for the current dataset.\n This algorithm assigns a rank [0-1) for each datapoint inside each group (outlined below):\n 1,1 -in hetionet and has sentences\n 1,0 - in hetionet and doesn't have sentences\n 0,1 - not in hetionet and does have s... | [
{
"param": "df",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_HETNET_DG_ABSENT | <not_specific> | def LF_HETNET_DG_ABSENT(c):
"""
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
"""
return 0 if any([
LF_HETNET_DISEASES(c),
LF_HETNET_DOAF(c),
LF_HETNET_DisGeNET(c),
LF_HETNET_GWAS(c)
]) else -1 |
This label function fires -1 if the given Disease Gene pair does not appear
in the databases above.
| This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | def LF_HETNET_DG_ABSENT(c):
return 0 if any([
LF_HETNET_DISEASES(c),
LF_HETNET_DOAF(c),
LF_HETNET_DisGeNET(c),
LF_HETNET_GWAS(c)
]) else -1 | [
"def",
"LF_HETNET_DG_ABSENT",
"(",
"c",
")",
":",
"return",
"0",
"if",
"any",
"(",
"[",
"LF_HETNET_DISEASES",
"(",
"c",
")",
",",
"LF_HETNET_DOAF",
"(",
"c",
")",
",",
"LF_HETNET_DisGeNET",
"(",
"c",
")",
",",
"LF_HETNET_GWAS",
"(",
"c",
")",
"]",
")",... | This label function fires -1 if the given Disease Gene pair does not appear
in the databases above. | [
"This",
"label",
"function",
"fires",
"-",
"1",
"if",
"the",
"given",
"Disease",
"Gene",
"pair",
"does",
"not",
"appear",
"in",
"the",
"databases",
"above",
"."
] | [
"\"\"\"\n This label function fires -1 if the given Disease Gene pair does not appear \n in the databases above.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_IS_BIOMARKER | <not_specific> | def LF_DG_IS_BIOMARKER(c):
"""
This label function examines a sentences to determine of a sentence
is talking about a biomarker. (A biomarker leads towards D-G assocation
c - The candidate obejct being passed in
"""
if re.search(ltp(biomarker_indicators) + r".*{{B}}", get_tagged_text(c), flags=r... |
This label function examines a sentences to determine of a sentence
is talking about a biomarker. (A biomarker leads towards D-G assocation
c - The candidate obejct being passed in
| This label function examines a sentences to determine of a sentence
is talking about a biomarker. (A biomarker leads towards D-G assocation
c - The candidate obejct being passed in | [
"This",
"label",
"function",
"examines",
"a",
"sentences",
"to",
"determine",
"of",
"a",
"sentence",
"is",
"talking",
"about",
"a",
"biomarker",
".",
"(",
"A",
"biomarker",
"leads",
"towards",
"D",
"-",
"G",
"assocation",
"c",
"-",
"The",
"candidate",
"obe... | def LF_DG_IS_BIOMARKER(c):
if re.search(ltp(biomarker_indicators) + r".*{{B}}", get_tagged_text(c), flags=re.I):
return 1
elif re.search(r"{{B}}.*" + ltp(biomarker_indicators), get_tagged_text(c), flags=re.I):
return 1
else:
return 0 | [
"def",
"LF_DG_IS_BIOMARKER",
"(",
"c",
")",
":",
"if",
"re",
".",
"search",
"(",
"ltp",
"(",
"biomarker_indicators",
")",
"+",
"r\".*{{B}}\"",
",",
"get_tagged_text",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
":",
"return",
"1",
"elif",
... | This label function examines a sentences to determine of a sentence
is talking about a biomarker. | [
"This",
"label",
"function",
"examines",
"a",
"sentences",
"to",
"determine",
"of",
"a",
"sentence",
"is",
"talking",
"about",
"a",
"biomarker",
"."
] | [
"\"\"\"\n This label function examines a sentences to determine of a sentence\n is talking about a biomarker. (A biomarker leads towards D-G assocation\n c - The candidate obejct being passed in\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_ASSOCIATION | <not_specific> | def LF_DG_ASSOCIATION(c):
"""
This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association.
"""
if re.search(r'(?<!not )(?<!no )' + ltp(direct_association), get_text_between(c), flags=re.I):
return 1
elif re.search(r'(?<!not )(?<!no )' + ltp(direct_asso... |
This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association.
| This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"an",
"association",
"."
] | def LF_DG_ASSOCIATION(c):
if re.search(r'(?<!not )(?<!no )' + ltp(direct_association), get_text_between(c), flags=re.I):
return 1
elif re.search(r'(?<!not )(?<!no )' + ltp(direct_association) + r".*({{B}}|{{A}})", get_tagged_text(c), flags=re.I):
return 1
elif re.search(r"({{B}}|{{A}}).*(?<!... | [
"def",
"LF_DG_ASSOCIATION",
"(",
"c",
")",
":",
"if",
"re",
".",
"search",
"(",
"r'(?<!not )(?<!no )'",
"+",
"ltp",
"(",
"direct_association",
")",
",",
"get_text_between",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
":",
"return",
"1",
"eli... | This LF is designed to test if there is a key phrase that suggests
a d-g pair is an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"an",
"association",
"."
] | [
"\"\"\"\n This LF is designed to test if there is a key phrase that suggests\n a d-g pair is an association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_WEAK_ASSOCIATION | <not_specific> | def LF_DG_WEAK_ASSOCIATION(c):
"""
This label function is design to search for phrases that indicate a
weak association between the disease and gene
"""
if re.search(ltp(weak_association), get_text_between(c), flags=re.I):
return -1
elif re.search(ltp(weak_association) + r".*({{B}}|{{A}... |
This label function is design to search for phrases that indicate a
weak association between the disease and gene
| This label function is design to search for phrases that indicate a
weak association between the disease and gene | [
"This",
"label",
"function",
"is",
"design",
"to",
"search",
"for",
"phrases",
"that",
"indicate",
"a",
"weak",
"association",
"between",
"the",
"disease",
"and",
"gene"
] | def LF_DG_WEAK_ASSOCIATION(c):
if re.search(ltp(weak_association), get_text_between(c), flags=re.I):
return -1
elif re.search(ltp(weak_association) + r".*({{B}}|{{A}})", get_tagged_text(c), flags=re.I):
return -1
elif re.search(r"({{B}}|{{A}}).*" + ltp(weak_association), get_tagged_text(c), ... | [
"def",
"LF_DG_WEAK_ASSOCIATION",
"(",
"c",
")",
":",
"if",
"re",
".",
"search",
"(",
"ltp",
"(",
"weak_association",
")",
",",
"get_text_between",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
":",
"return",
"-",
"1",
"elif",
"re",
".",
"s... | This label function is design to search for phrases that indicate a
weak association between the disease and gene | [
"This",
"label",
"function",
"is",
"design",
"to",
"search",
"for",
"phrases",
"that",
"indicate",
"a",
"weak",
"association",
"between",
"the",
"disease",
"and",
"gene"
] | [
"\"\"\"\n This label function is design to search for phrases that indicate a \n weak association between the disease and gene\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_NO_ASSOCIATION | <not_specific> | def LF_DG_NO_ASSOCIATION(c):
"""
This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association.
"""
if re.search(ltp(no_direct_association), get_text_between(c), flags=re.I):
return -1
elif re.search(ltp(no_direct_association) + r".*({{B}}|{{A}})", ge... |
This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association.
| This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"no",
"an",
"association",
"."
] | def LF_DG_NO_ASSOCIATION(c):
if re.search(ltp(no_direct_association), get_text_between(c), flags=re.I):
return -1
elif re.search(ltp(no_direct_association) + r".*({{B}}|{{A}})", get_tagged_text(c), flags=re.I):
return -1
elif re.search(r"({{B}}|{{A}}).*" + ltp(no_direct_association), get_tag... | [
"def",
"LF_DG_NO_ASSOCIATION",
"(",
"c",
")",
":",
"if",
"re",
".",
"search",
"(",
"ltp",
"(",
"no_direct_association",
")",
",",
"get_text_between",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
":",
"return",
"-",
"1",
"elif",
"re",
".",
... | This LF is designed to test if there is a key phrase that suggests
a d-g pair is no an association. | [
"This",
"LF",
"is",
"designed",
"to",
"test",
"if",
"there",
"is",
"a",
"key",
"phrase",
"that",
"suggests",
"a",
"d",
"-",
"g",
"pair",
"is",
"no",
"an",
"association",
"."
] | [
"\"\"\"\n This LF is designed to test if there is a key phrase that suggests\n a d-g pair is no an association.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_METHOD_DESC | <not_specific> | def LF_DG_METHOD_DESC(c):
"""
This label function is designed to look for phrases
that imply a sentence is description an experimental design
"""
if re.search(ltp(method_indication), get_tagged_text(c), flags=re.I):
return -1
else:
return 0 |
This label function is designed to look for phrases
that imply a sentence is description an experimental design
| This label function is designed to look for phrases
that imply a sentence is description an experimental design | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"imply",
"a",
"sentence",
"is",
"description",
"an",
"experimental",
"design"
] | def LF_DG_METHOD_DESC(c):
if re.search(ltp(method_indication), get_tagged_text(c), flags=re.I):
return -1
else:
return 0 | [
"def",
"LF_DG_METHOD_DESC",
"(",
"c",
")",
":",
"if",
"re",
".",
"search",
"(",
"ltp",
"(",
"method_indication",
")",
",",
"get_tagged_text",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
":",
"return",
"-",
"1",
"else",
":",
"return",
"0"... | This label function is designed to look for phrases
that imply a sentence is description an experimental design | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"imply",
"a",
"sentence",
"is",
"description",
"an",
"experimental",
"design"
] | [
"\"\"\"\n This label function is designed to look for phrases \n that imply a sentence is description an experimental design\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_TITLE | <not_specific> | def LF_DG_TITLE(c):
"""
This label function is designed to look for phrases that inditcates
a paper title
"""
if re.search(r'^'+ltp(title_indication), get_tagged_text(c), flags=re.I):
return -1
elif re.search(ltp(title_indication)+r'$', get_tagged_text(c), flags=re.I):
return -1
... |
This label function is designed to look for phrases that inditcates
a paper title
| This label function is designed to look for phrases that inditcates
a paper title | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"inditcates",
"a",
"paper",
"title"
] | def LF_DG_TITLE(c):
if re.search(r'^'+ltp(title_indication), get_tagged_text(c), flags=re.I):
return -1
elif re.search(ltp(title_indication)+r'$', get_tagged_text(c), flags=re.I):
return -1
else:
return 0 | [
"def",
"LF_DG_TITLE",
"(",
"c",
")",
":",
"if",
"re",
".",
"search",
"(",
"r'^'",
"+",
"ltp",
"(",
"title_indication",
")",
",",
"get_tagged_text",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
":",
"return",
"-",
"1",
"elif",
"re",
".",... | This label function is designed to look for phrases that inditcates
a paper title | [
"This",
"label",
"function",
"is",
"designed",
"to",
"look",
"for",
"phrases",
"that",
"inditcates",
"a",
"paper",
"title"
] | [
"\"\"\"\n This label function is designed to look for phrases that inditcates\n a paper title\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_POSITIVE_DIRECTION | <not_specific> | def LF_DG_POSITIVE_DIRECTION(c):
"""
This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association
"""
return 1 if any([rule_regex_search_btw_AB(c, r'.*'+ltp(positive_direction)+r'.*', 1), rule_regex_search_btw_BA(c, r'.*'+ltp(posit... |
This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association
| This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"positive",
"response",
"or",
"imply",
"an",
"upregulates",
"association"
] | def LF_DG_POSITIVE_DIRECTION(c):
return 1 if any([rule_regex_search_btw_AB(c, r'.*'+ltp(positive_direction)+r'.*', 1), rule_regex_search_btw_BA(c, r'.*'+ltp(positive_direction)+r'.*', 1)]) or \
re.search(r'({{A}}|{{B}}).*({{A}}|{{B}}).*' + ltp(positive_direction), get_tagged_text(c)) else 0 | [
"def",
"LF_DG_POSITIVE_DIRECTION",
"(",
"c",
")",
":",
"return",
"1",
"if",
"any",
"(",
"[",
"rule_regex_search_btw_AB",
"(",
"c",
",",
"r'.*'",
"+",
"ltp",
"(",
"positive_direction",
")",
"+",
"r'.*'",
",",
"1",
")",
",",
"rule_regex_search_btw_BA",
"(",
... | This label function is designed to search for words that indicate
a sort of positive response or imply an upregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"positive",
"response",
"or",
"imply",
"an",
"upregulates",
"association"
] | [
"\"\"\"\n This label function is designed to search for words that indicate\n a sort of positive response or imply an upregulates association\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_NEGATIVE_DIRECTION | <not_specific> | def LF_DG_NEGATIVE_DIRECTION(c):
"""
This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association
"""
return 1 if any([rule_regex_search_btw_AB(c, r'.*'+ltp(negative_direction)+r'.*', 1), rule_regex_search_btw_BA(c, r'.*'+ltp(neg... |
This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association
| This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"negative",
"response",
"or",
"imply",
"an",
"downregulates",
"association"
] | def LF_DG_NEGATIVE_DIRECTION(c):
return 1 if any([rule_regex_search_btw_AB(c, r'.*'+ltp(negative_direction)+r'.*', 1), rule_regex_search_btw_BA(c, r'.*'+ltp(negative_direction)+r'.*', 1)]) or \
re.search(r'({{A}}|{{B}}).*({{A}}|{{B}}).*' + ltp(positive_direction), get_tagged_text(c)) else 0 | [
"def",
"LF_DG_NEGATIVE_DIRECTION",
"(",
"c",
")",
":",
"return",
"1",
"if",
"any",
"(",
"[",
"rule_regex_search_btw_AB",
"(",
"c",
",",
"r'.*'",
"+",
"ltp",
"(",
"negative_direction",
")",
"+",
"r'.*'",
",",
"1",
")",
",",
"rule_regex_search_btw_BA",
"(",
... | This label function is designed to search for words that indicate
a sort of negative response or imply an downregulates association | [
"This",
"label",
"function",
"is",
"designed",
"to",
"search",
"for",
"words",
"that",
"indicate",
"a",
"sort",
"of",
"negative",
"response",
"or",
"imply",
"an",
"downregulates",
"association"
] | [
"\"\"\"\n This label function is designed to search for words that indicate\n a sort of negative response or imply an downregulates association\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_RISK | <not_specific> | def LF_DG_RISK(c):
"""
This label function searched for sentences that mention a patient being at risk for disease or
a signal implying increased/decreased risk of disease.
"""
return 1 if re.search(r"risk (of|for)", get_tagged_text(c), flags=re.I) else 0 |
This label function searched for sentences that mention a patient being at risk for disease or
a signal implying increased/decreased risk of disease.
| This label function searched for sentences that mention a patient being at risk for disease or
a signal implying increased/decreased risk of disease. | [
"This",
"label",
"function",
"searched",
"for",
"sentences",
"that",
"mention",
"a",
"patient",
"being",
"at",
"risk",
"for",
"disease",
"or",
"a",
"signal",
"implying",
"increased",
"/",
"decreased",
"risk",
"of",
"disease",
"."
] | def LF_DG_RISK(c):
return 1 if re.search(r"risk (of|for)", get_tagged_text(c), flags=re.I) else 0 | [
"def",
"LF_DG_RISK",
"(",
"c",
")",
":",
"return",
"1",
"if",
"re",
".",
"search",
"(",
"r\"risk (of|for)\"",
",",
"get_tagged_text",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
"else",
"0"
] | This label function searched for sentences that mention a patient being at risk for disease or
a signal implying increased/decreased risk of disease. | [
"This",
"label",
"function",
"searched",
"for",
"sentences",
"that",
"mention",
"a",
"patient",
"being",
"at",
"risk",
"for",
"disease",
"or",
"a",
"signal",
"implying",
"increased",
"/",
"decreased",
"risk",
"of",
"disease",
"."
] | [
"\"\"\"\n This label function searched for sentences that mention a patient being at risk for disease or \n a signal implying increased/decreased risk of disease.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_PATIENT_WITH | <not_specific> | def LF_DG_PATIENT_WITH(c):
"""
This label function looks for the phrase "patients with" disease.
"""
return 1 if re.search(r"patient(s)? with {{A}}", get_tagged_text(c), flags=re.I) else 0 |
This label function looks for the phrase "patients with" disease.
| This label function looks for the phrase "patients with" disease. | [
"This",
"label",
"function",
"looks",
"for",
"the",
"phrase",
"\"",
"patients",
"with",
"\"",
"disease",
"."
] | def LF_DG_PATIENT_WITH(c):
return 1 if re.search(r"patient(s)? with {{A}}", get_tagged_text(c), flags=re.I) else 0 | [
"def",
"LF_DG_PATIENT_WITH",
"(",
"c",
")",
":",
"return",
"1",
"if",
"re",
".",
"search",
"(",
"r\"patient(s)? with {{A}}\"",
",",
"get_tagged_text",
"(",
"c",
")",
",",
"flags",
"=",
"re",
".",
"I",
")",
"else",
"0"
] | This label function looks for the phrase "patients with" disease. | [
"This",
"label",
"function",
"looks",
"for",
"the",
"phrase",
"\"",
"patients",
"with",
"\"",
"disease",
"."
] | [
"\"\"\"\n This label function looks for the phrase \"patients with\" disease.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_PURPOSE | <not_specific> | def LF_DG_PURPOSE(c):
""""
This label function searches for the word purpose at the beginning of the sentence.
Some abstracts are written in this format.
"""
return -1 if "PURPOSE:" in get_tagged_text(c) else 0 |
This label function searches for the word purpose at the beginning of the sentence.
Some abstracts are written in this format.
| This label function searches for the word purpose at the beginning of the sentence.
Some abstracts are written in this format. | [
"This",
"label",
"function",
"searches",
"for",
"the",
"word",
"purpose",
"at",
"the",
"beginning",
"of",
"the",
"sentence",
".",
"Some",
"abstracts",
"are",
"written",
"in",
"this",
"format",
"."
] | def LF_DG_PURPOSE(c):
return -1 if "PURPOSE:" in get_tagged_text(c) else 0 | [
"def",
"LF_DG_PURPOSE",
"(",
"c",
")",
":",
"return",
"-",
"1",
"if",
"\"PURPOSE:\"",
"in",
"get_tagged_text",
"(",
"c",
")",
"else",
"0"
] | This label function searches for the word purpose at the beginning of the sentence. | [
"This",
"label",
"function",
"searches",
"for",
"the",
"word",
"purpose",
"at",
"the",
"beginning",
"of",
"the",
"sentence",
"."
] | [
"\"\"\"\"\n This label function searches for the word purpose at the beginning of the sentence.\n Some abstracts are written in this format.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
34ffd5b620f09d787deb594a055410486a7745d2 | ajlee21/snorkeling | playground/compound_disease/transfer_learning_experiment/data/label_functions/disease_gene_lf.py | [
"CC0-1.0",
"BSD-3-Clause"
] | Python | LF_DG_CONCLUSION_TITLE | <not_specific> | def LF_DG_CONCLUSION_TITLE(c):
""""
This label function searches for the word conclusion at the beginning of the sentence.
Some abstracts are written in this format.
"""
return 1 if "CONCLUSION" in get_tagged_text(c) or "concluded" in get_tagged_text(c) else 0 |
This label function searches for the word conclusion at the beginning of the sentence.
Some abstracts are written in this format.
| This label function searches for the word conclusion at the beginning of the sentence.
Some abstracts are written in this format. | [
"This",
"label",
"function",
"searches",
"for",
"the",
"word",
"conclusion",
"at",
"the",
"beginning",
"of",
"the",
"sentence",
".",
"Some",
"abstracts",
"are",
"written",
"in",
"this",
"format",
"."
] | def LF_DG_CONCLUSION_TITLE(c):
return 1 if "CONCLUSION" in get_tagged_text(c) or "concluded" in get_tagged_text(c) else 0 | [
"def",
"LF_DG_CONCLUSION_TITLE",
"(",
"c",
")",
":",
"return",
"1",
"if",
"\"CONCLUSION\"",
"in",
"get_tagged_text",
"(",
"c",
")",
"or",
"\"concluded\"",
"in",
"get_tagged_text",
"(",
"c",
")",
"else",
"0"
] | This label function searches for the word conclusion at the beginning of the sentence. | [
"This",
"label",
"function",
"searches",
"for",
"the",
"word",
"conclusion",
"at",
"the",
"beginning",
"of",
"the",
"sentence",
"."
] | [
"\"\"\"\"\n This label function searches for the word conclusion at the beginning of the sentence.\n Some abstracts are written in this format.\n \"\"\""
] | [
{
"param": "c",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.