##Installation
Install PostgreSQL using apt-get
sudo apt-get install postgresql
For PostgreSQL to work with Ruby, we need the client (application interface) library.
- git config --global user.name "User Name"
- git config --global user.email [email protected]
- initialize a git repository
require 'date' | |
Date.parse("November 17, 2014").strftime('%Y-%m-%d') | |
#=>"2014-11-17" | |
Date.parse("November 17, 2014").strftime('%y/%m/%d') | |
#=>"14/11/17" | |
# change the '-', '/' or use any separators |
Negotiation Tactic #1 – Is That Your Best Offer?
Negotiation Tactic #2 – Referencing an Expert Opinion
Negotiation Tactic #3 – Asking a Closed-Ended Question
Negotiation Tactic #4 – Asking an Open-Ended Question
Negotiation Tactic #5 – Concede Small
# http://www.icicletech.com/blog/web-scraping-with-ruby-using-mechanize-and-nokogiri-gems | |
require "mechanize" | |
url = ARGV[0] | |
fp = File.new("wikilinks.txt", "w") | |
agent = Mechanize.new { |agent| agent.user_agent_alias = "Mac Safari" } | |
html = agent.get(url).body |
6. Learning to Classify Text
Detecting patterns is a central part of Natural Language Processing. Words ending in -ed tend to be past tense verbs (5.). Frequent use of will is indicative of news text (3). These observable patterns — word structure and word frequency — happen to correlate with particular aspects of meaning, such as tense and topic. But how did we know where to start looking, which aspects of form to associate with which aspects of meaning?
The goal of this chapter is to answer the following questions:
How can we identify particular features of language data that are salient for classifying it? How can we construct models of language that can be used to perform language processing tasks automatically? What can we learn about language from these models?
"hello".gsub(/[aeiou]/, '*') #=> "h*ll*" | |
"hello".gsub(/([aeiou])/, '<\1>') #=> "h<e>ll<o>" | |
"hello".gsub(/./) {|s| s.ord.to_s + ' '} #=> "104 101 108 108 111 " | |
"hello".gsub(/(?<foo>[aeiou])/, '{\k<foo>}') #=> "h{e}ll{o}" | |
'hello'.gsub(/[eo]/, 'e' => 3, 'o' => '*') #=> "h3ll*" |
class ChangeValueTable_nameColumn_name < ActiveRecord::Migration | |
def up | |
db.update("UPDATE table_name SET column_name = 'new_value' WHERE party = 'old_value' ") | |
end | |
def down | |
# action to be done after completing the up , | |
# may be deleting the column after completing the values | |
end |