Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char *
getfield (char *line, int num)
{
const char *tok;
for (tok = strtok (line, ",;\t");
tok && *tok; tok = strtok (NULL, ",\t;\n"))
#include <stdio.h>
int main (int argc, char *argv[]){
char str[1024];
FILE *f;
f =fopen(argv[1],"r");
if(f){
while (fscanf(f, "%s", str)!=EOF)
printf("%s\n",str);
HeapTuple CreateTuple(Relation r, int x, double y)
{
int i;
int yy = (int )y;
int natts = RelationGetDescr(r)->natts;
Datum* values = (Datum *) palloc(natts * sizeof(Datum));
bool* isnull = (bool *) palloc(natts * sizeof(bool));
values[0]=x;
@Khalefa
Khalefa / Test.java
Last active October 22, 2015 17:27
Trie.java
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.File;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.File;
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@Khalefa
Khalefa / textrank.py
Created November 1, 2015 17:26 — forked from igor-shevchenko/textrank.py
TextRank algorithm for text summarization.
from itertools import combinations
from nltk.tokenize import sent_tokenize, RegexpTokenizer
from nltk.stem.snowball import RussianStemmer
import networkx as nx
def similarity(s1, s2):
if not len(s1) or not len(s2):
return 0.0
return len(s1.intersection(s2))/(1.0 * (len(s1) + len(s2)))
package eg.edu.alexu.ehr;
public class Range {
int min;
int max;
public Range(int min, int max) {
this.min = Math.min(min, max);
this.max = Math.max(min, max);
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import org.coode.owlapi.owlxml.renderer.OWLXMLRenderer;//works
import org.coode.owlapi.rdf.rdfxml.RDFXMLRenderer;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.io.OWLObjectRenderer;
import org.semanticweb.owlapi.model.OWLObject;
@Khalefa
Khalefa / a.r
Created November 24, 2015 15:39
remove the dct
rm(list=ls())
removeXQuantile<-function(data, x){
tmp<-sort(abs(data$b));
v<-tmp[x*length(tmp)/100];
data$b[abs(data$b)<=v]=0;
data<-data[data$b!=0,];
return(data);
}