hello,

i'm not a programmer, but as a feature request: is there someone, who can develop (maybe one of the developers that did the opencalais or alchemy module) another submodule, that supports http://www.tagthe.net/?

if it's advanced: how much would be the bounty?

thanks momper

Comments

momper’s picture

nobody?

eugenmayer’s picture

I can of course implement tagthe net for a fee - iam just waiting for others jumping in just implementing it for free - if any. Contact me using the contact form if you wont find help here

extralooping’s picture

Version: 6.x-2.5 » 6.x-3.2

here is a simple module adding tagthe.net suggestions:

//mostly borrowed from autotgging_tagthenet.module
define(TAGTHENET_URL, 'http://tagthe.net/api/');

function tagging_tagthenet_tagging_suggestions($vid, $node) {
  $url = TAGTHENET_URL;
  $data = 'text='. urlencode($node->body);
  $response = drupal_http_request($url .'?'. $data, array(), 'POST');
  if ($response->code != 200) {
    watchdog('tagging_suggestions_tagthenet', 'Received response code '. $response->code .' from Tagthe.net', WATCHDOG_SEVERE);
    return array();
  }
  $xml = $response->data;
 dpm($xml);
  $dom = DOMDocument::loadXML($xml);
  $xp = new DOMXPath($dom);
  $dims = $xp->evaluate("/memes/meme/dim");
  
  $terms = Array();
  for ($i = 0; $i < $dims->length; $i++) {
	$dim = $dims->item($i);
	if($dim->getAttribute("type")=='language') continue;
	
	$terms_existing = taxonomy_get_tree($vid);
	
	$items = $xp->evaluate("item", $dim);
	for ($j = 0; $j < $items->length; $j++) {
		$item = $items->item($j);
		$term = Array();
		$term['#name'] = $item->nodeValue;
		if(!taxonomy_get_term_by_name($term['#name']))  $term['#new'] = TRUE;
		$terms[] = $term;
	}
  }
  dpm($terms);
  return $terms;
}

eugenmayer’s picture

Could you please create a patch? This would be go in as a submodule anyway. Beside that:
- remove dpm
- check the code-styles

Thanks for your contribution