treat 0.2.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/TODO +3 -0
  2. data/lib/economist/hungarys_troubles.txt +46 -0
  3. data/lib/economist/indias_slowdown.txt +15 -0
  4. data/lib/economist/merkozy_rides_again.txt +24 -0
  5. data/lib/economist/prada_is_not_walmart.txt +9 -0
  6. data/lib/ferret/_11.cfs +0 -0
  7. data/lib/ferret/_14.cfs +0 -0
  8. data/lib/ferret/_p.cfs +0 -0
  9. data/lib/ferret/_s.cfs +0 -0
  10. data/lib/ferret/_v.cfs +0 -0
  11. data/lib/ferret/_y.cfs +0 -0
  12. data/lib/ferret/segments +0 -0
  13. data/lib/ferret/segments_15 +0 -0
  14. data/lib/treat/buildable.rb +10 -4
  15. data/lib/treat/categories.rb +2 -1
  16. data/lib/treat/delegatable.rb +2 -1
  17. data/lib/treat/doable.rb +3 -2
  18. data/lib/treat/entities/collection.rb +2 -9
  19. data/lib/treat/entities/entity.rb +13 -14
  20. data/lib/treat/entities.rb +5 -4
  21. data/lib/treat/extractors/coreferences/stanford.rb +1 -0
  22. data/lib/treat/extractors/topic_words/lda.rb +2 -15
  23. data/lib/treat/formatters/readers/autoselect.rb +0 -1
  24. data/lib/treat/formatters/unserializers/yaml.rb +2 -0
  25. data/lib/treat/formatters.rb +0 -7
  26. data/lib/treat/group.rb +4 -2
  27. data/lib/treat/languages/english.rb +1 -1
  28. data/lib/treat/lexicalizers/tag/brill.rb +17 -15
  29. data/lib/treat/lexicalizers/tag/lingua.rb +11 -6
  30. data/lib/treat/lexicalizers/tag/stanford.rb +28 -36
  31. data/lib/treat/lexicalizers.rb +1 -2
  32. data/lib/treat/processors/parsers/enju.rb +7 -5
  33. data/lib/treat/processors/parsers/stanford.rb +3 -1
  34. data/lib/treat/retrievers/indexers/ferret.rb +28 -0
  35. data/lib/treat/retrievers/searchers/ferret.rb +53 -0
  36. data/lib/treat/retrievers.rb +17 -0
  37. data/lib/treat/visitable.rb +1 -1
  38. data/lib/treat.rb +17 -16
  39. metadata +50 -30
  40. data/lib/economist/hose_and_dry.doc +0 -0
  41. data/lib/economist/hungarys_troubles.abw +0 -70
  42. data/lib/economist/republican_nomination.pdf +0 -0
  43. data/lib/economist/saving_the_euro.odt +0 -0
  44. data/lib/economist/zero_sum.html +0 -91
  45. data/lib/treat/lexicalizers/tag/tagger.rb +0 -29
@@ -32,12 +32,14 @@ module Treat
32
32
  # Parse the entity into its syntactical phrases using Enju.
33
33
  # Calls #build to initiate XML parsing.
34
34
  def self.parse(entity, options = {})
35
+ val = entity.to_s
36
+ entity.remove_all! if entity.has_children?
35
37
  options[:processes] ||= 1
36
38
  @@options = options
37
39
  @@id_table = {}
38
40
  @@dependencies_table = {}
39
41
  stdin, stdout = proc
40
- text, remove_last = valid_text(entity)
42
+ text, remove_last = valid_text(val)
41
43
  stdin.puts(text + "\n")
42
44
  parsed = build(stdout.gets, remove_last)
43
45
  if not parsed.nil?
@@ -123,13 +125,13 @@ module Treat
123
125
  current_element
124
126
  end
125
127
  # Validate a text - Enju wants period to parse a sentence.
126
- def self.valid_text(entity)
127
- if entity.to_s.count('.') == 0
128
+ def self.valid_text(val)
129
+ if val.count('.') == 0
128
130
  remove_last = true
129
- text = entity.to_s + '.'
131
+ text = val + '.'
130
132
  else
131
133
  remove_last = false
132
- text = entity.to_s.gsub('.', '')
134
+ text = val.gsub('.', '')
133
135
  text += '.' unless ['!', '?'].include?(text[-1])
134
136
  end
135
137
  return text, remove_last
@@ -17,6 +17,8 @@ module Treat
17
17
  # - (String) :log_to_file => a filename to log output to
18
18
  # instead of displaying it.
19
19
  def self.parse(entity, options = {})
20
+ val = entity.to_s
21
+ entity.remove_all! if entity.has_children?
20
22
  options = DefaultOptions.merge(options)
21
23
  lang = entity.language
22
24
  StanfordCoreNLP.use(lang)
@@ -41,7 +43,7 @@ module Treat
41
43
  ::StanfordCoreNLP.load(
42
44
  :tokenize, :ssplit, :pos, :lemma, :parse
43
45
  )
