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
33
34
35
|
# File 'lib/term_extraction/zemanta.rb', line 33
def canonical_name
'zemanta'
end
|
Instance Method Details
#post_params ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/term_extraction/zemanta.rb', line 22
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
14
15
16
|
# File 'lib/term_extraction/zemanta.rb', line 7
def terms
terms = []
data = Nokogiri::XML.parse(remote_xml)
data.search('//name').each do |n|
terms << n.text
end
terms
end
|
#uri ⇒ Object
18
19
20
|
# File 'lib/term_extraction/zemanta.rb', line 18
def uri
Addressable::URI.parse(gateway)
end
|