Skip to content

Instantly share code, notes, and snippets.

View josephcc's full-sized avatar
💭

Joseph Chang josephcc

💭
View GitHub Profile
package hello;
import java.io.IOException;
import javax.servlet.http.*;
import tcloud.se.service.IndexService;
import tcloud.common.stub.RestfulServiceFactory;
import java.util.List;
import java.util.ArrayList;
import tcloud.se.model.*;
HTTP ERROR 500
Problem accessing /. Reason:
An unexpected exception occurs : null.
Caused by:
tcloud.common.stub.StubException: An unexpected exception occurs : null.
at tcloud.common.stub.ExceptionMapper.fromResponse(ExceptionMapper.java:39)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.checkResponse(ClientProxyImpl.java:226)
from nltk.corpus import wordnet as wn
import tesseract
import string
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", string.ascii_uppercase)
mBuffer = open('source.jpg','rb').read()
result = tesseract.ProcessPagesBuffer(mBuffer,len(mBuffer),api)
print result
public class MainClass {
private static final Object o = new Object();
static {
MyThread thread = new MyThread();
require 'formula'
class TmuxForIterm2 < Formula
url 'http://iterm2.googlecode.com/files/tmux-for-iTerm2-20130302.tar.gz'
md5 '9acb1ed1c3f0e24180c6e2e65e512670'
homepage 'http://code.google.com/p/iterm2/wiki/TmuxIntegration'
depends_on 'libevent'
def install
from operator import attrgetter
# Don't save the symbol tables, use the provided table ascii.syms!
#def SaveFST(t, txtFstFileName, isymFile, osymFile):
def SaveFST(t, txtFstFileName):
#SaveSym(t.isyms, isymFile)
#SaveSym(t.osyms, osymFile)
f = open(txtFstFileName, 'w+');
states = sorted(t.states, key=attrgetter('initial'), reverse=True)
PSCRIPT = ../../data/scripts/
FSYMS = ../../data/pyfst_demo/ascii.syms
FTRAIN_TXT = ../../data/data/nc10k.train.txt
FDEV_TXT = ../../data/data/nc10k.dev.txt
FTRAIN_FST = nc10k.train.fst
FDEV_FST = nc10k.dev.fst
ASYMS = --isymbols=$(FSYMS) --osymbols=$(FSYMS)
AOPT = fstrmepsilon| fstdeterminize
define([
'flight/lib/component',
], function(defineComponent) {
return defineComponent(function() {
this.screenViewerHitMenu = function (e, data) {
var x = data.position.x;
var y = data.position.y;
var html;
html += '<ul class="dropdown-menu" role="menu">';
SENT 0 GOAL DERIVATION: ( [S] ( [PP-LOC] ( [IN] In ) ( [NP] ( [NP] ( [DT] an ) ( [X23] ( [NNP] Oct. ) ( [X24] ( [CD] 19 ) ( [NN] review ) ) ) ) ( [X37] ( [PP] ( [IN] of ) ( [NP] ( [``] `` ) ( [X38] ( [NP-TTL] ( [DT] The ) ( [NN] Misanthrope ) ) ( [X39] ( [''] '' ) ( [PP-LOC] ( [IN] at ) ( [NP] ( [NP] ( [NNP] Chicago ) ( [POS] 's ) ) ( [X34] ( [NNP] Goodman ) ( [NNP] Theatre ) ) ) ) ) ) ) ) ( [PRN] ( [-LRB-] -LRB- ) ( [X42] ( [``] `` ) ( [X43] ( [S-HLN] ( [NP-SBJ] ( [VBN] Revitalized ) ( [NNS] Classics ) ) ( [VP] ( [VBP] Take ) ( [X64] ( [NP] ( [DT] the ) ( [NN] Stage ) ) ( [PP-LOC] ( [IN] in ) ( [NP] ( [NNP] Windy ) ( [NNP] City ) ) ) ) ) ) ( [X44] ( [,] , ) ( [X45] ( [''] '' ) ( [X46] ( [NP-TMP] ( [NN] Leisure ) ( [X21] ( [CC] & ) ( [NNS] Arts ) ) ) ( [-RRB-] -RRB- ) ) ) ) ) ) ) ) ) ) ( [X50] ( [,] , ) ( [X51] ( [NP-SBJ-2] ( [NP] ( [NP] ( [DT] the ) ( [NN] role ) ) ( [PP] ( [IN] of ) ( [NP] ( [NNP] Celimene ) ) ) ) ( [X5] ( [,] , ) ( [X6] ( [VP] ( [VBN] played ) ( [PP-LOC-CLR] ( [IN] by ) ( [NP] ( [NNP] Kim
import re
from sys import stdin
def uncnf(g):
return type(g) not in (list, tuple) and g or map(uncnf, g[g[0]=='<DEL>':])
for line in stdin:
line = re.sub(' +', ',', re.sub('([^() ]+)', r"'\1'", re.sub('([()])', r' \1 ', line).strip()))
line = eval(re.sub(r'\[X[1-9][0-9]*\]', '<DEL>', line.replace('(,', '(')))
print uncnf(line)