Skip to content

Instantly share code, notes, and snippets.

Ethan Willis ethanwillis

Block or report user

Report or block ethanwillis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View processFiles.sh
#!/bin/bash
FILES=/path/to/*
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
cat $f
done
@ethanwillis
ethanwillis / ngrams.py
Last active Aug 29, 2015
Final Version of Ngrams script with CSV Output and multi query support
View ngrams.py
import os
import csv
from string import maketrans
def ngramsProgram(directory, ngramQueries):
# Input: get corpus from all text files within a directory
# Step 1: Get list of files in a directory
txtFileList = os.listdir(directory)
# Step 2: Process each text file in our list of files
searchResults = []
@ethanwillis
ethanwillis / ngrams.py
Last active Aug 29, 2015
Python script to find ngrams in a corpus
View ngrams.py
def ngramsProgram(corpus, n):
# Input comes from our parameters
# process our input to find ngrams
ngrams = findNGrams(corpus, n)
# Output our ngrams.
outputNGrams(ngrams)
def findNGrams(corpus, n):
View gist:5209906
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sorts;
import java.io.PrintStream;
import java.util.ArrayList;
/**
View gist:5209795
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sorts;
import java.io.PrintStream;
import java.util.ArrayList;
/**
You can’t perform that action at this time.