44
- text = ::StanfordCoreNLP::Text.new(entity.to_s)
46
+ text = ::StanfordCoreNLP::Text.new(val)
45
47
  @@parser[lang].annotate(text)
46
48
 
47
49
  text.get(:sentences).each do |s|
@@ -0,0 +1,28 @@
1
+ module Treat
2
+ module Retrievers
3
+ module Indexers
4
+ class Ferret
5
+ silence_warnings { require 'ferret' }
6
+ require 'find'
7
+ require 'fileutils'
8
+ # Create a Ferret index for the collection and
9
+ # store the path to the index under "folder."
10
+ def self.index(collection, options = {})
11
+ path = "#{collection.folder}/.index"
12
+ FileUtils.mkdir(path) unless File.readable?(path)
13
+ index = ::Ferret::Index::Index.new(
14
+ :default_field => 'content',
15
+ :path => path
16
+ )
17
+ collection.each_document do |doc|
18
+ index.add_document(
19
+ :file => doc.file,
20
+ :content => doc.to_s
21
+ )
22
+ end
23
+ path
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,53 @@
1
+ module Treat
2
+ module Retrievers
3
+ module Searchers
4
+ class Ferret
5
+ silence_warnings { require 'ferret' }
6
+ require 'find'
7
+ DefaultOptions = {
8
+ :q => nil,
9
+ :limit => :all,
10
+ :callback => nil
11
+ }
12
+ # Returns an array of retrieved documents.
13
+ #
14
+ # Options:
15
+ #
16
+ # - (String) :q => a search query.
17
+ # - (Symbol) :limit => number of documents.
18
+ def self.search(collection, options = {})
19
+ options = DefaultOptions.merge(options)
20
+ unless collection.has?(:index) && collection.index
21
+ raise Treat::Exception, 'This collection has not been indexed.'
22
+ end
23
+ unless options[:q]
24
+ raise Treat::Exception,
25
+ 'You must set a query by using the :q option.'
26
+ end
27
+ path = "#{collection.folder}/.index"
28
+ unless File.readable?(path)
29
+ raise Treat::Exception, "The index at location #{path} cannot be found."
30
+ end
31
+ index = ::Ferret::Index::Index.new(
32
+ :default_field => 'content',
33
+ :path => path
34
+ )
35
+ query = options.delete(:q)
36
+ files = {}
37
+ index.search_each(query, options) do |doc, score|
38
+ files[index[doc]['file']] = score
39
+ end
40
+ docs = []
41
+ files.each do |doc, score|
42
+ doc2 = collection.document_with_file(doc)
43
+ if options[:callback]
44
+ options[:callback].call(doc2, score)
45
+ end
46
+ docs << doc2
47
+ end
48
+ docs
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,17 @@
1
+ module Treat
2
+ module Retrievers
3
+ module Indexers
4
+ extend Group
5
+ self.type = :annotator
6
+ self.targets = [:collection]
7
+ self.default = :ferret
8
+ end
9
+ module Searchers
10
+ extend Group
11
+ self.type = :computer
12
+ self.targets = [:entity]
13
+ self.default = :ferret
14
+ end
15
+ extend Treat::Category
16
+ end
17
+ end
@@ -20,7 +20,7 @@ module Treat
20
20
  return klass.send(method, self, options)
21
21
  end
22
22
  else
23
- raise NAT::Exception,
23
+ raise Treat::Exception,
24
24
  "This type of visitor cannot visit a #{self.class}."
25
25
  end
26
26
  end
data/lib/treat.rb CHANGED
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # Main namespace for Treat modules.
3
2
  #
4
3
  # === Entities
@@ -10,21 +9,22 @@
10
9
  #
11
10
  # Here are some example of how to create entities:
12
11
  #
12
+ # Treat.sweeten!
13
+ #
13
14
  # c = Collection 'folder_with_documents'
14
- # d = Document 'filename.txt' # (or pdf, html, xml, doc, abw, odt, png, jpg, jpeg, gif).
15
+ # d = Document 'filename.txt'
15
16
  # p = Paragraph 'A short story. The end.'
16
17
  # s = Sentence 'That is not a sentence.'
17
18
  # w = Word 'fox'
18
19
  #
19
20
  # Here is a list of entities and their description:
20
21
  #
21
- # - A Collection represents a folder with different textual documents.
22
- # - A Document represents a file with a textual content.
23
- # - A Section represents a logical subdivision of a document.
24
- # - A Zone can be a Title, a Paragraph or a List and represents an intra-section division of content.
25
- # - A Sentence represents just that.
26
- # - A Constituent can be a Phrase or a Clause and represents a syntactical unit.
27
- # - A Token can be a Word, a Number, a Punctuation or a Symbol (non-punctuation, non-alphanumeric characters).
22
+ # - A Collection represents a folder with different textual documents.
23
+ # - A Document represents a file with a textual content.
24
+ # - A Zone can be a Section, Title, a Paragraph or a List and represents an intra-section division of content.
25
+ # - A Sentence represents just that.
26
+ # - A Phrase is a group of words; a Sentence is a Phrase with a sentence ender (.!?)
27
+ # - A Token can be a Word, a Number, a Punctuation or a Symbol (non-punctuation, non-alphanumeric character).
28
28
  #
