Skip to content

Instantly share code, notes, and snippets.

@kylepjohnson
kylepjohnson / get_prev_next.ipynb
Created April 8, 2016 05:17
Example to page through dict
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# https://en.wikipedia.org/wiki/Greek_diacritics#Unicode
#Upper Case Vowels
UPPER = ['Α', 'Ε', 'Η', 'Ι', 'Ο', 'Υ', 'Ω', 'ᾼ', 'ῌ', 'ῼ']
UPPER_ACUTE = ['Ά', 'Έ', 'Ή', 'Ί', 'Ό', 'Ύ', 'Ώ']
UPPER_GRAVE = ['Ὰ', 'Ὲ', 'Ὴ', 'Ὶ', 'Ὸ', 'Ὺ', 'Ὼ']
UPPER_SMOOTH = ['Ἀ', 'Ἐ', 'Ἠ', 'Ἰ', 'Ὀ', 'Ὠ', 'ᾈ', 'ᾘ', 'ᾨ']
UPPER_SMOOTH_ACUTE = ['Ἄ', 'Ἔ', 'Ἤ', 'Ἴ', 'Ὄ', 'Ὤ', 'ᾌ', 'ᾜ', 'ᾬ']
UPPER_SMOOTH_GRAVE = ['Ἂ', 'Ἒ', 'Ἢ', 'Ἲ', 'Ὂ', 'Ὢ', 'ᾊ', 'ᾚ', 'ᾪ']
@kylepjohnson
kylepjohnson / make_phi5_vocab.py
Created November 19, 2015 04:37
Get all unique words from PHI5, output to file
# coding: utf-8
# In[1]:
import os
import re
from cltk.corpus.utils.formatter import assemble_phi5_author_filepaths
from cltk.corpus.utils.formatter import phi5_plaintext_cleanup
@kylepjohnson
kylepjohnson / morpheus-ubuntu-good-install
Created August 9, 2015 15:21
On Ubuntu 14.04, GCC 4.8.2. Was this make successful?
$ make
cd greeklib; make greeklib.a
make[1]: Entering directory `/vagrant/morpheus/src/greeklib'
gcc -O2 -I../includes -c -o Fclose.o Fclose.c
Fclose.c: In function ‘xFree’:
Fclose.c:28:2: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
free(p);
^
gcc -O2 -I../includes -c -o addaccent.o addaccent.c
gcc -O2 -I../includes -c -o addbreath.o addbreath.c
@kylepjohnson
kylepjohnson / morpheus-ubuntu-update
Last active August 29, 2015 14:27
Mropheus updade.sh (Ubuntu 14.04)
$ ./update.sh
buildend -L nom
endtables/ascii/a_ae.asc
endtables/ascii/e_es.asc
endtables/ascii/es_ae.asc
endtables/ascii/as_ae.asc
endtables/ascii/us_i.asc
endtables/ascii/ius_i.asc
endtables/ascii/os_i.asc
endtables/ascii/0_i.asc
vagrant@vagrant-ubuntu-trusty-64:/vagrant/morpheus/src$ make
cd greeklib; make greeklib.a
make[1]: Entering directory `/vagrant/morpheus/src/greeklib'
gcc -O2 -I../includes -c -o Fclose.o Fclose.c
Fclose.c: In function ‘xFree’:
Fclose.c:28:2: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
free(p);
^
gcc -O2 -I../includes -c -o addaccent.o addaccent.c
gcc -O2 -I../includes -c -o addbreath.o addbreath.c
siue 4851
praecipue 885
neue 503
ioue 422
graue 377
breue 217
leue 215
caue 209
salue 208
naue 188
ne 17403
sine 8675
nomine 4131
bene 3753
ratione 2391
sane 2115
omne 1959
sanguine 1405
paene 1314
condicione 1266
@kylepjohnson
kylepjohnson / gist:5a5aa14e2181709c9f93
Created April 24, 2015 13:49
all que enclitics, ranked
atque 20349
neque 14000
quoque 12658
itaque 5090
usque 2667
denique 2216
quisque 1675
namque 1658
quinque 1476
utique 1325
@kylepjohnson
kylepjohnson / phi5_auth_word_sentence_v3.csv
Last active August 29, 2015 14:06
CSV export of words per sentence data for PHI5 authors.
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 214 columns, instead of 1. in line 2.
author,word_count,sent_count,5,6,1,avg_words_per_sent,2,3,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,27,28,29,31,33,40,44,24,26,30,32,34,35,36,37,38,39,41,42,45,47,48,49,51,54,55,57,59,65,80,82,107,43,50,52,53,58,62,67,68,76,88,46,106,136,63,64,193,69,70,73,84,86,87,91,92,100,90,109,119,56,60,61,66,71,72,74,75,77,78,79,81,83,85,89,93,95,96,98,97,105,108,110,112,113,122,125,126,147,153,155,178,104,114,121,148,204,94,102,115,133,146,144,145,99,101,111,117,118,120,123,129,130,132,103,364,142,149,151,159,160,161,163,167,179,189,200,116,128,124,199,227,248,134,184,127,196,158,352,139,157,162,164,192,217,226,252,135,137,138,141,143,150,154,581,168,284,174,186,287,191,198,203,205,271,209,280,255,212,214,237,279,236,140,302,166,197,211,222,241,247,183,176,131,781,172
Ablabius,12.0,3.0,1.0,1.0,1.0,4.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Aem