Class: TermExtraction::Zemanta
Instance Attribute Summary
#api_key, #context
Class Method Summary
collapse
Instance Method Summary
collapse
#canonical_name, #initialize
Constructor Details
This class inherits a constructor from TermExtraction
Class Method Details
.canonical_name ⇒ Object
30
31
32
|
# File 'lib/term_extraction/zemanta.rb', line 30
def canonical_name
'zemanta'
end
|
Instance Method Details
#post_params ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/term_extraction/zemanta.rb', line 19
def post_params
{
'method' =>'zemanta.suggest',
'api_key' => @api_key,
'return_images' => 0,
'text' => @context,
'format' => 'xml'
}
end
|
#terms ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/term_extraction/zemanta.rb', line 7
def terms
begin
Crack::XML.parse(remote_xml)['rsp']['keywords']['keyword'].map { |h| h['name'] }
rescue
[]
end
end
|
#uri ⇒ Object
15
16
17
|
# File 'lib/term_extraction/zemanta.rb', line 15
def uri
URI.parse(gateway)
end
|