29
29
  # === Functions
30
30
  #
@@ -35,11 +35,12 @@
35
35
  #
36
36
  # Here are the different Categories and their description:
37
37
  #
38
- # - Processors perform the building of tree of entities representing texts (chunking, segmenting, tokenizing, parsing).
39
- # - Lexicalizers give lexical information about words (synsets, semantic relationships, tag, word category).
40
- # - Extractors extract semantic information about an entity (topic, date, time, named entity).
41
- # - Inflectors allow to retrieve the different inflections of a word (declensors, conjugators, stemmers, lemmatizers).
42
- # - Formatters handle the conversion of entities to and from different formats (readers, serializers, unserializers, visualizers).
38
+ # - Processors perform the building of tree of entities representing texts (chunking, segmenting, tokenizing, parsing).
39
+ # - Lexicalizers give lexical information about words (synsets, semantic relationships, tag, word category).
40
+ # - Extractors extract semantic information about an entity (topic, date, time, named entity).
41
+ # - Inflectors allow to retrieve the different inflections of a word (declensors, conjugators, stemmers, lemmatizers).
42
+ # - Formatters handle the conversion of entities to and from different formats (readers, serializers, unserializers, visualizers).
43
+ # - Retrievers allow to index and search collections of documents.
43
44
  #
44
45
  # === Linguistic Resources
45
46
  #
@@ -59,9 +60,9 @@ module Treat
59
60
  end
60
61
 
61
62
  # The current version of Treat.
62
- VERSION = "0.2.0"
63
+ VERSION = "0.2.5"
63
64
 
64
- # $LOAD_PATH << '/ruby/gems/treat/lib/' # Remove for release
65
+ #$LOAD_PATH << '/ruby/gems/treat/lib/' # Remove for release
65
66
 
66
67
  # Create class variables for the Treat module.
67
68
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-06 00:00:00.000000000 Z
12
+ date: 2012-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rjb
16
- requirement: &70310096172480 !ruby/object:Gem::Requirement
16
+ requirement: &70201865896920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70310096172480
24
+ version_requirements: *70201865896920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: zip
27
- requirement: &70310096171240 !ruby/object:Gem::Requirement
27
+ requirement: &70201865895740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70310096171240
35
+ version_requirements: *70201865895740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hpricot
38
- requirement: &70310096170020 !ruby/object:Gem::Requirement
38
+ requirement: &70201865893800 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70310096170020
46
+ version_requirements: *70201865893800
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &70310096168860 !ruby/object:Gem::Requirement
49
+ requirement: &70201865892000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70310096168860
57
+ version_requirements: *70201865892000
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: psych
60
- requirement: &70310096166960 !ruby/object:Gem::Requirement
60
+ requirement: &70201865889880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70310096166960
68
+ version_requirements: *70201865889880
69
+ - !ruby/object:Gem::Dependency
70
+ name: ferret
71
+ requirement: &70201865888620 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *70201865888620
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: whatlanguage
71
- requirement: &70310096163460 !ruby/object:Gem::Requirement
82
+ requirement: &70201865887460 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *70310096163460
90
+ version_requirements: *70201865887460
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: linguistics
82
- requirement: &70310096159580 !ruby/object:Gem::Requirement
93
+ requirement: &70201865886480 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '0'
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *70310096159580
101
+ version_requirements: *70201865886480
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: stanford-core-nlp
93
- requirement: &70310096158080 !ruby/object:Gem::Requirement
104
+ requirement: &70201865885300 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *70310096158080
112
+ version_requirements: *70201865885300
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: punkt-segmenter
104
- requirement: &70310096156900 !ruby/object:Gem::Requirement
115
+ requirement: &70201865883560 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: '0'
110
121
  type: :runtime
111
122
  prerelease: false
112
- version_requirements: *70310096156900
123
+ version_requirements: *70201865883560
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: lda-ruby
115
- requirement: &70310096155740 !ruby/object:Gem::Requirement
126
+ requirement: &70201865882040 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ! '>='
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: '0'
121
132
  type: :runtime
122
133
  prerelease: false
123
- version_requirements: *70310096155740
134
+ version_requirements: *70201865882040
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: chronic
126
- requirement: &70310096154280 !ruby/object:Gem::Requirement
137
+ requirement: &70201865880540 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - ! '>='
@@ -131,7 +142,7 @@ dependencies:
131
142
  version: '0'
132
143
  type: :runtime
133
144
  prerelease: false
