<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$
 */

  uses(
    'xml.soap.SOAPClient', 
    'xml.soap.transport.SOAPHTTPTransport'
  );
  
  // Language defines
  define('BABELFISH_LANG_ENGLISH',    'en');
  define('BABELFISH_LANG_GERMAN',     'de');
  define('BABELFISH_LANG_FRENCH',     'fr');
  define('BABELFISH_LANG_ITALIAN',    'it');
  define('BABELFISH_LANG_PORTUGESE',  'pt');
  define('BABELFISH_LANG_SPANISH',    'es');
  define('BABELFISH_LANG_RUSSIAN',    'ru');
  
  /**
   * Interface for AltaVista's Babelfish service.
   * 
   * Translates text of up to 150 words in length. For more information 
   * about the service, see the babelfish homepage.  
   * 
   * Example:
   * <pre>
   *   $bf= &new BabelFish();
   *   try(); {
   *     $translated= &$bf->translate(
   *       'Babelfish bersetzt den Text', 
   *       BABELFISH_LANG_GERMAN,
   *       BABELFISH_LANG_ENGLISH
   *     );
   *   } if (catch('Exception', $e)) {
   *     $e->printStackTrace();
   *     exit;
   *   }
   * 
   *   var_dump($translated);
   * </pre>
   * 
   * @see    http://xmethods.net/ve2/ViewListing.po?serviceid=14
   */
  class BabelFish extends SOAPClient {

    /**
     * Constructor
     *
     * @access  public
     */
    function __construct() {
      parent::__construct(
        new SOAPHTTPTransport('http://services.xmethods.net:80/perl/soaplite.cgi'),
        'urn:xmethodsBabelFish',
        'BabelFish'
      );
    }
    
    /**
     * Translates a text
     *
     * @access  public
     * @param   string sourcedata The text to be translated.
     * @param   string src_lang Source language
     * @param   string target_lang Target language
     * @return  string Translated text
     */
    function &translate($sourcedata, $src_lang, $target_lang) {
      $translated= $this->call(
        new SOAPNamedItem('translationmode', sprintf('%s_%s', $src_lang, $target_lang)),
        new SOAPNamedItem('sourcedata', $sourcedata)
      );
      return $translated;
    }
  }
?>
 <commit_msg>- Add purpose - Syntax highlight example code - Whitespace<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$
 */

  uses(
    'xml.soap.SOAPClient', 
    'xml.soap.transport.SOAPHTTPTransport'
  );
  
  // Language defines
  define('BABELFISH_LANG_ENGLISH',    'en');
  define('BABELFISH_LANG_GERMAN',     'de');
  define('BABELFISH_LANG_FRENCH',     'fr');
  define('BABELFISH_LANG_ITALIAN',    'it');
  define('BABELFISH_LANG_PORTUGESE',  'pt');
  define('BABELFISH_LANG_SPANISH',    'es');
  define('BABELFISH_LANG_RUSSIAN',    'ru');
  
  /**
   * Interface for AltaVista's Babelfish service.
   * 
   * Translates text of up to 150 words in length. For more information 
   * about the service, see the babelfish homepage.  
   * 
   * Example:
   * <code>
   *   $bf= &new BabelFish();
   *   try(); {
   *     $translated= &$bf->translate(
   *       'Babelfish bersetzt den Text', 
   *       BABELFISH_LANG_GERMAN,
   *       BABELFISH_LANG_ENGLISH
   *     );
   *   } if (catch('Exception', $e)) {
   *     $e->printStackTrace();
   *     exit;
   *   }
   * 
   *   var_dump($translated);
   * </code>
   * 
   * @see      http://xmethods.net/ve2/ViewListing.po?serviceid=14
   * @purpose  SOAP-Proxy
   */
  class BabelFish extends SOAPClient {

    /**
     * Constructor
     *
     * @access  public
     */
    function __construct() {
      parent::__construct(
        new SOAPHTTPTransport('http://services.xmethods.net:80/perl/soaplite.cgi'),
        'urn:xmethodsBabelFish',
        'BabelFish'
      );
    }
    
    /**
     * Translates a text
     *
     * @access  public
     * @param   string sourcedata The text to be translated.
     * @param   string src_lang Source language
     * @param   string target_lang Target language
     * @return  string Translated text
     */
    function &translate($sourcedata, $src_lang, $target_lang) {
      $translated= $this->call(
        new SOAPNamedItem('translationmode', sprintf('%s_%s', $src_lang, $target_lang)),
        new SOAPNamedItem('sourcedata', $sourcedata)
      );
      
      return $translated;
    }
  }
?>
 
{'fraction_non_alphanumeric': 0.13592699327569643, 'fraction_numerical': 0.0038424591738712775, 'mean_word_length': 2.4364686468646863, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1447013', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1447, 'n_words': 275}