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
def sim(word1, word2, lch_threshold=2.15, verbose=False): | |
"""Determine if two (already lemmatized) words are similar or not. | |
Call with verbose=True to print the WordNet senses from each word | |
that are considered similar. | |
The documentation for the NLTK WordNet Interface is available here: | |
http://nltk.googlecode.com/svn/trunk/doc/howto/wordnet.html | |
""" | |
from nltk.corpus import wordnet as wn |
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
import json, datetime | |
class RoundTripEncoder(json.JSONEncoder): | |
DATE_FORMAT = "%Y-%m-%d" | |
TIME_FORMAT = "%H:%M:%S" | |
def default(self, obj): | |
if isinstance(obj, datetime.datetime): | |
return { | |
"_type": "datetime", | |
"value": obj.strftime("%s %s" % ( |
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
import struct, sys, os | |
#----------------------------------------------------------- | |
#--- Block recoverer program for bzip2 -- | |
#--- bzip2recover.py -- | |
#----------------------------------------------------------- | |
# This program is bzip2recover, a program to attempt data | |
# salvage from damaged files. |