Skip to content

Instantly share code, notes, and snippets.

@naoa
naoa / wn_morph.c
Created April 5, 2014 19:45
compile: gcc -I/usr/include/glib-2.0 -lglib-2.0 -lWN wn_morph.c -o wn_morph dependency:glib2 glib2-devel wordnet wordnet-devel
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <wn.h>
#define MAX_STRINGS 65535
#define MAX_BUF_NUM 4096
#define MAX_BUF_SIZE 255
int main(int argc, char *argv[])
{
@naoa
naoa / word2vec_server.py
Last active August 29, 2015 13:58
word2vec http server program %python word2vec_server.py <model_file_path> <port> cosine example client:curl "127.0.0.1:8000?c=test&n=10" analogy example client:curl "127.0.0.1:8000?pos=king%20woman&neg=man&n=10"
# coding=utf-8
import sys
import socket
import select
from urlparse import urlparse, parse_qs
import word2vec
argvs = sys.argv
port = 8000
<?php
$category_file = $argv[1];
$rc = 1;
$startTimeAll = microtime(true);
$fp = fopen($category_file, 'r');
while(!feof($fp)){
$line = fgets($fp);
<?php
$category_file = $argv[1];
$rc = 1;
$startTimeAll = microtime(true);
$fp = fopen($category_file, 'r');
while(!feof($fp)){
$line = fgets($fp);
<?php
$article = $argv[1];
if ($handle = opendir($article)) {
while (false !== ($file = readdir($handle))) {
echo "-------$file------\n";
echo "XML loading and importing...\n";
$xml = new XMLReader();
if(!$xml->open($article . "/" . $file)){
<?php
$article = $argv[1];
if ($handle = opendir($article)) {
while (false !== ($file = readdir($handle))) {
echo "-------$file------\n";
echo "XML loading and importing...\n";
$xml = new XMLReader();
if(!$xml->open($article . "/" . $file)){
2014-07-11T12:12:42.926168+00:00 app[run.7403]: Making all in ubuntu
2014-07-11T12:12:42.976663+00:00 app[run.7403]: make[4]: Nothing to be done for `all'.
2014-07-11T12:12:42.976647+00:00 app[run.7403]: make[4]: Entering directory `/app/groonga-4.0.3/packages/rpm/centos'
2014-07-11T12:12:43.008150+00:00 app[run.7403]: make[3]: Nothing to be done for `all'.
2014-07-11T12:12:42.976665+00:00 app[run.7403]: make[4]: Leaving directory `/app/groonga-4.0.3/packages/rpm/centos'
2014-07-11T12:12:42.978613+00:00 app[run.7403]: Making all in fedora
2014-07-11T12:12:42.993198+00:00 app[run.7403]: Making all in yum
2014-07-11T12:12:43.030222+00:00 app[run.7403]: Making all in patches
2014-07-11T12:12:43.009527+00:00 app[run.7403]: Making all in windows
<?php
$article = $argv[1];
$xml = new XMLReader();
if(!$xml->open($article)){
die('Failed to open file!');
}
$rc = 1;
<?php
$article = $argv[1];
$xml = new XMLReader();
if(!$xml->open($article)){
die('Failed to open file!');
}
$rc = 1;

オンラインインデックス構築

table_create Documents TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
column_create Documents content COLUMN_SCALAR Text
[[0,0.0,0.0],true]
table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram
[[0,0.0,0.0],true]
column_create Terms document_index COLUMN_INDEX|WITH_POSITION Documents content