paralleldots / apis
此包的最新版本(dev-master)没有可用的许可信息。
PHP 的 Rest Api 包装器。
dev-master
2021-01-25 09:40 UTC
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-17 03:08:20 UTC
README
ParallelDots APIs 的 PHP 包装器
要求
- 如果系统中没有 cUrl,请安装。
- 对于 ubuntu,请使用 sudo apt-get install php-curl 安装。
安装
- 在您的项目目录中创建一个 composer.json 文件。
- 在文件中写入以下内容
{ "require": { "paralleldots/apis": "*" }, "minimum-stability": "dev" }
- 在相同目录下运行以下命令(注意:您必须已安装 composer)
composer install
支持的编程语言
- Portuguese ( pt )
- Simplified Chinese ( zh )
- Spanish ( es )
- German ( de )
- French ( fr )
- Dutch ( nl )
- Italian (it)
- Japanese ( ja )
- Russian ( ru )
- Thai ( th )
- Danish ( da )
- Finish ( fi )
- Arabic (ar)
- Greek (el)
API 密钥 & 设置
注册 ParallelDots APIs 账户以获取您的免费 API 密钥 此处。您将收到一封包含访问 API 密钥详情的电子邮件。配置
<?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); # Setting your API key set_api_key("YOUR API KEY"); # Viewing your API key get_api_key(); ?>
示例
<?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo abuse("you f**king ass hole"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[\"you f**king ass hole\",\"fuck this shit\"]"; echo abuse_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $obj = json_encode(array("world politics", "news")); echo custom_classifier("Donald Trump is the President of the United States of America.", $obj); ?> {"taxonomy":[{"category":"world politics","confidence_score":0.5382496715},{"category":"news","confidence_score":0.1232979}]} <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo sarcasm("Did you hear the latest Porcupine Tree song ? It's rocking !"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo sarcasm_multilang("Avez-vous entendu la dernière chanson de Porcupine Tree? Ça berce!", "fr"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[\"I am trying to imagine you with a personality\",\"This is shit\"]"; echo sarcasm_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list_multilang = "[\"les drogues sont amusantes\",\"ne pas faire de la drogue reste à l'école\",\"lol vous un fils de fag\",\"J'ai une infection de la gorge\"]"; echo sarcasm_multilang_batch($text_list_multilang, "fr"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo emotion("I am trying to imagine you with a personality"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo emotion_multilang("Avez-vous entendu la dernière chanson de Porcupine Tree? Ça berce!", "fr"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[\"I am trying to imagine you with a personality\",\"This is shit\"]"; echo emotion_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list_multilang = "[\"les drogues sont amusantes\",\"ne pas faire de la drogue reste à l'école\",\"lol vous un fils de fag\",\"J'ai une infection de la gorge\"]"; echo emotion_multilang_batch($text_list_multilang, "fr"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $path_to_image = "<path_to_image>"; echo facial_emotion($path_to_image); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $url_to_image = "<url_to_image>"; echo facial_emotion_url($url_to_image); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo intent("How do I cancel my ticket from the app?"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[\"How do I cancel my ticket from the app?\",\"20% off on your next Uber ride\"]"; echo intent_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo keywords("Prime Minister Narendra Modi tweeted a link to the speech Human Resource Development Minister Smriti Irani made in the Lok Sabha during the debate on the ongoing JNU row and the suicide of Dalit scholar Rohith Vemula at the Hyderabad Central University."); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[\"For the Yankees, it took a stunning comeback after being down 2-0 to the Indians in the American League Division Series. For the Astros, it took beating Chris Sale to top the Red Sox\",\"U.S. stocks edged higher on Friday, with the S&P 500 hitting a more than five-month high, as gains in industrials and other areas offset a drop in financials. Fred Katayama reports.\"]"; echo keywords_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo multilang_keywords("C'est un environnement très hostile, si vous choisissez de débattre ici, vous serez vicieusement attaqué par l'opposition.", "fr"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo ner("Narendra Modi is the prime minister of India"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[ \"Apple was founded by Steve Jobs\", \"Apple Inc. is an American multinational technology company headquartered in Cupertino.\"]"; echo ner_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo ner_multilang("Lionel Andrés Messi vuelve a ser el gran protagonista en las portadas de la prensa deportiva internacional al día siguiente de un partido de Champions.","es"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[ \"Lionel Andrés Messi vuelve a ser el gran protagonista en las portadas de la prensa deportiva internacional al día siguiente de un partido de Champions.\", \"Lionel Andrés Messi vuelve a ser el gran protagonista en las portadas de la prensa deportiva internacional al día siguiente de un partido de Champions.\"]"; echo ner_multilang_batch($text_list,"es"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $path_to_image = "<path_to_image>"; echo object_recognizer($path_to_image); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $url_to_image = "<url_to_image>"; echo object_recognizer_url($url_to_image); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo phrase_extractor("For the Yankees, it took a stunning comeback after being down 2-0 to the Indians in the American League Division Series. For the Astros, it took beating Chris Sale to top the Red Sox.."); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[\"For the Yankees, it took a stunning comeback after being down 2-0 to the Indians in the American League Division Series. For the Astros, it took beating Chris Sale to top the Red Sox.\",\"U.S. stocks edged higher on Friday, with the S&P 500 hitting a more than five-month high, as gains in industrials and other areas offset a drop in financials. Fred Katayama reports.\"]"; echo phrase_extractor_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo sentiment("Come on, lets play together"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo sentiment_multilang("Allez, jouons ensemble", "fr"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[ \"Come on, lets play together\",\"Team performed well overall\" ]"; echo sentiment_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list_multilang = "[\"les drogues sont amusantes\",\"ne pas faire de la drogue reste à l'école\",\"lol vous un fils de fag\",\"J'ai une infection de la gorge\"]"; echo sentiment_multilang_batch($text_list_multilang, "fr"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo similarity("Sachin is the greatest batsman", "Tendulkar is the finest cricketer"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo taxonomy("Narendra Modi is the prime minister of India"); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); $text_list = "[ \"Apple was founded by Steve Jobs\", \"Apple Inc. is an American multinational technology company headquartered in Cupertino.\"]"; echo taxonomy_batch($text_list); ?> <?php require(__DIR__ . '/vendor/paralleldots/apis/autoload.php'); echo usage(); ?>