Skip to content

Instantly share code, notes, and snippets.

import strutils
import tables
import math
import language_model
import os
import osproc
import subexes
type
TKorpus = enum k1600_1650, k1650_1700, k1700_1750, k1750_1800, k1800_1850, k1850_1900, k1900_2010
@reactormonk
reactormonk / hash.rb
Created December 14, 2011 10:54 — forked from madsheep/hash.rb
Hardcore deep hash
class Hash
define_method '[]_with_try_on', do |*args|
if args.size == 1 and respond_to?(args.first)
send(:'[]_with_try_on', args.first)
else
args.inject(self.dup){|memo, e| memo.dup.delete(e) if memo.is_a?(Hash) }
end
end
class B12 < Thor
desc "write", "write data into the index"
method_option :methods, :desc => "The methods to call on each RawData", :type => :array
def write(methods)
end
end
# call: thor b12:write --methods=foo
# result: "write" was called incorrectly. Call as "thor b12:write".
DT-GRAM GERMAN CONFIG (1.0)
ROOTCAT CP.
FILES .
LEXENTRIES (DT-GRAM GERMAN).
RULES (DT-GRAM GERMAN).
TEMPLATES (DT-GRAM GERMAN).
GOVERNABLERELATIONS SUBJ OBJ
SEMANTICFUNCTIONS .
NONDISTRIBUTIVES NUM PERS.
EPSILON e.
IO.popen('cat') do |io|
io.puts("foobar")
io.close_write
puts io.gets
end
require 'bundler'
require 'ostruct'
Bundler.require
# Load the "model".
#
require File.expand_path 'card', File.dirname(__FILE__)
set :haml, { :format => :html5 }
module FastChoice
class Choice
include Comparable
INTERESSTING = 0.2
def initialize(element, action)
@element, @action = element, action
self.score = 0.0
end
attr_reader :value, :action
attr_accessor :score
suite "Plain Ruby", :use => :basic_verifications do
setup do
@a = 1
@b = 2
@result = 3
@type = Integer
end
exercise "Adding 1 and 2" do
@a + @b
Concurrency Level: 10
Complete requests: 10000
Total transferred: 530000 bytes
HTML transferred: 130000 bytes
Requests per second: 3599.29 [#/sec] (mean)
Time per request: 2.778 [ms] (mean)
Time per request: 0.278 [ms] (mean, across all concurrent requests)
Transfer rate: 186.29 [Kbytes/sec] received
Connection Times (ms)
suite "Expert II - Shared verifies" do
shared do
verify "is a numeric" do
kind_of Numeric
end
end
shared do
exercise "mod 2" do