Skip to content

Instantly share code, notes, and snippets.

@ankitvad
ankitvad / ptl_torchtext_example.py
Created December 11, 2020 06:06 — forked from elkotito/ptl_torchtext_example.py
TorchText example using PyTorch Lightning
import torch
import torch.nn as nn
from pytorch_lightning import LightningModule, Trainer
from torchtext.data import Field, BucketIterator, Batch
from torchtext.datasets import IMDB
from torchtext.vocab import GloVe
UNK_TOKEN = "<unk>"
PAD_TOKEN = "<pad>"
@ankitvad
ankitvad / awesome-kge.md
Created October 25, 2019 19:09 — forked from mommi84/awesome-kge.md
Awesome Knowledge Graph Embedding Approaches

Awesome Knowledge Graph Embedding Approaches

Awesome

This list contains repositories of libraries and approaches for knowledge graph embeddings, which are vector representations of entities and relations in a multi-relational directed labelled graph. Licensed under CC0.

Libraries

@ankitvad
ankitvad / summarize.py
Created October 16, 2019 23:15 — forked from rodricios/summarize.py
Flipboard's summarization algorithm, sort of
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pip install networkx distance pattern
In Flipboard's article[1], they kindly divulge their interpretation
of the summarization technique called LexRank[2].
@ankitvad
ankitvad / gist:a9058a166a789d0166bbf3a069a71de8
Created November 21, 2016 11:31 — forked from ttezel/gist:4138642
Natural Language Processing Notes

#A Collection of NLP notes

##N-grams

###Calculating unigram probabilities:

P( wi ) = count ( wi ) ) / count ( total number of words )

In english..

@ankitvad
ankitvad / server.py
Created March 21, 2016 07:18 — forked from peterkuma/server.py
A flask server for serving all JPEG images in a local directory and subdirectories. Uses unveil.js for lazy-loading of images. Thumbnails are created on the fly by PIL.
#!/bin/python
import os
from flask import Flask, Response, request, abort, render_template_string, send_from_directory
import Image
import StringIO
app = Flask(__name__)
WIDTH = 1000