Skip to content

Instantly share code, notes, and snippets.

View siahr's full-sized avatar

Toshio HIRAI siahr

  • Infinite Corporation
  • Japan
View GitHub Profile
@siahr
siahr / WN4P.php
Created February 3, 2012 11:04
日本語WordNetの辞書(SQLite3)から同義語を取り出す。
<?php
/**
* WN4P: To access the Japanese WordNet thesaurus dictionary.
*
* @package Sugina
* @copyright Copyright 2012, Toshio HIRAI <toshio.hirai@gmail.com>
* @license http://opensource.org/licenses/BSD-3-Clause The BSD License
*
*/
/*
@siahr
siahr / TokenUtil.php
Created February 18, 2012 03:24
Token Utilities
<?php
/**
* Token Utilities class
*
* The part of this PHP code is based on the product of BaseX Team.
* https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/util/Token.java
*
* @package Sugina
* @author BaseX Team 2005-12, BSD License
* @author Christian Gruen
@siahr
siahr / EnglishStemmer.php
Created February 18, 2012 03:25
English Stemmer
<?php
/**
* English stemming algorithm, based on the publication from
* Porter (1980), "An algorithm for suffix stripping".
*
* This PHP code is based on the product of BaseX Team.
* https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/util/ft/EnglishStemmer.java
*
* @package Sugina
* @author BaseX Team 2005-12, BSD License
@siahr
siahr / append_nodeid.xq
Created February 18, 2012 05:44
Adds additional attribute to each element on BaseX. (use db:node-id() function)
declare function local:appendId($node as node()) {
typeswitch($node)
case $doc as document-node()
return document
{for $d in $doc/node() return local:appendId($d)}
default
return element
{node-name($node)}
{attribute node-id {db:node-id($node)}, $node/@*,
for $child in $node/node() return
@siahr
siahr / gist:6864957
Last active December 24, 2015 21:19
Reset form
var resetForm = function() {
$('input, textarea, select').not('input[type="radio"], input[type="checkbox"], :hidden, :button, :submit, :reset').val('');
$('input[type="checkbox"]').removeAttr('checked');
var r = [];
var v = [];
$('input[type=\"radio\"]').each(function(){
var name = $(this).attr("name");
if ($.inArray(name, r) < 0) {
r.push(name);
v.push($(this).val());
@siahr
siahr / JapaneseTokenizer.java
Created March 25, 2015 09:13
Japanese lexer using bi-gram (experimental).
package org.basex.util.ft;
import static org.basex.util.Token.*;
import static org.basex.util.ft.FTFlag.*;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
import org.basex.util.*;