This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gpd | |
from shapely.geometry import shape | |
CB = None # replace by a shapely geometry object. | |
r=0.2 # radius of the hexagon | |
h = (r * np.sqrt(3))/2 | |
j = r/2 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# REQUIREMENTS : pandas keras torch numpy transformers | |
""" | |
Strongly based from the article : https://mccormickml.com/2019/07/22/BERT-fine-tuning/ | |
by Chris McCormick | |
""" | |
import os | |
import time | |
import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install dependencies : pip install geopandas pandas numpy matplotlib descartes healpy | |
import pandas as pd | |
import numpy as np | |
import geopandas as gpd | |
from shapely.geometry import Polygon,MultiPolygon,Point,MultiLineString,LineString | |
import healpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import os | |
import json | |
class ArgParseConfigurationReader(object): | |
""" | |
Example of config JSON : | |
{ | |
"description": "Program", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Natural Language Toolkit: Interface to the TreeTagger POS-tagger | |
# | |
# Copyright (C) Mirko Otto | |
# Author: Mirko Otto <[email protected]> | |
# Modified by: Jacques Fize | |
""" | |
A Python module for interfacing with the Treetagger by Helmut Schmid. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_tokens(doc, index_to_del, list_attr=[LOWER, POS, ENT_TYPE, IS_ALPHA, DEP, LEMMA, LOWER, IS_PUNCT, IS_DIGIT, IS_SPACE, IS_STOP]): | |
""" | |
Remove tokens from a Spacy *Doc* object without losing | |
associated information (PartOfSpeech, Dependance, Lemma, extensions, ...) | |
Parameters | |
---------- | |
doc : spacy.tokens.doc.Doc | |
spacy representation of the text | |
index_to_del : list of integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding= utf-8 | |
import warnings | |
import re | |
import importlib | |
import glob | |
import copy | |
import pandas as pd | |
import numpy as np | |
from tqdm import tqdm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# If you use MacOS, download the latest version of pdftk from here : | |
# https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg | |
function exists(command){ | |
if ! [ -x "$(command -v $command)" ]; then | |
echo "Error: $command is not installed." >&2 | |
exit 1 | |
fi |