This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>{{ crate.name or "New RO Crate" }}</title> | |
<meta name="keywords" content="RO Crate"> | |
<style type="text/css"> | |
html { | |
margin: 0; | |
padding: 0; | |
} |
This file contains 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
# Using common libraries. | |
# | |
# Dependencies: | |
# pandas jsonapi-client | |
# Install them from the command line, with e.g. | |
# $ pip install pandas jsonapi-client | |
from jsonapi_client import Session | |
import pandas as pd |
This file contains 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
category = "wellbeing" | |
seeds = ["stress", "engagement", "burnout"] | |
matcher = Matcher(nlp.vocab) | |
rule_patterns = [ | |
[{"LEMMA": "-PRON-", "OP": "?"}] | |
+ [{"LEMMA": tok.lemma_} for tok in nlp(seed)] | |
for seed in seeds | |
] |
This file contains 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
# Start with an official python parent image | |
FROM python:3.6 | |
WORKDIR /app | |
ADD . /app | |
RUN pip install -r requirements.txt | |
# SageMaker requires this form of running (not RUN) |
This file contains 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
from flask import Flask, request, abort | |
@app.route('/ping', methods=['GET', 'POST']) | |
def ping(): | |
return 'ping is pong' | |
@app.route('/invocations', methods=['POST']) | |
def invocation(): | |
data = request.get_json() | |
if not data: |
This file contains 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 numpy as np | |
class SimilarityModel(object): | |
def __init__(self, token_similarity_accumulator=np.max): | |
self._accumulator = token_similarity_accumulator | |
def __call__(self, doc): | |
doc.user_hooks[‘similarity’] = self.doc_span_similarity | |
doc.user_span_hooks[‘similarity’] = self.doc_span_similarity | |
doc.user_token_hooks[‘similarity’] = self.token_similarity |