code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module VotingsHelper end
Ruby
class Voting < ActiveRecord::Base end
Ruby
class VotingsController < ApplicationController # GET /votings # GET /votings.xml def index @votings = Voting.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @votings } end end # GET /votings/1 # GET /votings/1.xml def show @voting ...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full clas...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :votings map.resources :votings # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can as...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
# Be sure to restart your server when you modify this file # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.1...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# Be sure to restart your server when you modify this file. # These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveReco...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. Act...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying do debug a probl...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :positions # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module PositionsHelper end
Ruby
class Position < ActiveRecord::Base end
Ruby
class PositionsController < ApplicationController def index @positions = Position.paginate :page => params[:page], :order => 'id' respond_to do |format| format.html format.xml { render :xml => @positions } end end def show @position = Position.find(params[:id]) respond_to do |...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryPr...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
class CreatePositions < ActiveRecord::Migration def self.up create_table :positions do |t| t.string :woeid t.string :city t.float :lat t.float :long t.timestamps end end def self.down drop_table :positions end end
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Major.create(:name...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class ActiveSupport::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test da...
Ruby
task :upload_site do |t| sh %{webgen; scp -r output/* asb@rubyforge.org:/var/www/gforge-projects/ariel/;} end
Ruby
require 'rake' require 'spec/rake/spectask' Spec::Rake::SpecTask.new do |t| t.libs << "test" t.spec_files = FileList['./test/specs/*_spec.rb'] end Spec::Rake::SpecTask.new do |t| t.name = :spec_v t.libs << "test" t.libs << "lib" t.spec_files = FileList['./test/specs/*_spec.rb'] t.spec_opts=['--format', ...
Ruby
require 'ariel' require 'yaml' structure = Ariel::Node::Structure.new do |r| r.item :calculation do |c| c.item :result end end File.open('structure.yaml', 'w') do |file| YAML.dump structure, file end
Ruby
require 'ariel' require 'yaml' structure = Ariel::Node::Structure.new do |r| r.item :name r.item :current_version r.item :short_description r.item :category r.item :owner r.item :homepage r.item :license r.list :version_history do |v| v.list_item :version end end File.open('structure.yaml', 'wb'...
Ruby
spec = Gem::Specification.new do |s| s.name = 'ariel' s.version = '0.1.0' s.summary = 'A Ruby Information Extraction Library' s.description = %{Ariel uses machine learning to assist in extracting information from semi-structured documents including (but not in any way limited to) web pages} s.author = 'A. S....
Ruby
require 'ariel/log' require 'ariel/wildcards' require 'ariel/label_utils' require 'ariel/token' require 'ariel/tokenizer/default' require 'ariel/token_stream' require 'ariel/learner' require 'ariel/node/structure' require 'ariel/node/extracted' require 'ariel/rule' require 'ariel/rule_evaluation' require 'ariel/candida...
Ruby
module Ariel # A TokenStream instance stores a stream of Tokens once it has used its # tokenization rules to extract them from a string. A TokenStream knows its # current # position (TokenStream#cur_pos), which is incremented when any of the # Enumerable methods are used (due to the redefinition of TokenSt...
Ruby
module Ariel require 'set' # Implements a fairly standard separate and conquer rule learning system. # Using a list of labeled examples, candidate rules are generated. A rule is # refined until it covers as many as possible of the labeled examples. This # rule is recorded, the covered examples are removed a...
Ruby
require 'singleton' module Ariel # Very simple Log class. By default outputs to stdout and ignored messages # below :info level. Should probably get rid of the usage of Singleton as it's # used very little, with the classes eigenclass/singleton class used mostly # for the same purpose. Use Log.set_level to ...
Ruby
module Ariel # A set of methods for use when dealing with strings from labeled documents. module LabelUtils S_LABEL="<" E_LABEL=">" # Returns an array containing a pair of regular expressions to match a start # label tag and an end label tag. If the tag_contents is not modified the # regular e...
Ruby
module Ariel # Given an array of candidate Rules, and an array of LabeledStreams, # allows heuristics to be applied to select the ideal Rule. All refine_* instance # methods will remove candidates from the internal candidates array. class CandidateRefiner attr_accessor :candidates def initialize(can...
Ruby
require 'ariel/node' module Ariel # Each Node::Extracted has a name, a TokenStream and a structure which points to # the relevant Node::Structure. Skip straight to #search, #/ and #at for the # query interface. This is strongly recommended over using the built in method # accessors (a method isn't defined if ...
Ruby
require 'ariel/node' module Ariel # Implements a Node object used to represent the structure of the document # tree. Each node stores start and end rules to extract the desired content # from its parent node. Could be viewed as a rule-storing object. class Node::Structure < Node attr_accessor :ruleset, :n...
Ruby
module Ariel # Provides methods that read an example document, using a Node::Structure tree # to populate a tree of Nodes with each labeled example. class LabeledDocumentLoader class << self # As its first argument it takes a root Node::Structure to which any # learnt rules will be added. The...
Ruby
module Ariel # A rule contains an array of landmarks (each of which is an array of # individual landmark features. This landmark array is accessible through # Rule#landmarks. A Rule also has a direction :forward or :back, which # determines whether it is applied from the end or beginning of a tokenstream. cl...
Ruby
module Ariel::Tokenizer require 'enumerator' class Custom attr_accessor :re_labels, :re_wanted, :re_unwanted # Takes an array of regex for the wanted tokens, and array of regex for # the form that labeled tokens will take, and an array of regex for # unwanted tokens. def initialize(re_wante...
Ruby
require 'ariel/tokenizer/custom' module Ariel re_wanted = [ Wildcards.list[:html_tag], # Match html tags that don't have attributes /\d+/, # Match any numbers, probably good to make a split /\b\w+\b/, # Pick up words, will split at punctuation /\S/ # Grab any characters left over that aren't ...
Ruby
module Ariel # Contains all wildcards to be used in rule generation. class Wildcards @list = { :anything=>/.+/, :numeric=>/\d+/, :alpha_numeric=>/\w+/, :alpha=>/[[:alpha:]]+/, :capitalized=>/[[:upper:]]+\w+/, :all_caps=>/[[:upper:]]+/, :html_tag=>/<\/?\w...
Ruby
module Ariel # Tokens populate a TokenStream. They know their position in the original # document, can list the wildcards that match them and determine whether a # given string or wildcard is a valid match. During the process of parsing a # labeled document, some tokens may be marked as being a label_tag. Th...
Ruby
module Ariel class RuleEvaluation include Comparable attr_reader :rule, :score def initialize(rule, examples) @rule=rule @examples=examples evaluate rule end def <=>(rule_evaluation) self.score <=> rule_evaluation.score end def evaluate(rule) p_matches=@ex...
Ruby
module Ariel # A RuleSet acts as a container for a Node::Structure's start and end rules. # These are stored as an ordered array and are applied in turn until there is # a successful match. A RuleSet takes responsibility for applying start and # end rules to extract an Node::Extracted. class RuleSet def ...
Ruby
module Ariel # A generic Node object. As an end user, you have no need to use this. All # children are stored in a hash. #id and #type are undefined so they can be # used freely as part of a Node::Structure class Node removed_methods=[:id, :type] removed_methods.each {|meth| undef_method meth} attr...
Ruby
module Fixtures @@labeled_document = <<EOS Title: <l:title>The test of the Century</l:title> <l:content><b>Excerpt</b>: <i><l:excerpt>A look back at what could be considered the greatest ever test.</l:excerpt></i> <l:body>There was once a test designed to assess whether apply_extraction_tree_on worked.</l:body></l:co...
Ruby
######################################################################### # Copyright (C) Flavio Piccinelli 2012 <flavio.picci@gmail.com> ######################################################################### # Utils.rb # This file is part of "AriaAperta". # AriaAperta is free software: you can redistribute it ...
Ruby