ciyuan 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +32 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +21 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/ciyuan.gemspec +73 -0
- data/lib/ciyuan.rb +19 -0
- data/lib/ciyuan/character.rb +20 -0
- data/spec/ciyuan_spec.rb +9 -0
- data/spec/etymology.html +182 -0
- data/spec/spec_helper.rb +17 -0
- metadata +163 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem "nokogiri"
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "fakeweb"
|
10
|
+
gem "rspec", "~> 2.1.0"
|
11
|
+
gem "bundler", "~> 1.0.0"
|
12
|
+
gem "jeweler", "~> 1.5.1"
|
13
|
+
gem "rcov", ">= 0"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
fakeweb (1.3.0)
|
6
|
+
git (1.2.5)
|
7
|
+
jeweler (1.5.2)
|
8
|
+
bundler (~> 1.0.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
nokogiri (1.4.4)
|
12
|
+
rake (0.8.7)
|
13
|
+
rcov (0.9.9)
|
14
|
+
rspec (2.1.0)
|
15
|
+
rspec-core (~> 2.1.0)
|
16
|
+
rspec-expectations (~> 2.1.0)
|
17
|
+
rspec-mocks (~> 2.1.0)
|
18
|
+
rspec-core (2.1.0)
|
19
|
+
rspec-expectations (2.1.0)
|
20
|
+
diff-lcs (~> 1.1.2)
|
21
|
+
rspec-mocks (2.1.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
bundler (~> 1.0.0)
|
28
|
+
fakeweb
|
29
|
+
jeweler (~> 1.5.1)
|
30
|
+
nokogiri
|
31
|
+
rcov
|
32
|
+
rspec (~> 2.1.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Bastien Vaucher
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= ciyuan
|
2
|
+
|
3
|
+
Wrapper around Richard Sears Chinese etymology website ( http://www.internationalscientific.org/CharacterEtymology.aspx )
|
4
|
+
|
5
|
+
<code>Ciyuan.search("字").etymology => "Phonetic Signific, that which is performed in the house - writing, see 害冩"</code>
|
6
|
+
|
7
|
+
== Contributing to ciyuan
|
8
|
+
|
9
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
10
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
11
|
+
* Fork the project
|
12
|
+
* Start a feature/bugfix branch
|
13
|
+
* Commit and push until you are happy with your contribution
|
14
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
15
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
16
|
+
|
17
|
+
== Copyright
|
18
|
+
|
19
|
+
Copyright (c) 2011 Bastien Vaucher. See LICENSE.txt for
|
20
|
+
further details.
|
21
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "ciyuan"
|
16
|
+
gem.homepage = "http://github.com/bastien/ciyuan"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{Chinese Etymology}
|
19
|
+
gem.description = %Q{Wrapper around Richard Sears Chinese etymology website}
|
20
|
+
gem.email = "bastien.vaucher@gmail.com"
|
21
|
+
gem.authors = ["Bastien Vaucher"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "ciyuan #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/ciyuan.gemspec
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ciyuan}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Bastien Vaucher"]
|
12
|
+
s.date = %q{2011-03-27}
|
13
|
+
s.description = %q{Wrapper around Richard Sears Chinese etymology website}
|
14
|
+
s.email = %q{bastien.vaucher@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"ciyuan.gemspec",
|
29
|
+
"lib/ciyuan.rb",
|
30
|
+
"lib/ciyuan/character.rb",
|
31
|
+
"spec/ciyuan_spec.rb",
|
32
|
+
"spec/etymology.html",
|
33
|
+
"spec/spec_helper.rb"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/bastien/ciyuan}
|
36
|
+
s.licenses = ["MIT"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
39
|
+
s.summary = %q{Chinese Etymology}
|
40
|
+
s.test_files = [
|
41
|
+
"spec/ciyuan_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
51
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
|
53
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
55
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
58
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
59
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
62
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
63
|
+
end
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
66
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
67
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
68
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
70
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
data/lib/ciyuan.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'cgi'
|
4
|
+
require 'ciyuan/character'
|
5
|
+
|
6
|
+
module Ciyuan
|
7
|
+
|
8
|
+
BASE_URL = "http://www.internationalscientific.org/"
|
9
|
+
ETHY_PATH = "CharacterEtymology.aspx?characterInput="
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def search(character)
|
13
|
+
html = open("#{BASE_URL}#{ETHY_PATH}#{CGI::escape(character)}")
|
14
|
+
doc = Nokogiri::HTML(html.read)
|
15
|
+
doc.encoding = 'utf-8'
|
16
|
+
Character.new(doc)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Ciyuan
|
2
|
+
class Character
|
3
|
+
attr_accessor :etymology, :phonetic, :simplification, :english_explanation,
|
4
|
+
:seal_images, :lst_images, :bronze_images, :oracle_images
|
5
|
+
|
6
|
+
def initialize(doc, get_images=false)
|
7
|
+
@etymology = doc.search("#charEty").first.content
|
8
|
+
@phonetic = doc.search("#charPhon").first.content
|
9
|
+
@simplification = doc.search("#SimplificationMech").first.content
|
10
|
+
@english_explanation = doc.search("#EnglishExplanation").first.content
|
11
|
+
@unicode = doc.search("#SimplifiedUCS2Hex").first.content
|
12
|
+
if get_images
|
13
|
+
@seal_images = doc.search("#SealImages img").map{|element| File.join(BASE_URL,element.attribute("src"))}
|
14
|
+
@lst_images = doc.search("#LstImages img").map{|element| File.join(BASE_URL,element.attribute("src"))}
|
15
|
+
@bronze_images = doc.search("#BronzeImages img").map{|element| File.join(BASE_URL,element.attribute("src"))}
|
16
|
+
@oracle_images = doc.search("#OracleImages img").map{|element| File.join(BASE_URL,element.attribute("src"))}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/spec/ciyuan_spec.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ciyuan" do
|
4
|
+
it "should return the etymology of the chracter i provide" do
|
5
|
+
# $KCODE = 'UTF8'
|
6
|
+
chinese = [35299].pack("U*") # 解
|
7
|
+
Ciyuan.search(chinese).etymology.should match /.*break up.*/
|
8
|
+
end
|
9
|
+
end
|
data/spec/etymology.html
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC
|
2
|
+
"-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
6
|
+
<head>
|
7
|
+
<!-- Title -->
|
8
|
+
|
9
|
+
<!-- Change "/CharacterASP/" isp "" test -->
|
10
|
+
<p style="text-align: center">
|
11
|
+
<img alt="Chinese Etymology" height="45" src="ChineseEtymologyText.gif" width="290" />
|
12
|
+
</p>
|
13
|
+
|
14
|
+
<p style="color: red; text-align: center">
|
15
|
+
My web site was hacked, by a bad guy, but 汉字叔叔 is back
|
16
|
+
</p>
|
17
|
+
<!-- Request for money table -->
|
18
|
+
<table align="center" border="1">
|
19
|
+
<tr style="font-size: 10pt">
|
20
|
+
<td>
|
21
|
+
<img alt="Chinese Etymology" height="200" src="Richard_Sears_Head_Picture.gif" />
|
22
|
+
</td>
|
23
|
+
<td>
|
24
|
+
<p style="font-size: 10pt">
|
25
|
+
What you see here is the result of the past 20 years of my efforts
|
26
|
+
<br />
|
27
|
+
to make Chinese character etymology information available online.
|
28
|
+
<br />
|
29
|
+
Please donate so I can keep this information on line and updated.
|
30
|
+
<br />
|
31
|
+
All information is free and without advertisements.
|
32
|
+
<br />
|
33
|
+
(Thank you) (
|
34
|
+
<a href="why_study.aspx"
|
35
|
+
onmouseout="rollOut(this)"
|
36
|
+
onmouseover="rollIn(this)">
|
37
|
+
See my story </a>)
|
38
|
+
<br />
|
39
|
+
你在这里看到的是我过去20年努力工作的成果,<br />
|
40
|
+
目标是要把汉字的字源资料放在網際網路上,供大家使用。
|
41
|
+
<br />
|
42
|
+
请捐款,这样我就可以在线上保持提供,和及时更新这些资料。
|
43
|
+
<br />
|
44
|
+
这些资料是我免费提供的,而且没有广告干扰。<br />
|
45
|
+
(谢谢你)(<a href="why_study.aspx"
|
46
|
+
onmouseout="rollOut(this)"
|
47
|
+
onmouseover="rollIn(this)">
|
48
|
+
请看我的故事</a>)<br />
|
49
|
+
</p>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<form action="https://www.paypal.com/cgi-bin/webscr"
|
53
|
+
method="post">
|
54
|
+
<input type="hidden"
|
55
|
+
name="cmd"
|
56
|
+
value="_s-xclick"/>
|
57
|
+
<input type="image"
|
58
|
+
src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif"
|
59
|
+
name="submit"
|
60
|
+
alt="Make donations with PayPal - it's fast, free and secure!"/>
|
61
|
+
<img alt=""
|
62
|
+
src="https://www.paypal.com/en_US/i/scr/pixel.gif"
|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GFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjExMTUxMjU2MzZaMCMGCSqGSIb3DQEJBDEWBBSlcQS4Tpavo+EMz+2IBZYvlvxuejANBgkqhkiG9w0BAQEFAASBgB/M1BK19d0bWq5up+T4ElXKdjcTNuT/ELR2VnVp1iKaO158cX+TFehBAuNrLopENjiSkUIaIhu0tybTw3RxVS8v8D49KIcpDWmrIHJ0TNsH6/Z/Ml5oxUKu83A4bn+wpByf0iaM3C13baW9WaKwNJpbqyWTSwo/Q79nLU3tbnrK-----END PKCS7-----"/>
|
68
|
+
</form>
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table><title>
|
72
|
+
Etymology
|
73
|
+
</title><meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" /><meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE" /><meta content="JavaScript" name="vs_defaultClientScript" />
|
74
|
+
<script type="text/javascript" src="JScript1.js"></script>
|
75
|
+
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" /><meta http-equiv="Content-Type" content="text/html;CHARACTER=utf-8" /><meta content="Chinese etymology, oracle bones, oracle characters,
|
76
|
+
bronze characters, seal characters, ancient Chinese, archaic Chinese,
|
77
|
+
甲骨文, 金文, 篆体字, 篆體字, 古代文字, 文字来源, 甲骨文, 金文, 文字來源, 篆軆字, 字源, 词源, 古代文字, Richard Sears" name="keywords" /></head>
|
78
|
+
<body lang="ZH-CN" link="blue" vlink="#006600" style="background-color: #CCFFCC;
|
79
|
+
font-size: 10pt;
|
80
|
+
FONT-FAMILY:Arial">
|
81
|
+
|
82
|
+
<p>
|
83
|
+
</p>
|
84
|
+
|
85
|
+
<
|
86
|
+
|
87
|
+
<p style = "text-align:center">
|
88
|
+
Character Input:
|
89
|
+
<span id="testChar">解</span></p>
|
90
|
+
|
91
|
+
<table border="3"
|
92
|
+
cellpadding="8"
|
93
|
+
cellspacing="1"
|
94
|
+
width="85%"
|
95
|
+
align="center">
|
96
|
+
|
97
|
+
<!-- *** LEFT COLUMN *** -->
|
98
|
+
<tr><td style='vertical-align: text-top'>
|
99
|
+
|
100
|
+
Simplified (简体字):<br/>
|
101
|
+
Unicode :=
|
102
|
+
<span id="SimplifiedUCS2Hex"><a href=http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=89E3>89E3</a></span><br/>
|
103
|
+
GB2312-80 :=
|
104
|
+
<span id="SimplifiedGB0Hex">BDE2</span><br/>
|
105
|
+
<span id="SimplifiedChar" style="font-size: 1.5cm"><span class ="FontBig">解</span></span><br/><br/>
|
106
|
+
|
107
|
+
Traditional (繁軆字):<br/>
|
108
|
+
Unicode :=
|
109
|
+
<span id="TraditionalUCS2Hex"><a href=http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=89E3>89E3</a></span><br/>
|
110
|
+
Big5 :=
|
111
|
+
<span id="TraditionalB5Hex">B8D1</span><br/>
|
112
|
+
<span id="TraditionalChar" style="font-size: 1.5cm"><span class ="FontBig">解</span></span><br/>
|
113
|
+
</td>
|
114
|
+
|
115
|
+
<!-- *** MIDDLE COLLUMN *** -->
|
116
|
+
|
117
|
+
<td style='vertical-align: text-top'>
|
118
|
+
Phonetic (聲字部分):<br/>
|
119
|
+
<span id="charPhon">none</span><br/><br/>
|
120
|
+
|
121
|
+
Signific (有意部分):<br/>
|
122
|
+
<span id="charCog">角 jiao3 jue2 lu4 horn<br/> 刀 dao1 knife<br/> 牜牛 niu2 cow</span><br/><br/>
|
123
|
+
|
124
|
+
Etymology (文字來源):<br/>
|
125
|
+
<span id="charEty">Signific Cluster, the knife 刀 separates the cow 牛 and the horn 角 - break up - understand</span><br/><br/>
|
126
|
+
|
127
|
+
Simplification (简化方法):<br/>
|
128
|
+
<span id="SimplificationMech"> no simplification</span><br/><br/>
|
129
|
+
|
130
|
+
Cantonese (廣東話): <br/>
|
131
|
+
<span id="cantonesePro">gaai2 </span><br/><br/>
|
132
|
+
|
133
|
+
Taiwanese (台灣話): <br/>
|
134
|
+
<span id="Taiwanese"> <a href=CharacterSounds/Taiwanese/TaiMP3/k/kai2.mp3>kai2</a> <a href=CharacterSounds/Taiwanese/TaiMP3/k/ke2.mp3>ke2</a> <a href=CharacterSounds/Taiwanese/TaiMP3/k/ke3.mp3>ke3</a> <a href=CharacterSounds/Taiwanese/TaiMP3/k/koe2.mp3>koe2</a></span><br/><br/>
|
135
|
+
</td>
|
136
|
+
|
137
|
+
<!-- *** RIGHT COLUMN *** -->
|
138
|
+
<td width="40%" style='vertical-align: text-top'>
|
139
|
+
<span id="EnglishExplanation"> English Senses For (英文): <a href=CharacterSounds/Mandarin/j/jie3.mp3>jie3</a><br/>to unfasten / to untie / to loosen / to undo / to solve ( difficult problems, etc. ) / alternate 觧 / to explain / to clarify / to interpret / explanation / interpretation / to understand / ideas / views / to break up, separate or disperse / to take off / to strip / to remove ( clothing, etc. ) / to get rid of / to relieve / to alleviate ( pain, etc. ) / to cut apart / to dissect / to dissolve / to discharge ( water, etc. ) / to defecate<br/><br/> English Senses For (英文): <a href=CharacterSounds/Mandarin/j/jie4.mp3>jie4</a><br/>to escort ( prisoners, goods, etc. ) from one place to another / to forward / to send someone in custody to / to dispatch / alternate 觧<br/><br/> English Senses For (英文): <a href=CharacterSounds/Mandarin/x/xie4.mp3>xie4</a><br/>a Chinese family name / alternate 觧<br/><br/></span>
|
140
|
+
|
141
|
+
ShuoWen: (说文解字): <br/>
|
142
|
+
<span id="ShuoWen">判也從刀判牛角一曰解廌獸也</span><br/><br/>
|
143
|
+
|
144
|
+
Class:
|
145
|
+
<span id="cClass">traditional = simplified </span><br/>
|
146
|
+
<span id="OneNSimplified"></span><br/><br/>
|
147
|
+
|
148
|
+
<p style="color: red">
|
149
|
+
Input Single Cinese Character (單字):
|
150
|
+
</p>
|
151
|
+
|
152
|
+
<form action="CharacterEtymology.aspx"
|
153
|
+
method="get"
|
154
|
+
enctype="application/x-www-form-urlencoded">
|
155
|
+
<p style='TEXT-ALIGN:center'>
|
156
|
+
<input type="text"
|
157
|
+
size="1"
|
158
|
+
maxlength="1"
|
159
|
+
name="characterInput"
|
160
|
+
value=""/>
|
161
|
+
<input type="submit"
|
162
|
+
value="Etymology"
|
163
|
+
name="submitButton1"/></p>
|
164
|
+
</form>
|
165
|
+
</td>
|
166
|
+
</tr>
|
167
|
+
</table>
|
168
|
+
|
169
|
+
<!-- *** BOTTTOM CHARACTERS *** -->
|
170
|
+
<span id="SealImages"><table border="1" align="center"><caption><pre><br/>Seal (說文解字來的篆軆字) Characters <br/><br/></pre></caption><tr><td><img src=/CharacterImages/Seal/S00000/s03200/s03262.gif width=50 height=50 align=bottom hspace=20 border=0 > <tr><td>S03262 </table></span>
|
171
|
+
<span id="LstImages"><table border="1" align="center"><caption><pre><br/>LST Seal (六書通來的篆軆字) Characters <br/><br/></pre></caption><tr><td><img src=/CharacterImages/Lst/L30000/l34500/L34526.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34527.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34528.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34529.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34530.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34531.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34532.gif width=50 height=50 align=BOTTOM hspace=20 border=0 <tr/><tr><td>L34526 <td>L34527 <td>L34528 <td>L34529 <td>L34530 <td>L34531 <td>L34532<tr/><tr><td><img src=/CharacterImages/Lst/L30000/l34500/L34533.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34534.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34535.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L30000/l34500/L34536.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15063.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15064.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15065.gif width=50 height=50 align=BOTTOM hspace=20 border=0 <tr/><tr><td>L34533 <td>L34534 <td>L34535 <td>L34536 <td>L15063 <td>L15064 <td>L15065<tr/><tr><td><img src=/CharacterImages/Lst/L10000/l15000/L15066.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15067.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15068.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15069.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15070.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15071.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15072.gif width=50 height=50 align=BOTTOM hspace=20 border=0 <tr/><tr><td>L15066 <td>L15067 <td>L15068 <td>L15069 <td>L15070 <td>L15071 <td>L15072<tr/><tr><td><img src=/CharacterImages/Lst/L10000/l15000/L15073.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15074.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15075.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15076.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Lst/L10000/l15000/L15077.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <tr><td>L15073 <td>L15074 <td>L15075 <td>L15076 <td>L15077 </table></span>
|
172
|
+
<span id="BronzeImages"><table border="1" align="center"><caption><pre><br/>Bronze (金文编來的字) Characters <br/><br/></pre></caption><tr><td><img src=/CharacterImages/Bronze/B00000/b06400/b06415.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Bronze/B00000/b06400/b06416.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Bronze/B00000/b06400/b06417.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <td><img src=/CharacterImages/Bronze/B00000/b06400/b06418.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <tr><td>B06415 <td>B06416 <td>B06417 <td>B06418 </table></span>
|
173
|
+
<span id="OracleImages"><table border="1" align="center"><caption><pre><br/>Oracle (甲骨文编來的字) Characters <br/><br/></pre></caption><tr><td><img src=/CharacterImages/Oracle/J10000/j10700/j10784.gif width=50 height=50 align=BOTTOM hspace=20 border=0 > <tr><td>J10784 </table></span>
|
174
|
+
|
175
|
+
<p style='TEXT-ALIGN:center'>
|
176
|
+
<a style="TEXT-ALIGN: center" href="EtymologyHome2011.aspx">
|
177
|
+
Return to Home Page</a></p>
|
178
|
+
|
179
|
+
<p style="TEXT-ALIGN:center; color: red">
|
180
|
+
Copyright (c) 2003, 2008, 2010 Richard Sears</p>
|
181
|
+
</body>
|
182
|
+
</html>
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'ciyuan'
|
5
|
+
require 'fakeweb'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
|
13
|
+
end
|
14
|
+
FakeWeb.allow_net_connect = false
|
15
|
+
|
16
|
+
# http://www.internationalscientific.org/CharacterEtymology.aspx?characterInput=解
|
17
|
+
FakeWeb.register_uri(:get, "http://www.internationalscientific.org/CharacterEtymology.aspx?characterInput=%E8%A7%A3", :status => 201, :body => File.read(File.join(File.dirname(__FILE__), "etymology.html")))
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ciyuan
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Bastien Vaucher
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-03-27 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: nokogiri
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
prerelease: false
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: fakeweb
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
version: "0"
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 2
|
55
|
+
- 1
|
56
|
+
- 0
|
57
|
+
version: 2.1.0
|
58
|
+
type: :development
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: *id003
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: bundler
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 1
|
70
|
+
- 0
|
71
|
+
- 0
|
72
|
+
version: 1.0.0
|
73
|
+
type: :development
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: jeweler
|
78
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ~>
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 1
|
85
|
+
- 5
|
86
|
+
- 1
|
87
|
+
version: 1.5.1
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rcov
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
type: :development
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: *id006
|
104
|
+
description: Wrapper around Richard Sears Chinese etymology website
|
105
|
+
email: bastien.vaucher@gmail.com
|
106
|
+
executables: []
|
107
|
+
|
108
|
+
extensions: []
|
109
|
+
|
110
|
+
extra_rdoc_files:
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.rdoc
|
113
|
+
files:
|
114
|
+
- .document
|
115
|
+
- .rspec
|
116
|
+
- Gemfile
|
117
|
+
- Gemfile.lock
|
118
|
+
- LICENSE.txt
|
119
|
+
- README.rdoc
|
120
|
+
- Rakefile
|
121
|
+
- VERSION
|
122
|
+
- ciyuan.gemspec
|
123
|
+
- lib/ciyuan.rb
|
124
|
+
- lib/ciyuan/character.rb
|
125
|
+
- spec/ciyuan_spec.rb
|
126
|
+
- spec/etymology.html
|
127
|
+
- spec/spec_helper.rb
|
128
|
+
has_rdoc: true
|
129
|
+
homepage: http://github.com/bastien/ciyuan
|
130
|
+
licenses:
|
131
|
+
- MIT
|
132
|
+
post_install_message:
|
133
|
+
rdoc_options: []
|
134
|
+
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
hash: 2081661112841186539
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
version: "0"
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
154
|
+
requirements: []
|
155
|
+
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 1.3.7
|
158
|
+
signing_key:
|
159
|
+
specification_version: 3
|
160
|
+
summary: Chinese Etymology
|
161
|
+
test_files:
|
162
|
+
- spec/ciyuan_spec.rb
|
163
|
+
- spec/spec_helper.rb
|