当前位置:   article > 正文

伪原创智能改写api百度【php源码】_百度api 改写

百度api 改写

用百度自家的产品来生成的文章,原创度和收录相当理想,伪原创智能改写api百度,以毒攻毒。

 从全球趋势来看,信息化、智能化、智能化是建设智慧城市的必由之路。2022年,德勤发布《超级智慧城市报告》。

伪原创智能改写api百度【php源码】暂时只有php,其他语言欢迎补充

  1. <?php
  2. set_time_limit(270);
  3. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  4. define('TITLE_SEPAR', 'xxx**xxx');
  5. define('TITLE_SEPAR2', '262661');
  6. $url = 'http://www.xiaofamao.com/api.php?json=0&v=1&key=abcccc';
  7. $content_tag_name = '内容';
  8. $headdd = '';
  9. $taill = '';
  10. switch($LabelArray['PageType'])
  11. {
  12. case 'List'://处理列表页,只能处理html
  13. break;
  14. case 'Pages'://处理多页,只能处理html
  15. break;
  16. case 'Content'://处理默认页,只能处理html
  17. break;
  18. case 'Save'://只有保存时是可以处理标签值的
  19. // 保存原文
  20. try {
  21. /**********************************************************************/
  22. // 这一步用来获取伪原创文章
  23. /**********************************************************************/
  24. $title = $LabelArray['标题'];
  25. $title = '标题:'.$title;
  26. $content = $LabelArray[$content_tag_name];
  27. #$content = str_replace('2020/', '2020_', $content);
  28. $article_src = compose_article($title, $content);
  29. $article_src_b = $article_src;
  30. $article_new = get_wyc_article($article_src);
  31. $title_wyc = trim($article_new[0]);
  32. $content_wyc = trim($article_new[1]);
  33. $content_wyc = fix_newline($content_wyc);
  34. $content_wyc = str_replace('标签:', '标签:', $content_wyc);
  35. $LabelArray[$content_tag_name] = $headdd. $content_wyc. $taill;
  36. $title_wyc = str_replace(array('。',',','%'), array(' ',' ',' '), $title_wyc);
  37. $LabelArray['标题'] = $title_wyc;
  38. }
  39. catch (Exception $e) {
  40. $LabelArray['标题'] .= $e->getMessage();
  41. $LabelArray[$content_tag_name] .= $e->getMessage();
  42. }
  43. break;
  44. default:
  45. //$LabelArray[$content_tag_name]=curl_request($url, array('wenzhang'=>$LabelArray[$content_tag_name] ));
  46. }
  47. echo serialize($LabelArray);
  48. function compose_article($title, $content) {
  49. $separator = compose_separator();
  50. return $title.$separator.$content;
  51. }
  52. function compose_separator() {
  53. return PHP_EOL.'('.TITLE_SEPAR2.')'.PHP_EOL;
  54. }
  55. function fix_separator($article) {
  56. return $article;
  57. }
  58. function get_wyc_article($str) {
  59. global $url;
  60. $separator = compose_separator();
  61. $separator = str_replace(PHP_EOL, '', $separator);
  62. $wyc = curl_request($url, array('wenzhang'=>$str));
  63. $wyc_f = $wyc;
  64. $wyc = fix_separator($wyc);
  65. $wyc = explode($separator, $wyc);
  66. if (isset($wyc[0])){
  67. $wyc[0] = str_replace('标题:', '', $wyc[0]);
  68. $wyc[0] = str_replace('标题:', '', $wyc[0]);
  69. $wyc[0] = str_replace('目:', '', $wyc[0]);
  70. $wyc[0] = str_replace('目:', '', $wyc[0]);
  71. $wyc[0] = 'xx`xx'.$wyc[0];
  72. $wyc[0] = str_replace('xx`xx题', '', $wyc[0]);
  73. $wyc[0] = str_replace('xx`xx', '', $wyc[0]);
  74. }
  75. //if (isset($wyc[1])) $wyc[1] = trim($wyc[1]);
  76. //$wyc[1] = $wyc_f.'jjjjjjjj'.$wyc[1];
  77. return $wyc;
  78. }
  79. function get_wyc_title($str) {
  80. $title = get_wyc_article($str.PHP_EOL.PHP_EOL.PHP_EOL.$str.PHP_EOL.PHP_EOL.PHP_EOL.$str);
  81. $title = fix_newline($title);
  82. $title = explode(PHP_EOL, $title);
  83. return $title[0];
  84. }
  85. function get_keywords($title, $contents) {
  86. $url_kw = 'http://www.78tp.com/nlp/kws.php?appid=';
  87. $kws = curl_request($url_kw, array(
  88. 'title'=>$title,
  89. 'len'=>100,
  90. 'text'=>$contents));
  91. return $kws;
  92. }
  93. function remove_alt($contents) {
  94. $contents = preg_replace('/alt=\"(.*)\"/', '', $contents);
  95. return $contents;
  96. }
  97. function fix_title($contents) {
  98. $punctuation_symbol = array('。', '?', ',', ':', ';', '、', '!',
  99. '.', '?', ',', ':', ';', '!');
  100. $contents = str_replace($punctuation_symbol, '', $contents);
  101. return $contents;
  102. }
  103. function br2newline($contents) {
  104. $contents = str_replace('<br>', PHP_EOL, $contents);
  105. $contents = str_replace('<br/>', PHP_EOL, $contents);
  106. $contents = str_replace('<br />', PHP_EOL, $contents);
  107. $contents = str_replace('<BR/>', PHP_EOL, $contents);
  108. $contents = str_replace('<BR>', PHP_EOL, $contents);
  109. $contents = str_replace('<BR />', PHP_EOL, $contents);
  110. return $contents;
  111. }
  112. function newline2br($contnets) {
  113. $contnets = str_replace(PHP_EOL, "<br>", $contnets);
  114. // $contnets = str_replace('><br><', '><', $contnets);
  115. $contnets = str_replace('<p><br>', '<p>', $contnets);
  116. return $contnets;
  117. }
  118. function delete_newline($contents) {
  119. $contents = fix_newline($contents);
  120. // $contents = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $contents);
  121. // $contents = str_replace('>'.PHP_EOL, '>', $contents);
  122. return $contents;
  123. }
  124. function reset_newline_win($contents) {
  125. // 优化换行符
  126. $contents = str_replace("\r\n", "\n", $contents);
  127. $contents = str_replace("\r", "\n", $contents);
  128. $contents = str_replace("\n", PHP_EOL, $contents);
  129. return $contents;
  130. }
  131. function fix_newline($data) {
  132. $data = str_replace("\r", "\n", $data);
  133. while(strpos($data, "\n\n") !== false) {
  134. $data = str_replace("\n\n", "\n", $data);
  135. }
  136. $data = str_replace("\n", PHP_EOL, $data);
  137. return $data;
  138. }
  139. function clean_contents($contents) {
  140. // $str = preg_replace('#<([^>\s/]+)[^>]*>#','<$1>', $contents);
  141. // return $str;
  142. $sa = new cleanHtml;
  143. $sa->allow = array( 'src' );
  144. $sa->exceptions = array(
  145. 'img' => array( 'src', 'alt' ),
  146. //'a' => array( 'href', 'title' ),
  147. 'iframe'=>array('src','frameborder'),
  148. );
  149. $str = $sa->strip( $contents );
  150. return $str;
  151. }
  152. function xfm_strong_str_replace_once($search, $replace, $subject) {
  153. $firstChar = strpos($subject, $search);
  154. if($firstChar !== false) {
  155. $beforeStr = substr($subject,0,$firstChar);
  156. $afterStr = substr($subject, $firstChar + strlen($search));
  157. return $beforeStr.$replace.$afterStr;
  158. } else {
  159. return $subject;
  160. }
  161. }
  162. //参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
  163. function curl_request($url,$post='',$cookie='', $returnCookie=0){
  164. if (! extension_loaded('curl')) {
  165. file_exists('./ext/php_curl.dll') && dl('php_curl.dll'); // 加载扩展
  166. }
  167. $curl = curl_init();
  168. curl_setopt($curl, CURLOPT_URL, $url);
  169. curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)');
  170. if (ini_get('open_basedir') == '' && strtolower(ini_get('safe_mode')) != 'on'){
  171. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  172. }
  173. curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
  174. curl_setopt($curl, CURLOPT_REFERER, "http://XXX");
  175. if($post) {
  176. curl_setopt($curl, CURLOPT_POST, 1);
  177. curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
  178. }
  179. if($cookie) {
  180. curl_setopt($curl, CURLOPT_COOKIE, $cookie);
  181. }
  182. curl_setopt($curl, CURLOPT_HEADER, $returnCookie);
  183. curl_setopt($curl, CURLOPT_TIMEOUT, 150);
  184. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  185. $data = curl_exec($curl);
  186. if (curl_errno($curl)) {
  187. return curl_error($curl);
  188. }
  189. curl_close($curl);
  190. if($returnCookie){
  191. list($header, $body) = explode("\r\n\r\n", $data, 2);
  192. preg_match_all("/Set\-Cookie:([^;]*);/", $header, $matches);
  193. $info['cookie'] = substr($matches[1][0], 1);
  194. $info['content'] = $body;
  195. return $info;
  196. }else{
  197. return $data;
  198. }
  199. }
  200. //echo $tag;
  201. // 计算中文字符串长度
  202. function utf8_strlen($string = null) {
  203. // 将字符串分解为单元
  204. preg_match_all("/./us", $string, $match);
  205. // 返回单元个数
  206. return count($match[0]);
  207. }
  208. function reg_escape( $str )
  209. {
  210. $conversions = array( "^" => "\^", "[" => "\[", "." => "\.", "$" => "\$", "{" => "\{", "*" => "\*", "(" => "\(", "\\" => "\\\\", "/" => "\/", "+" => "\+", ")" => "\)", "|" => "\|", "?" => "\?", "<" => "\<", ">" => "\>" );
  211. return strtr( $str, $conversions );
  212. }
  213. /**
  214. * Strip attribute Class
  215. * Remove attributes from XML elements
  216. * @author David (semlabs.co.uk)
  217. * @version 0.2.1
  218. */
  219. class cleanHtml{
  220. public $str = '';
  221. public $allow = array();
  222. public $exceptions = array();
  223. public $ignore = array();
  224. public function strip( $str )
  225. {
  226. $this->str = $str;
  227. if( is_string( $str ) && strlen( $str ) > 0 )
  228. {
  229. $res = $this->findElements();
  230. if( is_string( $res ) )
  231. return $res;
  232. $nodes = $this->findAttributes( $res );
  233. $this->removeAttributes( $nodes );
  234. }
  235. return $this->str;
  236. }
  237. private function findElements()
  238. {
  239. # Create an array of elements with attributes
  240. $nodes = array();
  241. preg_match_all( "/<([^ !\/\>\n]+)([^>]*)>/i", $this->str, $elements );
  242. foreach( $elements[1] as $el_key => $element )
  243. {
  244. if( $elements[2][$el_key] )
  245. {
  246. $literal = $elements[0][$el_key];
  247. $element_name = $elements[1][$el_key];
  248. $attributes = $elements[2][$el_key];
  249. if( is_array( $this->ignore ) && !in_array( $element_name, $this->ignore ) )
  250. $nodes[] = array( 'literal' => $literal, 'name' => $element_name, 'attributes' => $attributes );
  251. }
  252. }
  253. # Return the XML if there were no attributes to remove
  254. if( !$nodes[0] )
  255. return $this->str;
  256. else
  257. return $nodes;
  258. }
  259. private function findAttributes( $nodes )
  260. {
  261. # Extract attributes
  262. foreach( $nodes as &$node )
  263. {
  264. preg_match_all( "/([^ =]+)\s*=\s*[\"|']{0,1}([^\"']*)[\"|']{0,1}/i", $node['attributes'], $attributes );
  265. if( $attributes[1] )
  266. {
  267. foreach( $attributes[1] as $att_key => $att )
  268. {
  269. $literal = $attributes[0][$att_key];
  270. $attribute_name = $attributes[1][$att_key];
  271. $value = $attributes[2][$att_key];
  272. $atts[] = array( 'literal' => $literal, 'name' => $attribute_name, 'value' => $value );
  273. }
  274. }
  275. else
  276. $node['attributes'] = null;
  277. $node['attributes'] = $atts;
  278. unset( $atts );
  279. }
  280. return $nodes;
  281. }
  282. private function removeAttributes( $nodes )
  283. {
  284. # Remove unwanted attributes
  285. foreach( $nodes as $node )
  286. {
  287. # Check if node has any attributes to be kept
  288. $node_name = $node['name'];
  289. $new_attributes = '';
  290. if( is_array( $node['attributes'] ) )
  291. {
  292. foreach( $node['attributes'] as $attribute )
  293. {
  294. if( ( is_array( $this->allow ) && in_array( $attribute['name'], $this->allow ) ) || $this->isException( $node_name, $attribute['name'], $this->exceptions ) )
  295. $new_attributes = $this->createAttributes( $new_attributes, $attribute['name'], $attribute['value'] );
  296. }
  297. }
  298. $replacement = ( $new_attributes ) ? "<$node_name $new_attributes>" : "<$node_name>";
  299. $this->str = preg_replace( '/'. reg_escape( $node['literal'] ) .'/', $replacement, $this->str );
  300. }
  301. }
  302. private function isException( $element_name, $attribute_name, $exceptions )
  303. {
  304. if( array_key_exists($element_name, $this->exceptions) )
  305. {
  306. if( in_array( $attribute_name, $this->exceptions[$element_name] ) )
  307. return true;
  308. }
  309. return false;
  310. }
  311. private function createAttributes( $new_attributes, $name, $value )
  312. {
  313. if( $new_attributes )
  314. $new_attributes .= " ";
  315. $new_attributes .= "$name=\"$value\"";
  316. return $new_attributes;
  317. }
  318. }
  319. ?>

