Skip to content

Instantly share code, notes, and snippets.

View renaud's full-sized avatar

Renaud Richardet renaud

  • Eaternity
  • Lausanne, Switzerland
View GitHub Profile
# 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 / 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 / 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;
@renaud
renaud / 1_ReferencesClassifier2.java
Last active December 22, 2015 19:39
Mallet MaxEnt classifier for paper references
package ch.epfl.bbp.uima.projects.references;
import static cc.mallet.pipe.iterator.FileIterator.LAST_DIRECTORY;
import static com.google.common.collect.Lists.newArrayList;
import static java.util.regex.Pattern.compile;
import static org.apache.commons.lang.StringUtils.join;
import static org.slf4j.LoggerFactory.getLogger;
import java.io.File;
import java.io.FileFilter;
@renaud
renaud / migrate_to_uimaFIT_2.sh
Created September 27, 2013 09:57
shell commands to ease the migration to uimaFIT version 2
#!/bin/sh
############################################
# MAKE SURE TO BACKUP YOUR FILES FIRST
############################################
# see http://uima.apache.org/d/uimafit-2.0.0/tools.uimafit.book.html#d5e617
#Change of package names:
find . -name '*.java' -print | xargs perl -p -i -e 's/org.uimafit/org.apache.uima.fit/g'