Skip to content

Instantly share code, notes, and snippets.

View pafonta's full-sized avatar

Pierre-Alexandre Fonta pafonta

View GitHub Profile
# For an example of use, see https://gist.github.com/pafonta/21f3db4d9c31f6a1c2f7ede8cbf3406b#gistcomment-3970844.
"""Entity Linking - Link mentions from texts to terms in ontologies.
Use character-based embedding to handle plurals, misspellings, partial matches, ...
"""
import pickle
import faiss
# For an example of use, see https://gist.github.com/pafonta/37762f56e8c1879569bca64901d0a000#gistcomment-3968062.
"""Collect statistics on PubMed articles."""
from __future__ import annotations
from pathlib import Path
from defusedxml import ElementTree
from tqdm import tqdm
# For an example of use, see https://gist.github.com/pafonta/d33a0d5d849932f8ceab8b711d995497#gistcomment-3965575.
"""Find MeSH terms in the MeSH tree simply (i.e. without using a graph)."""
from __future__ import annotations
import json
from collections.abc import Iterator
from xml.etree.ElementTree import Element # nosec
@pafonta
pafonta / nlm_mesh.py
Last active November 19, 2021 15:27
# For an example of use, see https://gist.github.com/pafonta/162c1b9ec0380e95a017297a707a4d66#gistcomment-3935739.
"""Find & Rank MeSH terms associated with an author."""
from __future__ import annotations
import json
from collections import Counter
from collections.abc import Iterator
from xml.etree.ElementTree import Element # nosec
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pafonta
pafonta / bulk_aiohttp_callback.py
Last active August 15, 2019 15:08
Example of asynchronous requests with a parameterizable callback function and processed item tracking, using aiohttp and asyncio.
#!/usr/bin/env python3.7
import asyncio
from asyncio import Task
from aiohttp import ClientResponseError, ClientSession
# TODO Concrete example to be generalized.
@pafonta
pafonta / nexus_v1 _summary_of_permissions_on_a_path_and_its_ancestors.ipynb
Last active August 2, 2021 12:28
Nexus v1 - Create a table summarizing the permissions identities have on a path and its ancestors
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.