WSaiOS EOM模拟人工认知工程理论
第三十四章:WSaiOS EOM自动内容生成系统实现——从认知结果到智能页面生成
34.1 为什么研究认知内容生成
前面章节完成:
WSaiOS认知匹配流程:
用户需求
↓
Element
↓
Object
↓
Relationship
↓
Knowledge
↓
Matching
↓
Decision
但是:
认知系统最终需要:
把理解结果应用到实际业务。
例如:
GEO商业分析系统:
识别:
Miami
Electric Toothbrush
Distributor
下一步:
需要生成:
商业分析页面
SEO页面
采购推荐页面
市场报告
因此:
EOM提出:
内容不是简单文字组合,而是认知结构的表达形式。
34.2 传统内容生成与EOM内容生成区别
传统方式:
关键词
↓
文章模板
↓
填充内容
问题:
没有理解。
例如:
关键词:
electric toothbrush distributor Miami
只是:
字符串。
WSaiOS:
关键词
↓
需求对象
↓
知识结构
↓
业务关系
↓
内容模型
↓
页面生成
生成内容:
围绕:
真实商业对象。
34.3 Content Object内容对象模型
EOM认为:
内容也应该对象化。
定义:
Content Object
{
Subject
Object
Relations
Information
Template
Output
}
例如:
商业页面:
Content Object
主题:
Miami Electric Toothbrush Market
对象:
Distributor
关系:
Supply
信息:
Supplier Data
模板:
GEO Landing Page
34.4 PHP Content Object设计
<?php
class ContentObject
{
private $title;
private $objects=[];
private $relations=[];
private $data=[];
public function setTitle($title)
{
$this->title=$title;
}
public function addObject($object)
{
$this->objects[]=$object;
}
public function addRelation($relation)
{
$this->relations[]=$relation;
}
}
?>
对应:
EOM内容模型。
34.5 内容生成引擎设计
WSaiOS:
建立:
Content Engine
结构:
Content Engine
|
--------------------
Content Planner
Content Builder
Template Engine
Schema Engine
Validator
Publisher
--------------------
34.6 Content Planner内容规划
作用:
根据认知结果:
决定生成什么内容。
例如:
输入:
Object:
Miami Distributor
Relation:
Supply Electric Toothbrush
规划:
页面类型:
Supplier Landing Page
内容模块:
Company
Product
Market
FAQ
Schema
PHP:
class ContentPlanner
{
public function plan($object)
{
return [
"type"=>"geo_page"
];
}
}
34.7 Template Engine模板引擎
WSaiOS采用:
Smarty。
原因:
Smarty天然适合:
MVC分离。
结构:
Controller
↓
Content Engine
↓
Smarty Template
↓
HTML
模板:
geo_supplier.tpl
<h1>
{$title}
</h1>
<p>
产品:
{$product}
</p>
<p>
地区:
{$city}
</p>
<p>
角色:
{$role}
</p>
34.8 内容数据注入
Controller:
$smarty->assign(
"content",
$contentObject
);
$smarty->display(
"geo_supplier.tpl"
);
Smarty:
接收:
认知结果。
生成:
页面。
34.9 Schema Engine结构化输出
SEO页面:
不仅需要文字。
需要:
结构化数据。
例如:
Organization Schema:
{
"@type":"Organization",
"name":"Supplier A",
"areaServed":"Miami"
}
WSaiOS:
根据:
Object生成Schema。
PHP:
class SchemaEngine
{
public function create($object)
{
return [
"type"=>"Organization",
"name"=>$object->name
];
}
}
34.10 Content与Knowledge连接
内容不是独立生成。
来源:
知识库。
流程:
Knowledge Object
↓
Content Object
↓
Template
↓
HTML Page
例如:
知识:
Supplier A
生产
Electric Toothbrush
生成:
内容:
Supplier A provides electric toothbrush manufacturing services.
34.11 GEO自动页面生成流程
完整:
关键词输入
↓
GEO Object
↓
Knowledge Matching
↓
Opportunity Decision
↓
Content Object
↓
Smarty Template
↓
SEO HTML
↓
WordPress Publish
34.12 MVC完整调用
Controller:
class ContentController
{
public function generate()
{
$object=
$this->geoEngine
->analyze();
$content=
$this->contentEngine
->build($object);
$smarty->assign(
"content",
$content
);
$smarty->display(
"page.tpl"
);
}
}
34.13 Validator验证模块
自动生成内容:
必须检查。
Validator:
检查:
标题
关键词
Schema
对象完整性
关系完整性
HTML结构
PHP:
class ContentValidator
{
public function validate($content)
{
return true;
}
}
34.14 Publisher发布模块
生成以后:
发布:
例如:
WordPress。
流程:
Content Object
↓
HTML
↓
WP API
↓
Post
PHP:
class Publisher
{
public function publish($content)
{
//发布文章
}
}
34.15 WSaiOS内容生成闭环
完整:
用户需求
↓
认知分析
↓
知识匹配
↓
商业判断
↓
内容模型
↓
模板生成
↓
页面发布
↓
用户访问
↓
反馈数据
↓
Memory更新
34.16 本章总结
EOM认为:
内容生成不是文字生成,而是认知结构的外部表达。
WSaiOS内容工程:
Knowledge
↓
Content Object
↓
Template Engine
↓
Smarty
↓
HTML
↓
Application
软件结构:
PHP OOP
↓
MVC
↓
Cognitive Service
↓
Content Engine
↓
Smarty
↓
Website Application
下一章:
第三十五章:WSaiOS EOM知识库与记忆数据库工程实现——MySQL数据结构设计
重点研究:
- 对象表设计;
- 关系表设计;
- 知识表设计;
- 记忆表设计;
- GEO商业知识库实际数据库结构;
- PHP Model与MySQL连接实现。