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
library(lingtypology); library(tidyverse) | |
df <- read_csv("knowledge_russian_in_Daghestan.csv") | |
# old way ----------------------------------------------------------------- | |
df %>% | |
filter(year_of_birth_dec == 1910) -> | |
v_1910 | |
map.feature(v_1910$Language, | |
features = v_1910$lang_knowledge, | |
latitude = v_1910$Lat, |
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 gensim.models import KeyedVectors | |
# Load gensim word2vec | |
w2v_path = '<Gensim File Path>' | |
w2v = KeyedVectors.load_word2vec_format(w2v_path) | |
import io | |
# Vector file, `\t` seperated the vectors and `\n` seperate the words | |
""" |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# http://stackoverflow.com/questions/5574702/how-to-print-to-stderr-in-python | |
from __future__ import print_function | |
import sys | |
def eprint(*args, **kwargs): | |
print(*args, file=sys.stderr, **kwargs) | |
import errno |
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
plot.kitty = function () { | |
library(jpeg) | |
temp.cat = tempfile() | |
download.file("http://thecatapi.com/api/images/get?format=src&type=jpg", | |
destfile=temp.cat) | |
kitty = readJPEG(temp.cat) | |