WSaiOS EOM模拟人工认知工程理论
第三十三章:WSaiOS GEO认知匹配应用系统实现——基于商业采购场景的工程案例
33.1 从理论模型进入实际应用
前面章节完成:
EOM理论:
Element
↓
Object
↓
Relationship
↓
Knowledge
↓
Memory
↓
Matching
↓
Decision
工程实现:
PHP OOP
↓
MVC
↓
Smarty
↓
MySQL
但是:
一个认知工程系统必须进入实际应用。
本章以:
WSaiOS GEO认知分析系统
作为实际案例。
应用目标:
将商业搜索需求转换为:
认知对象。
例如:
用户输入:
electric toothbrush distributor Miami Florida
传统SEO系统:
认为:
这是一个关键词。
EOM认为:
这是一个:
商业需求认知对象。
33.2 GEO关键词不是关键词,而是认知对象
传统模型:
Keyword
=
字符串
例如:
electric toothbrush distributor Miami Florida
只是:
文本。
EOM转换:
Business Demand Object
{
Product:
Electric Toothbrush
Role:
Distributor
Location:
Miami Florida
Market:
USA
Intent:
Purchase
}
关键词:
变成:
业务对象。
33.3 GEO认知对象模型设计
定义:
GeoObject。
PHP:
class GeoObject
{
private $product;
private $role;
private $country;
private $state;
private $city;
private $intent;
public function setProduct($value)
{
$this->product=$value;
}
public function getProduct()
{
return $this->product;
}
}
对应:
EOM对象。
33.4 输入解析模块
用户输入:
electric toothbrush distributor Miami Florida
进入:
Element Engine。
拆分:
Element:
electric toothbrush
Type:
Product
Element:
distributor
Type:
Role
Element:
Miami
Type:
City
Element:
Florida
Type:
State
PHP:
class ElementParser
{
public function parse($text)
{
$elements=[];
//规则分析
return $elements;
}
}
33.5 Object Engine生成商业对象
输入元素:
Product
Role
Location
生成:
Geo Demand Object
{
product:
electric toothbrush
role:
distributor
city:
Miami
state:
Florida
}
PHP:
class GeoObjectEngine
{
public function create(
$elements
)
{
$object=
new GeoObject();
foreach($elements as $element)
{
//组合对象
}
return $object;
}
}
33.6 GEO知识库设计
知识库不是关键词表。
传统:
keywords:
electric toothbrush distributor Miami
WSaiOS:
知识对象:
Object:
Miami Electric Toothbrush Distributor
Attributes:
city:
Miami
product:
Electric Toothbrush
role:
Distributor
Relations:
Supplier
↓
Supply
↓
Product
Experience:
High demand
33.7 MySQL认知知识库结构
geo_objects表
保存对象:
CREATE TABLE geo_objects
(
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
type VARCHAR(100),
product VARCHAR(100),
role VARCHAR(100),
city VARCHAR(100),
state VARCHAR(100),
country VARCHAR(100)
);
数据:
| name | product | role | city |
|---|---|---|---|
| Miami Electric Toothbrush Distributor | Electric Toothbrush | Distributor | Miami |
33.8 geo_relationships关系表
保存关系:
CREATE TABLE geo_relationships
(
id INT AUTO_INCREMENT PRIMARY KEY,
source_id INT,
relation VARCHAR(100),
target_id INT
);
例如:
Miami Distributor
↓
supplies
↓
Electric Toothbrush
33.9 GEO Matching Engine设计
用户:
输入:
electric toothbrush supplier Miami
生成:
需求对象:
Demand Object
product:
electric toothbrush
role:
supplier
city:
Miami
调用:
MatchingService。
流程:
Demand Object
↓
Object Matcher
↓
Relation Matcher
↓
Knowledge Matcher
↓
Memory Score
↓
Result
33.10 Object Matcher实现
class GeoObjectMatcher
{
public function match(
$input,
$object
)
{
$score=0;
if(
$input->product
==
$object->product
)
{
$score+=40;
}
if(
$input->city
==
$object->city
)
{
$score+=30;
}
return $score;
}
}
33.11 Relation Matcher实现
判断:
业务关系。
例如:
用户:
采购。
需要:
Supplier
↓
Supply
↓
Product
代码:
class GeoRelationMatcher
{
public function match($relation)
{
if(
$relation=="supply"
)
{
return 30;
}
return 0;
}
}
33.12 Memory评分加入
知识匹配:
不是唯一因素。
加入经验:
例如:
某城市:
过去:
采购需求高。
Memory:
Miami
electric toothbrush
demand probability:
85%
PHP:
class GeoMemoryService
{
public function score(
$object
)
{
return 85;
}
}
33.13 最终评分模型
WSaiOS:
综合:
Score
=
Object Match
+
Relation Match
+
Memory Score
例如:
结果:
| 项目 | 分数 |
|---|---|
| 产品匹配 | 40 |
| 地区匹配 | 30 |
| 商业关系 | 20 |
| 历史经验 | 10 |
总分:
90
输出:
Miami Electric Toothbrush Distributor
Match:
90%
33.14 Controller工程流程
class GeoController
{
public function analyze()
{
$keyword=
$_GET["keyword"];
$object=
$this->geoEngine
->parse($keyword);
$result=
$this->matchingService
->match($object);
$this->smarty
->assign(
"result",
$result
);
$this->smarty
->display(
"geo.tpl"
);
}
}
33.15 Smarty展示认知结果
geo.tpl:
<h1>
GEO认知分析结果
</h1>
产品:
{$result.product}
地区:
{$result.city}
角色:
{$result.role}
匹配度:
{$result.score}
输出:
GEO认知分析
产品:
Electric Toothbrush
地区:
Miami
角色:
Distributor
商业机会:
High
匹配度:
90%
33.16 WSaiOS GEO应用闭环
完整:
用户关键词
↓
Element解析
↓
Geo Object形成
↓
Relationship分析
↓
Knowledge匹配
↓
Memory评分
↓
Decision
↓
生成SEO页面
↓
用户反馈
↓
Memory更新
33.17 本章总结
本章完成:
EOM从理论进入商业应用。
核心转换:
关键词
↓
认知元素
↓
商业对象
↓
业务关系
↓
知识匹配
↓
商业判断
工程实现:
PHP OOP
↓
MVC Controller
↓
Cognitive Service
↓
Knowledge Model
↓
MySQL
↓
Smarty
↓
商业应用
下一章:
第三十四章:WSaiOS EOM自动内容生成系统实现——从认知结果到智能页面生成
重点研究:
- 为什么内容生成必须建立在认知结构之上;
- Object如何转换为内容模型;
- Template Engine设计;
- PHP Smarty模板生成SEO页面;
- GEO自动发布系统实现。