Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <groonga.h>
int
main(int argc, char **argv)
{
grn_ctx ctx;
grn_obj *db, *table, *column, *key_type, *value_type;
#include <stdio.h>
int main(){
printf("hello world!\n");
}
@naoa
naoa / wiki_page_import.php
Last active December 29, 2015 04:49
This script has the feature that import wikipedia page XML. %php wiki_page_import.php <database> <wiki_articles_xml_dir> <output_file>
<?php
$db = "localhost";
$db_name = $argv[1];
$table = "text";
$username = "mysql";
$password = "";
$article = $argv[2];
$output_file = $argv[3];
@naoa
naoa / wiki_fts_1.php
Last active December 29, 2015 05:09
This script has the feature that select full text search from line text in text_file. %php wiki_fts_1.php <database> <text_file> <output_file>
<?php
$db = "127.0.0.1";
$db_name = $argv[1];
$table = "text";
$index = "title,text";
$username = "mysql";
$password = "";
$category_file = $argv[2];
@naoa
naoa / index_dump.rb
Last active December 29, 2015 08:49
Groonga index dump
require "groonga"
database_path = ARGV[0]
ft_index = ARGV[1]
output_file = ARGV[2]
Groonga::Database.open(database_path)
index_column_name = "#{ft_index}.index"
index = Groonga[index_column_name]
index.table.open_cursor do |table_cursor|
index.open_cursor(table_cursor) do |cursor|
current_term_id = nil
@naoa
naoa / category_jpfw5.php
Last active December 30, 2015 12:19
This script has the feature that extract wikipedia japanese category . %php category_jpfw5.php <database> <output_file>
<?php
$db = "127.0.0.1";
$db_name = $argv[1];
$table = "category";
$username = "mysql";
$password = "";
$output_file = $argv[2];
@naoa
naoa / wiki_fts.php
Created December 8, 2013 10:29
This script has the feature that select full text phrase search from line text in text_file. %php wiki_fts.php <database> <text_file> <output_file>
<?php
$db = "127.0.0.1";
$db_name = $argv[1];
$table = "text";
$index = "title,text";
$username = "mysql";
$password = "";
$category_file = $argv[2];
@naoa
naoa / category_enals.php
Created December 8, 2013 10:32
This script has the feature that extract English wikipedia's category has only alphabets, digits, and spaces. %php category_enals.php<database> <output_file>
<?php
$db = "127.0.0.1";
$db_name = $argv[1];
$table = "category";
$username = "mysql";
$password = "";
$output_file = $argv[2];
@naoa
naoa / kanji-kana.php
Last active September 1, 2023 09:17
from kanji to katakana convert
<?php
$input_file = $argv[1];
if($argc >= 3){
$output_file = $argv[2];
}
else{
$output_file = "";
}
<?php
$input_file = $argv[1];
if($argc >= 3){
$output_file = $argv[2];
}
else{
$output_file = "";
}