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
$ pip install --no-build-isolation --editable ".[transformers,ray]" | |
Obtaining file:///Users/wmcneill/Documents/src/spaCy | |
Preparing wheel metadata ... done | |
Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.8 in /Users/wmcneill/opt/anaconda3/envs/spaCy/lib/python3.9/site-packages (from spacy==3.1.3) (3.0.8) | |
Requirement already satisfied: setuptools in /Users/wmcneill/opt/anaconda3/envs/spaCy/lib/python3.9/site-packages (from spacy==3.1.3) (58.0.4) | |
Requirement already satisfied: typer<0.5.0,>=0.3.0 in /Users/wmcneill/opt/anaconda3/envs/spaCy/lib/python3.9/site-packages (from spacy==3.1.3) (0.4.0) | |
Requirement already satisfied: requests<3.0.0,>=2.13.0 in /Users/wmcneill/opt/anaconda3/envs/spaCy/lib/python3.9/site-packages (from spacy==3.1.3) (2.26.0) | |
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /Users/wmcneill/opt/anaconda3/envs/spaCy/lib/python3.9/site-packages (from spacy==3.1.3) (2.0.5) | |
Requirement already satisfied: packaging>=20.0 in /Users/wmcneill/opt/anaconda3/envs/spaCy/lib/python3.9/s |
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
#!/usr/bin/env python | |
import shutil | |
from pathlib import Path | |
from typing import Iterable, Tuple, Optional | |
import click | |
from celery import Celery | |
from celery.utils.log import get_task_logger | |
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
def maximal_fully_ordered_sublists(s: List[T]) -> List[List[T]]: | |
""" | |
Find maximum-length sequences of in-order items in a list. | |
Let s be a list of items over which there exists a total ordering defined by the < operator. | |
Let a fully-ordered sublist s' of s be s with elements removed so that the elements of s' are monotonically | |
increasing. | |
The maximal fully-ordered sublists of s are the set of fully-ordered sublists such that no sublist is contained in | |
another one. |
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 json | |
import re | |
import time | |
from random import choice, random | |
from typing import TextIO, Callable, Sequence, Tuple, Optional | |
import click | |
NAME = DATE = str | |
SPAN_OFFSET = Tuple[int, int] |
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 json | |
from json import JSONDecodeError | |
from typing import Sequence | |
import click | |
class JSONList(click.ParamType): | |
def convert(self, value: str, _, __) -> Sequence: |
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 json | |
from json import JSONDecodeError | |
from typing import Sequence, Iterable, List | |
import click | |
import spacy | |
from spacy.matcher import Matcher | |
def match_patterns(nlp, patterns: Sequence[dict], corpus: Iterable[str]) -> Iterable[str]: |
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 paragraphs(document): | |
start = 0 | |
for token in document: | |
if token.is_space and token.text.count("\n") > 1: | |
yield document[start:token.i] | |
start = token.i | |
yield document[start:] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
""" | |
Put all the Stanford Sentiment Treebank phrase data into test, training, and dev CSVs. | |
Socher, R., Perelygin, A., Wu, J. Y., Chuang, J., Manning, C. D., Ng, A. Y., & Potts, C. (2013). Recursive Deep Models | |
for Semantic Compositionality Over a Sentiment Treebank. Presented at the Conference on Empirical Methods in Natural | |
Language Processing EMNLP. | |
https://nlp.stanford.edu/sentiment/ | |
""" |
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
""" | |
A minimal implementation of the MNIST handwritten digits classification task in TensorFlow. | |
This runs MNIST images images through a single hidden layer and softmax loss function. | |
It demonstrates in a single Python source file the basics of creating a model, training and evaluating data sets, and | |
writing summaries that can be visualized by TensorBoard. | |
""" | |
from __future__ import division |
NewerOlder