当时全球已经有1000多个智慧城市上马或在建,中国有500个智慧城市在建。根据最新情况,我国智慧城市发展至今,已经进入“数字化转型”融合的新阶段。

1、智能伪原创生成软件

此外,《智能制造发展规划》还提出,到2025年,智能制造支撑体系基本建立,重点行业初步实现数字化、智能化转型。

业内人士表示,对于城市和各行各业的数字化,包括5G、云计算、大数据、人工智能、区块链等多项技术。其中人工智能是核心,是城市数字化转型过程中实现智能化、智能化的核心技术。
这意味着对AI的争夺将是关键。早在2017年,李彦宏就在两会提案中表示:“随着人工智能技术的逐渐成熟,谁率先实现应用上的突破,谁就有可能在智能时代的竞争中占据优势。”

这个重任与每一个中国AI企业息息相关。为此,百度此前部署了新一代智能政务云基地,构建了“云智融合”的城市大脑,在城市洞察、城市治理、产业发展、服务惠民四大智慧应用场景进行深度赋能。再加上百度的智能运营体系和安全体系,打造了“1 5 N”智慧城市全景图,上述案例落地。

2、十年研发超千亿,多项领先全球

为百度AI产品和产业解决方案提供全面技术支持的,是刚刚迭代升级到7.0的百度大脑。此外,百度自主研发的第二代百度昆仑AI芯片——昆仑Core  2也已实现量产,采用7nm工艺,性能较一代提升2-3倍。未来将广泛应用于互联网核心算法、智慧城市、智慧行业等领域。
其中,作为百度大脑的核心基地,飞桨格外引人关注。飞桨是国内最早开源、功能丰富的百度自主研发的工业级深度学习平台。自2016年正式开源以来,通过降低应用门槛,各行各业都被推到了价值链的中心。
最新数据显示,飞桨通过开源聚集了超过360万各行各业的开发者,开发了40万个AI模型,累计服务13万家企事业单位,覆盖工业、农业、医疗、城管、交通、金融等诸多领域。
这个数据在世界上是数一数二的。2019年,IDC发布《深度学习框架和平台市场份额》报告显示,在深度学习平台市场,谷歌、脸书、百度三家厂商地位稳固,市场份额接近80%。其中,百度市场份额快速增长,AWS、微软等国外平台份额下滑明显。最新IDC调查显示,百度在中国深度学习平台市场的综合份额持续增长,排名第一。相比自动驾驶平台Apollo,飞桨的关注度不算太高。但从核心来看,飞桨是中国第一个也是唯一一个开源、功能齐全的工业级深度学习平台。百度也因此成为继脸书、谷歌、IBM之后,全球又一家拥有开源深度学习框架的科技公司。
“在AI领域,百度最引以为傲的有两点。一个是Apollo,奠定了百度在全球自动驾驶生态中的核心地位;是飞桨,把国外巨头垄断的深度学习平台市场份额撕开了一个口子。”此前,一位业内人士在这篇文章中评论道。
据此前业内人士透露,飞桨的开发是完全自主知识产权的逐行代码。自主开发深度学习平台几乎和自主编写操作系统一样困难,因此被称为“中国自主研发样本”。
在AI专利数量上,百度也位居国内第一。据国家工业信息安全发展研究中心发布的《2020人工智能中国专利技术分析报告》显示,在人工智能的专利申请量和授权量方面,百度分别以9364件专利申请量和2682件专利授权量位居第一。
这意味着,无论从哪个角度看,百度都是当之无愧的中国AI的领导者。
对于从留学开始就有AI梦的李彦宏来说,很难带领百度走到这一步。投入并坚持AI研发超过10年。
“人工智能的概念提出已经60多年了。我在美国读书的时候很喜欢这门课,但是老师告诉我业内没有人认可。”李彦宏曾经说过,那个时候信息技术还没有那么普及,数据少,算法低,人工智能也没有展现出很大的前景。但是他没有听老师的话,从此开始关注和研究人工智能。
2010年,百度开始AI布局,成为国内最早深度AI布局的先锋企业;2013年,百度深度学习研究院成立,这是全球企业界第一个以“深度学习”命名的研究院。自动驾驶研发;d项目于今年启动;2014年4月,大数据实验室成立,同年5月,硅谷人工智能实验成立。同年,“百度无人驾驶汽车”研发;d计划正式启动。
2015年以来,人工智能在国家层面被反复提及。同年,百度成立自动驾驶事业部,大规模投入研发;2017年新增商业智能实验室、机器人和自动驾驶实验室,完成AI各细分领域的研究布局。同年7月,百度Apollo发布1.0版本,正式对外开源。2018年底,《哈佛商业评论》发布了“全球最受关注的10大AI领袖”榜单。李彦宏是唯一入选的中国面孔,被称为“中国AI产业的发起者和设计者”、“中国唯一拥有完整AI技术和产业能力的CEO”。
从某种程度上来说,这一评价不仅是对李彦宏在几乎所有公共场所推动AI的描述,也是对李彦宏在引领中国AI产业方面的作用的评价。
"三年前,我们的年总收入刚刚超过1000亿元,而在过去的10年里,我们的研发;d支出已超过1000亿元。”在今年3月的股东信中,李彦宏透露:“然而,如果我们选择了技术战略,我们必须抵制短期机会的诱惑,坚定地面对长期投资的挑战。”
或许,正是在长期的“疯狂”投入中,从“汽车机器人”到“萝卜跑”,从不断循环迭代的“小度”到“AI产业赋能”.这些曾经看似“疯狂”的想法,慢慢从“梦想”变成了现实。
然而,无论对于中国还是百度,人工智能的艰辛探索,一条坎坷泥泞的路,才刚刚开始。
2020年6月,百度宣布未来五年预计培养500万AI人才,为中国智能经济和智能社会的发展提供AI人才保障。2021年8月18日,百度正式宣布成立郭颂学院,通过提供基础课程、技术竞赛、产业培训、科研经费等资源,推动AI人才培养。
这一切,或许就像李彦宏写给刷屏股东的信:科技创新的前沿没有尽头。对于一个技术信徒来说,还有什么比这个时代的机遇更令人激动的呢?

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/338291
推荐阅读
相关标签
  

闽ICP备14008679号