134
- version_requirements: *70310096154280
145
+ version_requirements: *70201865880540
135
146
  description: ! ' Treat is a toolkit for text retrieval, information extraction and
136
147
  natural language processing. '
137
148
  email:
@@ -141,12 +152,19 @@ extensions: []
141
152
  extra_rdoc_files: []
142
153
  files:
143
154
  - lib/economist/half_cocked_basel.txt
144
- - lib/economist/hose_and_dry.doc
145
- - lib/economist/hungarys_troubles.abw
146
- - lib/economist/republican_nomination.pdf
147
- - lib/economist/saving_the_euro.odt
155
+ - lib/economist/hungarys_troubles.txt
156
+ - lib/economist/indias_slowdown.txt
157
+ - lib/economist/merkozy_rides_again.txt
158
+ - lib/economist/prada_is_not_walmart.txt
148
159
  - lib/economist/to_infinity_and_beyond.txt
149
- - lib/economist/zero_sum.html
160
+ - lib/ferret/_11.cfs
161
+ - lib/ferret/_14.cfs
162
+ - lib/ferret/_p.cfs
163
+ - lib/ferret/_s.cfs
164
+ - lib/ferret/_v.cfs
165
+ - lib/ferret/_y.cfs
166
+ - lib/ferret/segments
167
+ - lib/ferret/segments_15
150
168
  - lib/treat/buildable.rb
151
169
  - lib/treat/categories.rb
152
170
  - lib/treat/category.rb
@@ -240,7 +258,6 @@ files:
240
258
  - lib/treat/lexicalizers/tag/brill.rb
241
259
  - lib/treat/lexicalizers/tag/lingua.rb
242
260
  - lib/treat/lexicalizers/tag/stanford.rb
243
- - lib/treat/lexicalizers/tag/tagger.rb
244
261
  - lib/treat/lexicalizers.rb
245
262
  - lib/treat/object.rb
246
263
  - lib/treat/processors/chunkers/txt.rb
@@ -269,6 +286,9 @@ files:
269
286
  - lib/treat/processors.rb
270
287
  - lib/treat/proxies.rb
271
288
  - lib/treat/registrable.rb
289
+ - lib/treat/retrievers/indexers/ferret.rb
290
+ - lib/treat/retrievers/searchers/ferret.rb
291
+ - lib/treat/retrievers.rb
272
292
  - lib/treat/sugar.rb
273
293
  - lib/treat/tree.rb
274
294
  - lib/treat/viewable.rb
