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
"""trial URL Configuration | |
The `urlpatterns` list routes URLs to views. For more information please see: | |
https://docs.djangoproject.com/en/2.2/topics/http/urls/ | |
Examples: | |
Function views | |
1. Add an import: from my_app import views | |
2. Add a URL to urlpatterns: path('', views.home, name='home') | |
Class-based views | |
1. Add an import: from other_app.views import Home |
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
from django.apps import AppConfig | |
import html | |
import pathlib | |
import os | |
from fast_bert.prediction import BertClassificationPredictor | |
class WebappConfig(AppConfig): | |
name = 'fastbert' | |
MODEL_PATH = Path("model") |
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
from django.apps import AppConfig | |
import html | |
import pathlib | |
import os | |
from fast_bert.prediction import BertClassificationPredictor | |
class WebappConfig(AppConfig): | |
name = 'fastbert' | |
MODEL_PATH = Path("model") |
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
from django.shortcuts import render | |
from .apps import WebappConfig | |
# Create your views here. | |
from django.http import HttpResponse, JsonResponse | |
from django.shortcuts import get_object_or_404 | |
from rest_framework.views import APIView | |
from rest_framework.response import Response | |
from rest_framework import status | |
from .apps import WebappConfig |
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
from django.shortcuts import render | |
from .apps import WebappConfig | |
# Create your views here. | |
from django.http import HttpResponse, JsonResponse | |
from django.shortcuts import get_object_or_404 | |
from rest_framework.views import APIView | |
from rest_framework.response import Response | |
from rest_framework import status | |
from .apps import WebappConfig |
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 | |
# coding: utf8 | |
# Training additional entity types using spaCy | |
from __future__ import unicode_literals, print_function | |
import pickle | |
import plac | |
import random | |
from pathlib import Path | |
import spacy |
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
# Convert json file to spaCy format. | |
import plac | |
import logging | |
import argparse | |
import sys | |
import os | |
import json | |
import pickle | |
@plac.annotations(input_file=("Input file", "option", "i", str), output_file=("Output file", "option", "o", 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
# Convert .tsv file to dataturks json format. | |
import json | |
import logging | |
import sys | |
def tsv_to_json_format(input_path,output_path,unknown_label): | |
try: | |
f=open(input_path,'r') # input file | |
fp=open(output_path, 'w') # output file | |
data_dict={} | |
annotations =[] |
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 libraries | |
from urllib.request import urlopen | |
from bs4 import BeautifulSoup | |
# specify the url | |
url = "https://www.bbc.com/sport/football/46897172" | |
# Connect to the website and return the html to the variable ‘page’ | |
try: | |
page = urlopen(url) |