? 726088-3_placemaker.patch
? 726088-4_placemaker.patch
? PATCHES.txt
? extractor.feeds.inc
? extractor.js
? libraries/placemaker.inc
Index: ExtractorSimplePieParser.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/extractor/ExtractorSimplePieParser.inc,v
retrieving revision 1.1
diff -u -p -r1.1 ExtractorSimplePieParser.inc
--- ExtractorSimplePieParser.inc	4 Dec 2009 15:01:46 -0000	1.1
+++ ExtractorSimplePieParser.inc	27 Feb 2010 03:11:30 -0000
@@ -1,6 +1,8 @@
 <?php
 // $Id: ExtractorSimplePieParser.inc,v 1.1 2009/12/04 15:01:46 alexb Exp $
 
+require_once 'extractor.feeds.inc';
+
 /**
  * Extend simplepie parser and add term extraction.
  */
@@ -10,17 +12,7 @@ class ExtractorSimplePieParser extends F
    * Add additional mapping sources.
    */
   public function getMappingSources() {
-    $sources = array(
-      'extracted_terms' => array(
-        'name' => t('Extracted term names'),
-        'description' => t('Array of term names extracted from title and or description.'),
-      ),
-      'extracted_tids' => array(
-        'name' => t('Extracted term tids'),
-        'description' => t('Array of term ids (tid) of term names extracted from title and or description.'),
-      ),
-    );
-    return parent::getMappingSources() + $sources;
+    return parent::getMappingSources() + extractor_feeds_get_mapping_sources();
   }
 
   /**
@@ -28,15 +20,23 @@ class ExtractorSimplePieParser extends F
    * them to item.
    */
   public function getSourceElement($item, $element_key) {
-    if ($element_key == 'extracted_terms') {
-      return extractor_extract($item['title'] .' '. $item['description']);
-    }
-    elseif ($element_key == 'extracted_tids') {
-      $terms = extractor_extract($item['title'] .' '. $item['description']);
-      return array_keys($terms);
-    }
-    else {
-      return parent::getSourceElement($item, $element_key);
+    if ($result = extractor_feeds_get_source_element($item, $element_key, $this->config)) {
+      return $result;
     }
+    return parent::getSourceElement($item, $element_key);
+  }
+
+  /**
+    * Config Form Defaults
+    */
+  public function configDefaults() {
+    return extractor_feeds_defaults();
+  }
+
+  /**
+    * Config Form
+    */
+  public function configForm(&$form_state) {
+    return extractor_feeds_form($this->config);
   }
-}
+}
\ No newline at end of file
Index: ExtractorSyndicationParser.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/extractor/ExtractorSyndicationParser.inc,v
retrieving revision 1.1
diff -u -p -r1.1 ExtractorSyndicationParser.inc
--- ExtractorSyndicationParser.inc	4 Dec 2009 15:01:46 -0000	1.1
+++ ExtractorSyndicationParser.inc	27 Feb 2010 03:11:30 -0000
@@ -1,6 +1,8 @@
 <?php
 // $Id: ExtractorSyndicationParser.inc,v 1.1 2009/12/04 15:01:46 alexb Exp $
 
+require_once 'extractor.feeds.inc';
+
 /**
  * Extend common syndication parser and add term extraction.
  */