Binary file
@@ -1,70 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE abiword PUBLIC "-//ABISOURCE//DTD AWML 1.0 Strict//EN" "http://www.abisource.com/awml.dtd">
3
- <abiword template="false" styles="unlocked" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:math="http://www.w3.org/1998/Math/MathML" xid-max="47" xmlns:dc="http://purl.org/dc/elements/1.1/" fileformat="1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:awml="http://www.abisource.com/awml.dtd" xmlns="http://www.abisource.com/awml.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" version="0.99.2" xml:space="preserve" props="dom-dir:ltr; document-footnote-restart-section:0; document-endnote-type:numeric; document-endnote-place-enddoc:1; document-endnote-initial:1; lang:en-US; document-endnote-restart-section:0; document-footnote-restart-page:0; document-footnote-type:numeric; document-footnote-initial:1; document-endnote-place-endsection:0">
4
- <!-- ======================================================================== -->
5
- <!-- This file is an AbiWord document. -->
6
- <!-- AbiWord is a free, Open Source word processor. -->
7
- <!-- More information about AbiWord is available at http://www.abisource.com/ -->
8
- <!-- You should not edit this file by hand. -->
9
- <!-- ======================================================================== -->
10
-
11
- <metadata>
12
- <m key="dc.format">application/x-abiword</m>
13
- <m key="abiword.generator">AbiWord</m>
14
- </metadata>
15
- <history version="1" edit-time="49" last-saved="1327547309" uid="e83e3112-47ca-11e1-8326-faa5dd588a80">
16
- <version id="1" started="1327547309" uid="0575e6ee-47cb-11e1-8326-faa5dd588a80" auto="0" top-xid="47"/>
17
- </history>
18
- <styles>
19
- <s type="P" name="Normal" followedby="Current Settings" props="font-family:Times New Roman; margin-top:0pt; color:000000; margin-left:0pt; text-position:normal; widows:2; font-style:normal; text-indent:0in; font-variant:normal; margin-right:0pt; lang:en-US; line-height:1.0; font-size:12pt; text-decoration:none; margin-bottom:0pt; font-weight:normal; bgcolor:transparent; text-align:left; font-stretch:normal"/>
20
- </styles>
21
- <pagesize pagetype="Letter" orientation="portrait" width="8.500000" height="11.000000" units="in" page-scale="1.000000"/>
22
- <section xid="46" props="page-margin-footer:0.5in; page-margin-header:0.5in">
23
- <p style="Normal" xid="47" props="text-align:left; dom-dir:ltr">Hungary's troubles</p>
24
- <p style="Normal" xid="1" props="text-align:left; dom-dir:ltr">Not just a rap on the knuckles</p>
25
- <p style="Normal" xid="2" props="text-align:left; dom-dir:ltr"></p>
26
- <p style="Normal" xid="3" props="text-align:left; dom-dir:ltr">THE pressure is piling up on the beleaguered Hungarian government. Today the European Commission threatened it with legal action over several new "cardinal" laws that would require a two-thirds majority in parliament to overturn.</p>
27
- <p style="Normal" xid="4" props="text-align:left; dom-dir:ltr"></p>
28
- <p style="Normal" xid="5" props="text-align:left; dom-dir:ltr">The commission is still considering the laws, but today it highlighted concerns over three issues:</p>
29
- <p style="Normal" xid="6" props="text-align:left; dom-dir:ltr"></p>
30
- <p style="Normal" xid="7" props="text-align:left; dom-dir:ltr"> - The independence of the central bank. Late last year the Hungarian parliament passed a law which expands the monetary council and takes the power to nominate deputies away from the governor and hands it to the prime minister. A separate law opens the door to a merger between the bank and the financial regulator.</p>
31
- <p style="Normal" xid="8" props="text-align:left; dom-dir:ltr"></p>
32
- <p style="Normal" xid="9" props="text-align:left; dom-dir:ltr"> - The judiciary. More than 200 judges over the age of 62 have been forced into retirement and hundreds more face the sack. The new National Judicial Authority is headed by Tünde Handó, a friend of the family of Viktor Orban, the prime minister.</p>
33
- <p style="Normal" xid="10" props="text-align:left; dom-dir:ltr"></p>
34
- <p style="Normal" xid="11" props="text-align:left; dom-dir:ltr"> - The independence of the national data authority.</p>
35
- <p style="Normal" xid="12" props="text-align:left; dom-dir:ltr"></p>
36
- <p style="Normal" xid="13" props="text-align:left; dom-dir:ltr">That wasn't all the commission had to say today. Hungary also received a ticking-off from Olli Rehn (pictured), the economic-affairs commissioner, for not doing enough to tackle its budget deficit. It may now lose access to EU funds.</p>
37
- <p style="Normal" xid="14" props="text-align:left; dom-dir:ltr"></p>
38
- <p style="Normal" xid="15" props="text-align:left; dom-dir:ltr">Slammed in Brussels, the Hungarian government is also under pressure at home. Earlier this week Gordon Bajnai, who served as Socialist prime minister from 2009-10, fired off a broadside that sent shockwaves through the political and media establishments.</p>
39
- <p style="Normal" xid="16" props="text-align:left; dom-dir:ltr"></p>
40
- <p style="Normal" xid="17" props="text-align:left; dom-dir:ltr">After a year and a half of government by the right-wing Fidesz party, wrote Mr Bajnai in a lengthy article on the website of the Patriotism and Progress Public Policy Foundation, democracy has been destroyed in Hungary. The country, he warned, is scarred by division and is drifting towards bankruptcy and away from Europe.</p>
41
- <p style="Normal" xid="18" props="text-align:left; dom-dir:ltr"></p>
42
- <p style="Normal" xid="19" props="text-align:left; dom-dir:ltr">Mr Bajnai called for a radical change of government and a complete political re-orientation. “A new government must have a programme readily at hand that can be applied without delay: a programme that promotes the republic, reconciliation, and recovery.” </p>
43
- <p style="Normal" xid="20" props="text-align:left; dom-dir:ltr"></p>
44
- <p style="Normal" xid="21" props="text-align:left; dom-dir:ltr">Fidesz is rattled by Mr Bajnai, who since leaving office has been teaching at Columbia University in New York. Understandably so. He headed a technocratic administration which stabilised the economy. Unlike his Socialist predecessor, Ferenc Gyurcsany, he was neither part of the old Communist elite nor connected to it by marriage, and so cannot be smeared as a "Komcsi". He is modern in outlook and well regarded internationally.</p>
45
- <p style="Normal" xid="22" props="text-align:left; dom-dir:ltr"></p>
46
- <p style="Normal" xid="23" props="text-align:left; dom-dir:ltr">Moreover, say those how know him, Mr Bajnai has little patience for the narcissistic exceptionalism that shapes Fidesz’s worldview. Exhibit A: the plaintive cry of Janos Martonyi, the foreign minister, who lamented recently: “The world will never understand our pains and spiritual wounds.” Such self-pity is unlikely to endear the Hungarian government to Brussels or Washington DC (to where it has sent an envoy this week to negotiate with the IMF).</p>
47
- <p style="Normal" xid="24" props="text-align:left; dom-dir:ltr"></p>
48
- <p style="Normal" xid="25" props="text-align:left; dom-dir:ltr">Fidesz won a two-thirds majority in 2010. But its support is evaporating, and analysts say there is a gap in the political market for a centrist pro-business party committed to democratic norms. Mr Bajnai, who has not ruled out a return to politics, would be an obvious candidate to lead it.</p>
49
- <p style="Normal" xid="26" props="text-align:left; dom-dir:ltr"></p>
50
- <p style="Normal" xid="27" props="text-align:left; dom-dir:ltr">Meanwhile, as Hungarians watch the value of their assets vaporise, in large part thanks to the government’s increasingly erratic policies, Mr Orban smirks his way through press conferences. Here he is dodging questions from a reporter from HVG, an economics weekly, about his responsibility for the crisis and trying to shift the blame to his old enemy Andras Simor, president of the central bank. The interview ran as follows:</p>
51
- <p style="Normal" xid="28" props="text-align:left; dom-dir:ltr"></p>
52
- <p style="Normal" xid="29" props="text-align:left; dom-dir:ltr">hvg.hu: Do you feel responsible for the falling/weakening forint?</p>
53
- <p style="Normal" xid="30" props="text-align:left; dom-dir:ltr"></p>
54
- <p style="Normal" xid="31" props="text-align:left; dom-dir:ltr">Mr Orban: You mean the president of the central bank? He did not comment on it.</p>
55
- <p style="Normal" xid="32" props="text-align:left; dom-dir:ltr"></p>
56
- <p style="Normal" xid="33" props="text-align:left; dom-dir:ltr">hvg.hu: No, you, Mr prime minister!</p>
57
- <p style="Normal" xid="34" props="text-align:left; dom-dir:ltr"></p>
58
- <p style="Normal" xid="35" props="text-align:left; dom-dir:ltr">Mr Orban: The personal responsibility of the president of the central bank was not discussed over the meeting.</p>
59
- <p style="Normal" xid="36" props="text-align:left; dom-dir:ltr"></p>
60
- <p style="Normal" xid="37" props="text-align:left; dom-dir:ltr">hvg.hu: You, your personal…!</p>
61
- <p style="Normal" xid="38" props="text-align:left; dom-dir:ltr"></p>
62
- <p style="Normal" xid="39" props="text-align:left; dom-dir:ltr">Mr Orban: That neither.</p>
63
- <p style="Normal" xid="40" props="text-align:left; dom-dir:ltr"></p>
64
- <p style="Normal" xid="41" props="text-align:left; dom-dir:ltr">Surrounded by yes-men and grinning flunkies, Mr Orban seems increasingly out of touch. His future will likely be decided not in the gilded corridors of the Hungarian parliament, but in Brussels and Washington DC.</p>
65
- <p style="Normal" xid="42" props="text-align:left; dom-dir:ltr"></p>
66
- <p style="Normal" xid="43" props="text-align:left; dom-dir:ltr">What happens next? If his hand is forced Mr Orban can probably endure policy reversals on the independence of the central bank and the data ombudsman. Sorry, he would say to his loyal followers: national crisis, what can you do.</p>
67
- <p style="Normal" xid="44" props="text-align:left; dom-dir:ltr"></p>
68
- <p style="Normal" xid="45" props="text-align:left; dom-dir:ltr">The dismantling of the judiciary would be another matter. If outsiders keep up the pressure and the judicial changes are judged to be in breach of the EU treaty, Mr Orban would be in a tricky spot. It’s hard to see how he could declare the 200-plus judges his government has forced into retirement ready for office after all, and still sit in his own.</p>
69
- </section>
70
- </abiword>
Binary file
@@ -1,91 +0,0 @@
1
- <!DOCTYPE html>
2
- <html class="no-flash" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" xmlns:fb="http://www.facebook.com/2008/fbml">
3
-
4
- <head>
5
- <title>Trade: The zero-sum president</title>
6
- </head>
7
-
8
- <body class="not-front not-logged-in page-node node-type-mtblog one-sidebar sidebar-right world-menu business-menu economics-menu printedition-menu science-technology-menu culture-menu">
9
- <div id="fb-root"></div>
10
- <div id="page" class="container">
11
- <a name="top" id="navigation-top"></a>
12
-
13
- <div id="leaderboard" class="clearfix">
14
- <div id="block-ec_ads-leaderboard_ad" class="block block-ec_ads">
15
- <div class="content clearfix">
16
- <div id="leaderboard-ad"><!-- Site: Commerce. Zone: Opinion | Blogs/Free Exchange | --> <script language="JavaScript" type="text/javascript">document.write('<script language="JavaScript" src="//ad.doubleclick.net/adj/teg.lasn/blo6;subs=n;wsub=n;sdn=n;dcopt=ist;pos=ldr_top;sz=728x90;tile=1;ord=' + random_ad_nr + '?" type="text/javascript"><\/script>')</script><noscript><a href="//ad.doubleclick.net/jump/teg.lasn/blo6;subs=n;wsub=n;sdn=n;dcopt=ist;pos=ldr_top;sz=728x90;tile=1;ord=595534706?"><img src="//ad.doubleclick.net/ad/teg.lasn/blo6;subs=n;wsub=n;sdn=n;dcopt=ist;pos=ldr_top;sz=728x90;tile=1;ord=595534706?" width="728" height="90" border="0" alt=""></a></noscript></div> </div>
17
- </div><div id="block-ec_ads-subscription_ad" class="block block-ec_ads">
18
- <div class="content clearfix">
19
- <div id="subslug-ad"><!-- Site: Commerce. Zone: Opinion | Blogs/Free Exchange | --> <script language="JavaScript" type="text/javascript">document.write('<a href="//ad.doubleclick.net/jump/teg.lasn/blo6;subs=n;wsub=n;sdn=n;pos=sub_top;sz=223x90;tile=2;ord=' + random_ad_nr + '?" target="_self"><img src="//ad.doubleclick.net/ad/teg.lasn/blo6;subs=n;wsub=n;sdn=n;pos=sub_top;sz=223x90;tile=2;ord=' + random_ad_nr + '?"><\/a>')</script><noscript><a href="//ad.doubleclick.net/jump/teg.lasn/blo6;subs=n;wsub=n;sdn=n;pos=sub_top;sz=223x90;tile=2;ord=595534706?"><img src="//ad.doubleclick.net/ad/teg.lasn/blo6;subs=n;wsub=n;sdn=n;pos=sub_top;sz=223x90;tile=2;ord=595534706?" width="223" height="90" border="0" alt=""></a></noscript></div> </div>
20
- </div> </div>
21
-
22
-
23
- <div id="header" class="clearfix">
24
-
25
- <div id="header-topstripe" class="clearfix">
26
- <div id="header-logo">
27
- <h2><a href="/"><img src="//media.economist.com/sites/all/themes/econfinal/images/the-economist-logo.gif" alt="The Economist" /></a></h2>
28
- </div>
29
-
30
- <div id="header-main">
31
-
32
- </div><!-- /#header-links -->
33
-
34
- <div id="header-timestamp" class="clearfix">
35
- Wednesday January 25th 2012 </div><!-- /#header-timestamp -->
36
-
37
- <div id="header-title-search" class="clearfix">
38
-
39
-
40
- <div id="header-search" class="clearfix">
41
- <form action="/blogs/freeexchange/2012/01/trade" accept-charset="UTF-8" method="post" id="search-theme-form">
42
- <div><div id="search" class="container-inline">
43
- <div class="form-item clearfix" id="edit-search-theme-form-1-wrapper">
44
- <label for="edit-search-theme-form-1">Search this site:</label>
45
- <input type="text" maxlength="128" name="search_theme_form" id="edit-search-theme-form-1" size="15" value="" title="Enter the terms you wish to search for." class="form-text search-field" placeholder="Search" />
46
- </div>
47
- <input type="submit" name="op" id="edit-submit-1" value="Search" class="form-submit" />
48
- <input type="hidden" name="form_build_id" id="form-95221799fc500ba9ac651bab969c1a14" value="form-95221799fc500ba9ac651bab969c1a14" />
49
- <input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form" />
50
- </div>
51
-
52
- </div></form>
53
- </div><!-- /#header-search -->
54
-
55
- </div><!-- /#header-title-search -->
56
-
57
- </div><!-- /#header-main -->
58
- </div><!-- /#header-topstripe -->
59
-
60
- </div> <!-- /#header -->
61
-
62
-
63
- <div id="columns" class="clearfix">
64
- <div id="column-content" class="grid-10 grid-first clearfix">
65
- <!-- Create left column on search pages -->
66
- <div class="node-blog-tpl" class="clearfix">
67
- <div class="blog-title freeexchange">
68
- <img class="imagefield imagefield-field_blog_logo" width="50" height="50" alt="" src="http://media.economist.com/sites/default/files/BlogFreeEx.jpg?1274391686" /> <div class="blog-post-header">
69
- <h2>Economics</h4>
70
- <span><a href="/blogs/freeexchange">Free exchange</a></span>
71
- </div>
72
- </div>
73
- <h1 class="ec-blog-fly-title">Trade</h1>
74
- <h3 class="ec-blog-headline">
75
- The zero-sum president </h3>
76
- <p class="ec-blog-info">
77
- Jan 25th 2012, 9:31 by R.A. | LONDON </p>
78
- <div id="block-ec_components-share_inline_header" class="block block-ec_components">
79
- <div class="content clearfix">
80
- <div class="share_inline_header"><ul class="clearfix"><li class="share-inline-header-facebook first" data-ec-omniture-frame="top_fb"><fb:like href="http://www.economist.com/blogs/freeexchange/2012/01/trade" send="false" layout="button_count" show_faces="false" font=""></fb:like></li>
81
- <li class="share-inline-header-twitter even last" data-ec-omniture-frame="top_twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-related="theeconomist" data-url="http://econ.st/AC5wZo" data-counturl="http://www.economist.com/blogs/freeexchange/2012/01/trade">Tweet</a></li>
82
- </ul></div> </div>
83
- </div>
84
- <div class="ec-blog-body">
85
- <p>STATE of the Union addresses tend to be long, winding affairs, filled with a grab bag of policy ideas that will altenatively appeal to and irk people across the political spectrum. Barack Obama's <a href="http://www.telegraph.co.uk/news/worldnews/barackobama/9037296/State-of-the-Union-speech-2012-speech-in-full.html">latest address</a> had plenty of sensible ideas in it: tax reform, including reductions in corporate rates; more spending and accountability on education and infrastructure investment; streamlining of the regulatory environment; and so on. He led off, however, with a call for a reshoring of manufacturing jobs seemingly calculated to cost him <em>The Economist</em>'s endorsement. Granted, annoying <em>The Economist</em> is, almost definitionally, good politics. For a president whose hallmark has been soaring orations promising hope, however, Mr Obama's take on the global economy is strikingly bleak and depressing.</p><p>The president was not so unreasonable as to suggest that the American economy could recapture all of its lost manufacturing jobs. Nor was he wrong to point out that countries like China have used direct subsidies, financial shenanigans and currency manipulation to give their exporters a leg up. Yet at no point did he attempt to justify the unstated assumption that what America ought really to do is develop an economy like China's—a place, recall, scarcely one-sixth as rich as America, riddled with potentially debilitating economic imbalances, and governed by an unaccountable monopoly of a communist party. Perhaps more distressing, he implied in several places that the reason to become more like China was that only by doing so could America <em>defeat</em> China, and others, at economics. Consider the line:</p><blockquote><p>Our workers are the most productive on Earth, and if the playing field is level, I promise you – America will always win.</p></blockquote><p>Leaving others, one is forced to conclude, to lose—not once, not occasionally, but <em>always</em>. And what is likely to be the outcome of unending defeat? Destitution? Are we to hope that other countries are left with no gainful employment opportunities at all? If that means dreadful poverty, then Mr Obama ought to be dragged before an international tribunal. But maybe it's not so bad, in which case we have to wonder why it's so damned important to "win" whatever contest it is we're having. Is the implication that it's possible to get by all right, to not be poor, without having lots of demanding manufacturing jobs? That doesn't sound so bad, actually; are we sure America doesn't want to sign up for that? Of course, if this is the nature of economic activity, and if America is determined to defeat other countries, it's worth asking whether it wouldn't make sense to deliberately <em>sabotage</em> other places, or bomb them; after all, it's hard to lose to a country whose people are dead. On the other hand, if victory is so important, we might expect other countries to retaliate, or preemptively attack. Maybe it would be better if the world divided itself into two competing but fairly isolated factions locked in a sort of "cold war".</p><p>Later, the president added:</p><blockquote><p>Don’t let other countries win the race for the future.</p></blockquote><p>The context, innocuously enough, was in calling for greater support for American research and development efforts. But the language of this statement is either daft or ghastly, depending on how charitably one is willing to read it. Is Mr Obama so dense as to miss that when America invents things other countries benefit, and vice versa? If a German discovers a cure for cancer, shouldn't we be ecstatic about that, rather than angry? Indeed, shouldn't we be quite happy and interested in ensuring that Germans and Britons and Indians have the capability and opportunity to develop fantastic new technologies? In the more nefarious reading, Mr Obama seems to accept that only relative standing really matters. A sick, poor world in which America always triumphs is preferable in all cases to one in which America maybe doesn't "win" the race to discover every last little thing that's out there to be discovered. And hell, one has to ask again whether the easiest way to prevent other countries from winning the race for the future isn't simply to blow up their labs.</p><p>Look, I understand the forgiving interpretation of these remarks. Americans are motivated by competition and patriotism, and if that's the only way to rally the country behind fundamentally sound policies like subsidies for basic research, then that's the card you play. And, in practice, Mr Obama's reforms will probably not do much more than offset the crummy, mercantilist choices made by other governments elsewhere. No one is talking about going back to the early 19th century, or to the days of communist containment.</p><p>I don't see that that's an acceptable excuse. People who live outside of America are people just like Americans, and we should all rejoice in their rising prosperity, the more so when it occurs through additions to the stock of human knowledge that will benefit people everywhere. If an American president can't communicate that simple idea to his citizenry, out of fear that he'll be drummed out of office on a wave of nationalistic outrage, then he doesn't deserve to be president and his country doesn't deserve to win a damned thing, least of all the right to call itself "exceptional", a beacon of hope and freedom. A zero-sum world is a world <em>without</em> hope, and if Mr Obama is convinced that's what we're in then I don't see much need for him to stick around.</p> </div>
86
-
87
- </div> <!-- /#columns -->
88
-
89
- </div> <!-- /#page -->
90
- </body>
91
- </html>