第20章 Information Type
本章大纲
- 文字信息
- 语言信息
- 指示信息
- 指令信息
- 数据信息
- 事件信息
- 状态信息
- 设备信息
- 场景信息
- 外部系统信息
- 信息类型判断
- 信息类型代码实现
20.1 文字信息
**文字信息(Text Information)**是以文字、字符、文本记录等形式进入 SAI 的信息。
例如:
“今天深圳天气很热”
“房间温度是32度”
“风扇没有打开”
文字信息的核心特征是:
Text
↓
Information
↓
Perception
↓
Element
文字本身只是信息载体。
例如:
“温度32度”
进入 SAI 后,并不是直接成为认知结果,而是需要进一步识别:
元素:
温度
数值:
32
单位:
度
对象:
房间
因此:
文字信息 ≠ 认知结果
文字只是 Information 的一种表现形式。
20.2 语言信息
**语言信息(Language Information)**是通过自然语言表达的信息。
例如:
“帮我打开客厅的风扇。”
“现在房间里面有人吗?”
“把温度降低一点。”
它与文字信息存在交集,但概念侧重点不同:
文字信息
→ 强调信息的文字载体
语言信息
→ 强调信息通过语言表达
语言信息可以来自:
语言
↓
语音识别结果
↓
Language Information
也可以直接来自文字:
Text
↓
Language Information
例如:
“打开风扇”
可能首先是:
TextInformation
经过语言识别和结构分析后,可以形成:
LanguageInformation
再进一步识别其意图:
Action = turnOn
Object = fan
这时才可能进入指示或指令处理。
20.3 指示信息
**指示信息(Indication Information)**用于告诉 Individual 某个目标、方向、状态、位置或关注对象。
例如:
“注意右边。”
“看前面的车辆。”
“目标在左侧。”
“检查这个设备。”
指示信息与指令信息不同。
例如:
“前面有障碍物。”
属于信息描述。
而:
“注意前方障碍物。”
更接近指示。
指示信息可以帮助 SAI 确定:
关注什么?
关注哪里?
关注哪个对象?
关注哪个方向?
例如:
Indication
├── Target
├── Direction
├── Location
├── Focus
└── Object
因此:
指示信息
↓
确定关注对象
↓
Perception / Cognition
20.4 指令信息
**指令信息(Instruction Information)**表示要求 Individual 或外部设备执行某种操作的信息。
例如:
打开风扇
关闭灯
移动到房间
检查设备
停止电机
可以抽象为:
Instruction
├── Action
├── Object
├── Parameter
└── Constraint
例如:
打开风扇
可以形成:
Action = turnOn
Object = Fan
又例如:
把风扇速度设置为3
可以形成:
Action = setSpeed
Object = Fan
Parameter:
speed = 3
需要注意:
Instruction 是 Information Type,而不是 Decision。
例如:
用户指令:
打开风扇
这是输入。
而:
Decision:
是否现在执行打开风扇?
这是 Individual 内部的决策过程。
两者不能混淆。
20.5 数据信息
**数据信息(Data Information)**是以结构化或半结构化数据形式提供的信息。
例如:
temperature = 32
humidity = 70
speed = 20
distance = 5
也可以是:
{
"temperature": 32,
"humidity": 70,
"fan": "OFF"
}
数据信息特别适合设备、传感器、数据库和外部系统。
例如:
DataInformation
├── name
├── value
├── unit
├── source
└── time
温度信息:
name = temperature
value = 32
unit = C
source = sensor-01
之后:
DataInformation
↓
Element
↓
Property
↓
Object
例如:
Object = Room
Property = temperature
Value = 32
20.6 事件信息
**事件信息(Event Information)**描述某个事件已经发生、正在发生或即将发生。
例如:
PersonEntered
FanStarted
DoorOpened
TemperatureChanged
DeviceError
事件通常具有时间和对象。
可以表示:
Event
├── id
├── type
├── object
├── time
├── state
└── data
例如:
Event
type = PersonEntered
object = Room-01
time = 14:05:10
进入 SAI:
Event Information
↓
Event Detection
↓
Object / State Change
↓
Cognition
例如:
PersonEntered
↓
Room.state = occupied
这说明事件可以导致状态变化。
20.7 状态信息
**状态信息(State Information)**描述某个对象、设备、Individual 或环境当前所处的状态。
例如:
Fan.state = ON
Door.state = CLOSED
Robot.state = MOVING
Room.state = OCCUPIED
可以表示:
StateInformation
├── Object
├── Property
├── Value
├── Time
└── Source
例如:
Object = Fan
Property = state
Value = ON
Time = 14:10:00
状态信息和事件信息需要区别:
Event
→ 发生了什么
State
→ 现在是什么状态
例如:
事件:
FanStarted
结果:
Fan.state = ON
20.8 设备信息
**设备信息(Device Information)**来自设备本身或描述设备运行状态、能力和数据的信息。
例如:
Device Information
├── Device ID
├── Device Type
├── Device State
├── Device Property
├── Device Capability
├── Device Data
└── Device Event
例如一个温度传感器:
Device
ID = sensor-001
Type = temperature_sensor
产生:
temperature = 32
于是:
Device
↓
Sensor
↓
Data
↓
Information
设备信息还可以描述设备自身:
Device.state = online
Device.power = 80
Device.temperature = 40
因此:
设备信息 ≠ 设备状态
设备状态只是设备信息中的一种内容。
20.9 场景信息
**场景信息(Scene Information)**描述某个时间、空间中多个对象及其关系、状态和环境条件。
场景是 SAI 认识外部世界的重要信息形式。
例如:
Room-01
├── Person
├── Fan
├── Table
├── Temperature
├── Humidity
└── Door
进一步:
Scene
├── Location
├── Time
├── Environment
├── Objects
├── Relations
├── States
└── Events
例如:
Scene Information
Location = Room-01
Objects:
Person
Fan
Door
States:
Person = PRESENT
Fan = OFF
Door = OPEN
Environment:
Temperature = 32
Humidity = 70
场景信息经过感知后,可以建立:
Scene
↓
Elements
↓
Objects
↓
Properties
↓
Relations
↓
States
因此:
场景信息不是单一数值,而是一个具有空间、时间和对象关系的信息集合。
20.10 外部系统信息
**外部系统信息(External System Information)**来自 SAI 之外的其他软件、服务或信息系统。
例如:
External System
├── API
├── Database
├── File
├── Network
├── Map System
├── Business System
└── Other Software
例如 API 返回:
{
"temperature": 32,
"humidity": 70
}
进入 SAI:
External API
↓
Information Receiver
↓
External System Information
↓
Data Information
↓
Perception
数据库也可以作为信息来源:
Database
↓
Record
↓
Information
需要强调:
外部系统只是 Information 的来源,不代表 SAI 必须依赖某一种外部系统。
SAI Framework 可以根据实际应用选择信息来源。
20.11 信息类型判断
Information 接收到以后,SAI 需要判断它属于什么类型。
基本流程:
Information
↓
Type Detection
↓
Information Type
↓
对应处理器
例如:
“打开风扇”
可能判断为:
Text
↓
Language
↓
Instruction
而:
temperature = 32
可能判断为:
Data
↓
Sensor Data
↓
State / Property
例如:
FanStarted
判断为:
Event
20.11.1 类型判断不能只依靠内容
Information Type 最好综合多个字段判断:
Source
+
Content
+
Structure
+
Metadata
+
Context
例如:
source = temperature-sensor
content = 32
unit = C
可以较容易判断:
Sensor / Data Information
如果:
source = human
content = "打开风扇"
则可以进一步判断:
Language
→ Instruction
因此:
Information Type
实际上可以是多层分类,而不是只能有一个标签。
例如:
Information
├── source = human
├── type = language
└── subtype = instruction
或者:
Information
├── source = sensor
├── type = data
└── subtype = temperature
20.11.2 类型判断示例
可以建立简单规则:
IF source = sensor
THEN type = sensor
IF source = device
THEN type = device
IF content.type = event
THEN type = event
IF content contains instruction structure
THEN type = instruction
IF content is numeric/structured data
THEN type = data
进一步:
Human
↓
Language
↓
Instruction
Sensor
↓
Data
↓
Temperature
Device
↓
State
↓
FanState
Environment
↓
Scene
↓
RoomScene
这种方式符合 SAI 的基本思想:
Information
↓
识别
↓
分类
↓
组织
↓
处理
而不是直接把 Information 当作认知结果。
20.12 信息类型代码实现
可以先定义统一的 Information Type。
例如:
<?php
namespace SAI\Information;
class InformationType
{
const TEXT = 'text';
const LANGUAGE = 'language';
const INDICATION = 'indication';
const INSTRUCTION = 'instruction';
const DATA = 'data';
const EVENT = 'event';
const STATE = 'state';
const DEVICE = 'device';
const SCENE = 'scene';
const EXTERNAL = 'external';
}
这样就可以统一使用:
$type = InformationType::DATA;
或者:
$type = InformationType::INSTRUCTION;
20.12.1 Information Type 判断器
可以建立一个简单的 TypeDetector:
<?php
namespace SAI\Information;
class InformationTypeDetector
{
public function detect($information)
{
$source = $information->getSource();
$content = $information->getContent();
if ($source === 'sensor') {
return InformationType::DATA;
}
if ($source === 'device') {
return InformationType::DEVICE;
}
if (is_array($content)) {
if (isset($content['event'])) {
return InformationType::EVENT;
}
if (isset($content['state'])) {
return InformationType::STATE;
}
return InformationType::DATA;
}
if (is_string($content)) {
return InformationType::TEXT;
}
return InformationType::DATA;
}
}
这是一个非常基础的判断器。
它体现的不是复杂模型,而是:
Source
+
Content Structure
+
Rule
↓
Information Type
20.12.2 指令信息的判断
如果进一步增加简单规则:
public function detectInstruction($content)
{
if (!is_string($content)) {
return false;
}
$keywords = array(
'打开',
'关闭',
'启动',
'停止',
'移动',
'检查'
);
foreach ($keywords as $keyword) {
if (strpos($content, $keyword) !== false) {
return true;
}
}
return false;
}
例如:
打开风扇
可以判断:
Language
↓
Instruction
但是这里要注意:
这个示例只是说明“基于规则进行信息类型判断”的基本思想,并不是完整的语言理解系统。
20.12.3 完整类型判断流程
将前面的组件组合起来:
Information
│
▼
InformationTypeDetector
│
├── Source
├── Content
├── Structure
├── Metadata
└── Context
│
▼
Information Type
│
┌────┼────┬────┬────┬────┐
▼ ▼ ▼ ▼ ▼ ▼
Text Language Data Event State Scene
│
▼
Perception
例如:
示例一:人的输入
Source = human
Content = "打开风扇"
判断:
Text
↓
Language
↓
Instruction
示例二:传感器输入
Source = temperature-sensor
Content = 32
Unit = C
判断:
Device
↓
Sensor
↓
Data
示例三:设备状态
Source = fan-001
Content:
state = ON
判断:
Device
↓
State
示例四:环境场景
Source = environment
Room:
Person = PRESENT
Fan = OFF
Temperature = 32
判断:
Scene
示例五:外部 API
Source = external-api
Content:
{
"temperature": 32,
"humidity": 70
}
判断:
External
↓
Data
本章完整信息类型结构
经过本章整理,SAI Framework 可以建立:
Information
│
├── Human Information
│ ├── Text
│ ├── Language
│ ├── Indication
│ └── Instruction
│
├── Data Information
│ ├── Numeric
│ ├── Structured Data
│ └── Sensor Data
│
├── Event Information
│
├── State Information
│
├── Device Information
│
├── Scene Information
│
└── External System Information
├── API
├── Database
├── File
└── Network
同时,实际运行中一种 Information 可以具有多层分类:
Information
↓
Source Type
↓
Information Type
↓
Sub Type
↓
Processing Route
例如:
temperature = 32
Source:
Sensor
Type:
Data
SubType:
Temperature
Object:
Room
Property:
temperature
Value:
32
最终进入:
Information
↓
Information Type
↓
Perception
↓
Element
↓
Object
↓
Relation
↓
Cognition
本章小结
第20章建立的是 Information 的分类体系。
核心分类:
文字信息
语言信息
指示信息
指令信息
数据信息
事件信息
状态信息
设备信息
场景信息
外部系统信息
它们并不是完全互斥的。
例如:
“打开风扇”
可以经历:
Text
↓
Language
↓
Instruction
而:
Temperature Sensor
↓
Device
↓
Data
↓
Temperature
场景则可能包含大量不同类型的信息:
Scene
├── Object
├── Property
├── State
├── Relation
├── Event
└── Environment Data
因此 SAI 的 Information Type 最终可以理解为:
对进入 SAI 的 Information 按来源、结构、内容、用途和上下文进行分类,使不同信息能够进入正确的后续处理路径。
核心流程:
外部世界
↓
Information
↓
Type Detection
↓
Information Type
↓
Perception
↓
Element
↓
Object
↓
Relation
↓
Cognition
本章 PHP 代码和运行流程均为 SAI Framework 教程设计示例,未作为实际项目执行验证。