@@ -10,17 +12,7 @@ class ExtractorSyndicationParser extends
    * Add additional mapping sources.
    */
   public function getMappingSources() {
-    $sources = array(
-      'extracted_terms' => array(
-        'name' => t('Extracted term names'),
-        'description' => t('Array of term names extracted from title and or description.'),
-      ),
-      'extracted_tids' => array(
-        'name' => t('Extracted term tids'),
-        'description' => t('Array of term ids (tid) of term names extracted from title and or description.'),
-      ),
-    );
-    return parent::getMappingSources() + $sources;
+    return parent::getMappingSources() + extractor_feeds_get_mapping_sources();
   }
 
   /**
@@ -28,15 +20,23 @@ class ExtractorSyndicationParser extends
    * them to item.
    */
   public function getSourceElement($item, $element_key) {
-    if ($element_key == 'extracted_terms') {
-      return extractor_extract($item['title'] .' '. $item['description']);
-    }
-    elseif ($element_key == 'extracted_tids') {
-      $terms = extractor_extract($item['title'] .' '. $item['description']);
-      return array_keys($terms);
-    }
-    else {
-      return parent::getSourceElement($item, $element_key);
+    if ($result = extractor_feeds_get_source_element($item, $element_key, $this->config)) {
+      return $result;
     }
+    return parent::getSourceElement($item, $element_key);
+  }
+
+  /**
+   * Config Form Defaults
+   */
+  public function configDefaults() {
+    return extractor_feeds_defaults();
+  }
+
+  /**
+   * Config Form
+   */
+  public function configForm(&$form_state) {
+    return extractor_feeds_form($this->config);
   }
-}
+}
\ No newline at end of file
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/extractor/README.txt,v
retrieving revision 1.1
diff -u -p -r1.1 README.txt
--- README.txt	4 Dec 2009 15:01:46 -0000	1.1
+++ README.txt	27 Feb 2010 03:11:30 -0000
@@ -20,3 +20,23 @@ With Feeds module:
 As API:
 
 $terms = extractor_extract($text);
+
+Yahoo Placemaker
+================
+
+The default tagging library in use is "Simple Extractor" which is a simple
+look up algorithm based on a terms in a taxonomy vocabulary. Alternatively, the
+Yahoo Placemaker API can be used as tagging library.
+
+To use Yahoo Placemaker with Feeds module, click on the settings form of the
+term extraction parser and select "Yahoo Placemaker" as extraction library. Then
+supply an API key and if a different language than English should be used for
+terms, specify the language code.
+
+To use Yahoo Placemaker on the API level, call:
+
+$terms = extractor_extract($text, 'placemaker', array('placemaker_key' => '<MYPMKEY>'));
+
+or:
+
+$terms = extractor_extract($text, 'placemaker', array('placemaker_key' => '<MYPMKEY>'), 'language' => 'fr');
\ No newline at end of file
Index: extractor.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/extractor/extractor.info,v
retrieving revision 1.1
diff -u -p -r1.1 extractor.info
--- extractor.info	4 Dec 2009 15:01:46 -0000	1.1
+++ extractor.info	27 Feb 2010 03:11:30 -0000
@@ -2,4 +2,10 @@
 name = Extractor
 description = "API for extracting terms from text"
 dependencies[] = taxonomy
-core = 6.x
\ No newline at end of file
+core = 6.x
+; Information added by drupal.org packaging script on 2009-12-04
+version = "6.x-1.0-alpha1"
+core = "6.x"
+project = "extractor"
+datestamp = "1259940075"
+
Index: extractor.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/extractor/extractor.module,v
retrieving revision 1.1
diff -u -p -r1.1 extractor.module
--- extractor.module	4 Dec 2009 15:01:46 -0000	1.1
+++ extractor.module	27 Feb 2010 03:11:30 -0000
@@ -78,11 +78,22 @@ function extractor_settings_form() {
 /**
  * Main API function.
  *
- * @todo: make pluggable.
+ * @param $text
+ *   The text to perform the term extraction on.
+ * @param $library
+ *   The extraction library to use. Possible options: 'extractor_simple' or
+ *   'placemaker'.
+ * @param $config
+ *   An array containing a configuration for the library in use.
+ *
+ * @return
+ *   An array of terms found in $text. They keys of the array contain the
+ *   taxonomy term ids and the values the term names.
  */
-function extractor_extract($text) {
-  extractor_include('extractor_simple');
-  return extractor_simple_extract($text);
+function extractor_extract($text, $library = 'extractor_simple', $config = array()) {
+  extractor_include($config['extractors']);
+  $extract = "{$library}_extract";
+  return $extract($text, $config);
 }
 
 /**
@@ -94,4 +105,4 @@ function extractor_include($name) {
     include drupal_get_path('module', 'extractor') .'/libraries/'. $name .'.inc';
     $included[$name] = TRUE;
   }
-}
\ No newline at end of file
+}
