Skip to content

Instantly share code, notes, and snippets.

View eiennohito's full-sized avatar

Arseny Tolmachev eiennohito

  • Hakuhodo Technologies
  • Osaka, Japan
View GitHub Profile
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using CompilerLib.Syntax;
namespace CompilerLib.Lexical.RE {
class REParser {
private static Grammar g;
def renderExample(exs: ExampleForSelection, word: WordRecord): Future[JValue] = {
val ex = exs.ex
def selected: Future[Boolean] = {
val res = word.reading.is.exists { rd => ex.contains(rd) } ||
word.writing.is.exists { wr => ex.contains(wr) }
if (res) Promise.successful(true)
else {
val f = (root ? ParseSentence(ex)).mapTo[ParsedQuery]
f map (lst => {
lst.inner.exists { je => word.writing.is.exists { wr => je.dictForm.equals(wr) }}
/*
* Copyright 2012 eiennohito
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
class OtherTest extends FreeSpec with ShouldMatchers {
"asd" - {
"dgs" in {
//BridJ.register(classOf[mecab.Tagger])
val byte = Pointer.allocateByte()
byte.set(0.toByte)
val t = MecabLibrary.mecab_new2(byte)
val str = "私はバカです"
val bytes = str.getBytes("UTF-8")
// Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include <memory>
#include <functional>
#include <type_traits>
def transformMrData(in: Iterable[JValue]) = {
import scalaz._
import Scalaz._
//val ids = (in \\ "_id").
implicit val formats = DefaultFormats
def inner(in: JValue) = {
//Extraction.extract[List[HiLvl]](in)
val id = field[String]("_id")(in) map( new ObjectId(_) )
val mp = field[Map[String, List[Double]]]("value")(in) map {o => o.map{
case (i, j) => i.toInt -> j.map(_.toInt)
@eiennohito
eiennohito / taglist.coffee
Created January 4, 2013 09:43
Жесть с депенденси инжекшном и кучей магии
$ = jQuery
module = angular.module('kotonoha', [])
module.directive 'tagop', ->
restrict: 'A'
require: "^taglist"
link: (scope, elem, attrs, taglist) ->
obj = scope.obj
inner =
$ = jQuery
module = angular.module('taglist', [])
module.directive 'tagop', ->
restrict: 'C'
require: "^taglist"
link: (scope, elem, attrs, taglist) ->
obj = scope.obj
inner =
(function() {
var $, module;
$ = jQuery;
module = angular.module('taglist', []);
module.directive('tagop', function() {
return {
restrict: 'C',
$scope.tagNfo = [
{ group: 'User tags', tags: [
{ name: 'tag1', descr: 'tag number 1, a great tag'}
{ name: 'n', descr: 'Regular noun (Futsuumeishi — 普通名詞)'}
]},
{ group: 'System tags', tags: [
{ name: 'exp', descr: 'Expression'}
{ name: '4j', descr: 'Yojijukugo'}
]},
{ group: "Test tags", tags: [