philologic-client 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.rdoc +8 -0
- data/PhiloLogicResponseDocumentation.txt +86 -0
- data/README.rdoc +54 -32
- data/Rakefile +26 -0
- data/lib/philologic-client/bibliography.rb +60 -0
- data/lib/philologic-client/collocation.rb +61 -0
- data/lib/philologic-client/concordance.rb +39 -0
- data/lib/philologic-client/document.rb +65 -0
- data/lib/philologic-client/frequency.rb +57 -0
- data/lib/philologic-client/frequency_row.rb +67 -0
- data/lib/philologic-client/link.rb +37 -0
- data/lib/philologic-client/occurrence.rb +79 -0
- data/lib/philologic-client/response.rb +63 -0
- data/lib/philologic-client/version.rb +1 -1
- data/lib/philologic-client.rb +102 -286
- data/test/data/bibliography.html +182 -0
- data/test/data/collocation.html +2594 -0
- data/test/data/concordance.html +758 -0
- data/test/data/frequency.html +73 -0
- data/test/data/navigation.html +69 -0
- data/test/data/object.html +20 -0
- data/test/test_bibliography.rb +78 -0
- data/test/test_client.rb +861 -0
- data/test/test_collocation.rb +76 -0
- data/test/test_concordance.rb +83 -0
- data/test/test_document.rb +127 -0
- data/test/test_frequency.rb +78 -0
- data/test/test_occurrence.rb +66 -0
- data/test/test_response.rb +41 -0
- metadata +55 -36
- data/doc/PhiloLogicResponseTemplates.txt +0 -46
- data/test/data/collocation_links.html +0 -145
- data/test/data/collocation_sartre.html +0 -67
- data/test/data/doc_file.html +0 -396
- data/test/data/frequency_links.html +0 -145
- data/test/data/frequency_sartre.html +0 -67
- data/test/data/query_sartre.html +0 -151
- data/test/data/root_file.html +0 -1851
- data/test/test_philologic_client.rb +0 -558
- data/test/test_philologic_link.rb +0 -101
@@ -0,0 +1,73 @@
|
|
1
|
+
<head>
|
2
|
+
<title>shakespeare</title>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
4
|
+
</head>
|
5
|
+
<body >
|
6
|
+
|
7
|
+
<div class='philologic_response'>
|
8
|
+
<p class='status'>Frequency Table</p>
|
9
|
+
|
10
|
+
<table border="1" class="philologic_table">
|
11
|
+
<tr class='freq_header_row'><th class='freq_label_header'>title</th><th class='freq_value_header'>count</th></tr>
|
12
|
+
|
13
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=A+Midsummer+Night%27s+Dream'>A Midsummer Night's Dream</a></td><td class='freq_value'>30</td></tr>
|
14
|
+
|
15
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+First+Part+of+King+Henry+the+Fourth'>The First Part of King Henry the Fourth</a></td><td class='freq_value'>8</td></tr>
|
16
|
+
|
17
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Life+and+Death+of+King+John'>The Life and Death of King John</a></td><td class='freq_value'>7</td></tr>
|
18
|
+
|
19
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Third+Part+of+King+Henry+the+Sixth'>The Third Part of King Henry the Sixth</a></td><td class='freq_value'>5</td></tr>
|
20
|
+
|
21
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Timon+of+Athens'>Timon of Athens</a></td><td class='freq_value'>4</td></tr>
|
22
|
+
|
23
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Julius+Caesar'>Julius Caesar</a></td><td class='freq_value'>3</td></tr>
|
24
|
+
|
25
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Troilus+and+Cressida'>Troilus and Cressida</a></td><td class='freq_value'>3</td></tr>
|
26
|
+
|
27
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Tragedy+of+King+Richard+the+Second'>The Tragedy of King Richard the Second</a></td><td class='freq_value'>3</td></tr>
|
28
|
+
|
29
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Venus+and+Adonis'>Venus and Adonis</a></td><td class='freq_value'>3</td></tr>
|
30
|
+
|
31
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Love%27s+Labour%27s+Lost'>Love's Labour's Lost</a></td><td class='freq_value'>3</td></tr>
|
32
|
+
|
33
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Rape+of+Lucrece'>The Rape of Lucrece</a></td><td class='freq_value'>2</td></tr>
|
34
|
+
|
35
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=King+Lear'>King Lear</a></td><td class='freq_value'>2</td></tr>
|
36
|
+
|
37
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Titus+Andronicus'>Titus Andronicus</a></td><td class='freq_value'>2</td></tr>
|
38
|
+
|
39
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Life+of+King+Henry+the+Fifth'>The Life of King Henry the Fifth</a></td><td class='freq_value'>2</td></tr>
|
40
|
+
|
41
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=All%27s+Well+That+Ends+Well'>All's Well That Ends Well</a></td><td class='freq_value'>2</td></tr>
|
42
|
+
|
43
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Second+Part+of+King+Henry+the+Fourth'>The Second Part of King Henry the Fourth</a></td><td class='freq_value'>2</td></tr>
|
44
|
+
|
45
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Second+Part+of+King+Henry+the+Sixth'>The Second Part of King Henry the Sixth</a></td><td class='freq_value'>2</td></tr>
|
46
|
+
|
47
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Much+Ado+About+Nothing'>Much Ado About Nothing</a></td><td class='freq_value'>1</td></tr>
|
48
|
+
|
49
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Life+of+King+Henry+the+Eighth'>The Life of King Henry the Eighth</a></td><td class='freq_value'>1</td></tr>
|
50
|
+
|
51
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Coriolanus'>Coriolanus</a></td><td class='freq_value'>1</td></tr>
|
52
|
+
|
53
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+First+Part+of+King+Henry+the+Sixth'>The First Part of King Henry the Sixth</a></td><td class='freq_value'>1</td></tr>
|
54
|
+
|
55
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Antony+and+Cleopatra'>Antony and Cleopatra</a></td><td class='freq_value'>1</td></tr>
|
56
|
+
|
57
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=The+Merchant+of+Venice'>The Merchant of Venice</a></td><td class='freq_value'>1</td></tr>
|
58
|
+
|
59
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Twelfth+Night+or+What+You+Will'>Twelfth Night or What You Will</a></td><td class='freq_value'>1</td></tr>
|
60
|
+
|
61
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Measure+for+Measure'>Measure for Measure</a></td><td class='freq_value'>1</td></tr>
|
62
|
+
|
63
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Macbeth'>Macbeth</a></td><td class='freq_value'>1</td></tr>
|
64
|
+
|
65
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Two+Gentlemen+of+Verona'>Two Gentlemen of Verona</a></td><td class='freq_value'>1</td></tr>
|
66
|
+
|
67
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=Othello%2C+the+Moor+of+Venice'>Othello, the Moor of Venice</a></td><td class='freq_value'>1</td></tr>
|
68
|
+
|
69
|
+
<tr class='freq_row'><td class='freq_label'><a href='./?q=lion&title=As+You+Like+It'>As You Like It</a></td><td class='freq_value'>1</td></tr>
|
70
|
+
</table>
|
71
|
+
</div>
|
72
|
+
</body>
|
73
|
+
</html>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<head>
|
2
|
+
<title>shakespeare</title>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
4
|
+
</head>
|
5
|
+
<body >
|
6
|
+
|
7
|
+
<div class='philologic_response'>
|
8
|
+
<div class='philologic_cite'>
|
9
|
+
<span class='philologic_property' title='author'>William Shakespeare</span>, <i><span class='philologic_property' title='title'>The First Part of King Henry the Fourth</span></i></div>
|
10
|
+
<div class='philologic_navigation'>
|
11
|
+
|
12
|
+
|
13
|
+
<a href="./1/2"></a><br>
|
14
|
+
|
15
|
+
<a href="./1/2/1">Dramatis Personae</a><br>
|
16
|
+
|
17
|
+
<a href="./1/3">Act 1</a><br>
|
18
|
+
|
19
|
+
<a href="./1/3/2">Act 1, Scene 1</a><br>
|
20
|
+
|
21
|
+
<a href="./1/3/3">Act 1, Scene 2</a><br>
|
22
|
+
|
23
|
+
<a href="./1/3/4">Act 1, Scene 3</a><br>
|
24
|
+
|
25
|
+
<a href="./1/4">Act 2</a><br>
|
26
|
+
|
27
|
+
<a href="./1/4/2">Act 2, Scene 1</a><br>
|
28
|
+
|
29
|
+
<a href="./1/4/3">Act 2, Scene 2</a><br>
|
30
|
+
|
31
|
+
<a href="./1/4/4">Act 2, Scene 3</a><br>
|
32
|
+
|
33
|
+
<a href="./1/4/5">Act 2, Scene 4</a><br>
|
34
|
+
|
35
|
+
<a href="./1/5">Act 3</a><br>
|
36
|
+
|
37
|
+
<a href="./1/5/2">Act 3, Scene 1</a><br>
|
38
|
+
|
39
|
+
<a href="./1/5/3">Act 3, Scene 2</a><br>
|
40
|
+
|
41
|
+
<a href="./1/5/4">Act 3, Scene 3</a><br>
|
42
|
+
|
43
|
+
<a href="./1/6">Act 4</a><br>
|
44
|
+
|
45
|
+
<a href="./1/6/2">Act 4, Scene 1</a><br>
|
46
|
+
|
47
|
+
<a href="./1/6/3">Act 4, Scene 2</a><br>
|
48
|
+
|
49
|
+
<a href="./1/6/4">Act 4, Scene 3</a><br>
|
50
|
+
|
51
|
+
<a href="./1/6/5">Act 4, Scene 4</a><br>
|
52
|
+
|
53
|
+
<a href="./1/7">Act 5</a><br>
|
54
|
+
|
55
|
+
<a href="./1/7/2">Act 5, Scene 1</a><br>
|
56
|
+
|
57
|
+
<a href="./1/7/3">Act 5, Scene 2</a><br>
|
58
|
+
|
59
|
+
<a href="./1/7/4">Act 5, Scene 3</a><br>
|
60
|
+
|
61
|
+
<a href="./1/7/5">Act 5, Scene 4</a><br>
|
62
|
+
|
63
|
+
<a href="./1/7/6">Act 5, Scene 5</a><br>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
</body>
|
68
|
+
</html>
|
69
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<head>
|
2
|
+
<title>shakespeare</title>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
4
|
+
</head>
|
5
|
+
<body >
|
6
|
+
|
7
|
+
<div class='philologic_response'>
|
8
|
+
<div class='philologic_cite'>
|
9
|
+
<span class='philologic_property' title='author'>William Shakespeare</span>, <i><span class='philologic_property' title='title'>The First Part of King Henry the Fourth</span></i></div>
|
10
|
+
<div class='philologic_object'>
|
11
|
+
The First Part of King Henry the Fourth William Shakespeare Craig A. Berry, Martin Mueller, and Clifford Wulfman editors Jeffrey Cousens and Bill Parod technical editors Lawrence Berland, Hilary Bina, Katherine Gould, Kreg Segal, Nicholas Terrell editorial assistants
|
12
|
+
<p/> The WordHoard Shakespeare is a joint project of the Perseus Project at Tufts University, The Northwestern University Library, and Northwestern University Academic Technologies. It is derived from The Globe Shakespeare , the one-volume version of the Cambridge Shakespeare , edited by W. G. Clark, J. Glover, and W. A. Wright (1891-3). The Internet Shakespeare editions of the quartos and folios have been consulted to create a modern text that observes as closely as possible the morphological and prosodic practices of the earliest editions. Spellings, especially of contracted and hyphenated forms, have been standardized across the corpus. The text has been fully lemmatized and morphosyntactically tagged.
|
13
|
+
<p/> © 2003. The copyright to The WordHoard Shakespeare is owned jointly by Northwestern University and Tufts University. The WordHoard Shakespeare is provided for free solely for non-commercial use by students, scholars, and the public. Any commercial use or publication of it, in whole or in part, without prior written authorization of the copyright holders is strictly prohibited.
|
14
|
+
<p/> The Wordhoard Shakespeare is derived from, but not identical with, The Globe Shakespeare , the one-volume version of the Cambridge Shakespeare (1891-3) edited by W. G. Clark, J. Glover, and W. A. Wright.
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</body>
|
19
|
+
</html>
|
20
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
|
6
|
+
require 'philologic-client'
|
7
|
+
require 'test_response'
|
8
|
+
require 'test/unit'
|
9
|
+
|
10
|
+
|
11
|
+
class TestBibliography < TestResponse
|
12
|
+
|
13
|
+
def setup
|
14
|
+
super
|
15
|
+
@file = File.join( File.dirname(__FILE__), 'data', 'bibliography.html' )
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_initialization_with_nil_document
|
19
|
+
assert_raise(RuntimeError, 'nil document') { Philologic::Client::Bibliography.new(nil) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_initialization_with_empty_document
|
23
|
+
r = Philologic::Client::Bibliography.new(@doc)
|
24
|
+
assert_not_nil r
|
25
|
+
assert_kind_of Philologic::Client::Response, r
|
26
|
+
assert_kind_of Philologic::Client::Bibliography, r
|
27
|
+
assert_nil r.client
|
28
|
+
assert_nil r['author']
|
29
|
+
assert_nil r['title']
|
30
|
+
assert_kind_of Array, r.titles
|
31
|
+
assert_equal 0, r.titles.size
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_initialization_with_client
|
35
|
+
r = Philologic::Client::Bibliography.new( @doc, @client )
|
36
|
+
assert_not_nil r
|
37
|
+
assert_kind_of Philologic::Client::Response, r
|
38
|
+
assert_kind_of Philologic::Client::Bibliography, r
|
39
|
+
assert_not_nil r.client
|
40
|
+
assert_equal @client, r.client
|
41
|
+
assert_nil r['author']
|
42
|
+
assert_nil r['title']
|
43
|
+
assert_kind_of Array, r.titles
|
44
|
+
assert_equal 0, r.titles.size
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_with_sample_file
|
48
|
+
r = Philologic::Client::Bibliography.new( Nokogiri::HTML( open(@file).read, nil, @client.encoding ) )
|
49
|
+
assert_not_nil r
|
50
|
+
assert_kind_of Philologic::Client::Response, r
|
51
|
+
assert_kind_of Philologic::Client::Bibliography, r
|
52
|
+
assert_nil r.client
|
53
|
+
|
54
|
+
assert_nil r['author']
|
55
|
+
assert_nil r['title']
|
56
|
+
|
57
|
+
assert_kind_of Array, r.titles
|
58
|
+
assert_equal 42, r.titles.size
|
59
|
+
|
60
|
+
first = r.titles.first
|
61
|
+
assert_not_nil first
|
62
|
+
assert_kind_of Philologic::Client::Occurrence, first
|
63
|
+
assert_equal 'William Shakespeare', first['author']
|
64
|
+
assert_equal './1/0/0/0/0', first['href']
|
65
|
+
assert_equal 'The First Part of King Henry the Fourth', first['title']
|
66
|
+
assert_equal '', first['who']
|
67
|
+
|
68
|
+
last = r.titles.last
|
69
|
+
assert_not_nil last
|
70
|
+
assert_kind_of Philologic::Client::Occurrence, last
|
71
|
+
assert_equal 'William Shakespeare', last['author']
|
72
|
+
assert_equal './42/0/0/0/0', last['href']
|
73
|
+
assert_equal "The Winter's Tale", last['title']
|
74
|
+
assert_equal '', last['who']
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|