Skip to content

Instantly share code, notes, and snippets.

"""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
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")
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")
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
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
#!/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
# 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))
# 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 =[]
# 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)
<!-- Source: https://www.w3schools.com/tags -->
<!-- The <html> tag tells the browser that this is an HTML document. -->
<!-- The <head> element is a container for all the head elements. -->
<!-- The <body> tag defines the document's body. -->
<!-- It contains all the contents of an HTML document, such as text, hyperlinks, images, tables, lists, etc.-->
<html>
<head>
<title>Title of the document</title>
</head>
<body>