Skip to content

Instantly share code, notes, and snippets.

View renaud's full-sized avatar

Renaud Richardet renaud

  • Eaternity
  • Lausanne, Switzerland
View GitHub Profile
@renaud
renaud / alchemy.rb
Created February 3, 2011 11:17
Using the Alchemy API in Ruby
require "AlchemyAPI.rb"
alchemyObj = AlchemyAPI.new();
alchemyObj.setAPIKey("########");
# Categorize some text.
result = alchemyObj.TextGetCategory("Latest on the War in Iraq.");
@renaud
renaud / JythonAE.java
Created December 23, 2011 09:25
UIMA Annotation Engine for Python, using Jython
@TypeCapability(inputs = { TypeSystem.TOKEN }, outputs = { TypeSystem.BIO_ENTITY_MENTION })
public class JythonAE extends JCasAnnotator_ImplBase {
public static final String SCRIPT_PATH = "script_path";
@ConfigurationParameter(name = SCRIPT_PATH)
private String scriptPath;
private PythonInterpreter interp;
private String scriptFile;
@renaud
renaud / test.py
Created December 23, 2011 09:54
Python test script for UIMA Jython Annotation Engine
# Python imports. for now, only Python std library is possible
import re
# importing Java packages
# see http://wiki.python.org/jython/UserGuide#accessing-java-from-jython
from org.apache.uima.jcas.tcas import Annotation
# jcas object is made available to this script. use it like any python object.
text = jcas.getDocumentText();
# onlineldavb.py: Package of functions for fitting Latent Dirichlet
# Allocation (LDA) with online variational Bayes (VB).
#
# Copyright (C) 2010 Matthew D. Hoffman
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@renaud
renaud / PowerLaw.java
Created August 23, 2012 13:46
provides power law selection
/*
* @(#)PowerLaw.java ver 1.2 6/20/2005
*
* Modified by Weishuai Yang (wyang@cs.binghamton.edu).
*
* this file is based on T J Finney's Manuscripts Simulation Tool, 2001
*/
import java.util.Random;
@renaud
renaud / AbreviationsTest.java
Created September 20, 2012 15:39
Getting started with SecondString (https://github.com/TeamCohen/secondstring) Acronym detection
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import com.wcohen.ss.abbvGapsHmm.Acronym;
import com.wcohen.ss.abbvGapsHmm.AlignmentPredictionModel;
public class AbreviationsTest {
public static void main(String[] args) throws IOException {
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.StopwordAnalyzerBase;
@renaud
renaud / gist:5433251
Created April 22, 2013 08:24
template maven
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.epfl.bbp.nlp</groupId>
<artifactId>blue_uima_parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name></name>
<description></description>
<!DOCTYPE html>
<html>
<head>
<title>Hellllo</title>
<style type="text/css">
html, body {
background-color:#000;
@renaud
renaud / Biostar45366.java
Last active December 20, 2015 01:49 — forked from lindenb/Biostar45366.java
OBO parser
package ch.epfl.bbp.nlp.obo;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;