-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
1,979 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ uuid = "11330a76-bea1-45e0-8f80-7114e2f607b1" | |
authors = ["ARCJ137442 <[email protected]>"] | ||
git-tree-sha1 = "308b5830bd3f1eb7f6bde386a3a23b3ce8b3365e" | ||
repo-url = "https://github.com/ARCJ137442/JuNarsese.jl" | ||
version = "2.6.2" | ||
version = "2.6.3" | ||
|
||
[deps] | ||
Reexport = "189a3867-3050-52da-a836-e630ba90ab69" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ export StampBasic | |
|
||
|
||
""" | ||
抽象时间戳{时态} | ||
抽象时间戳 | ||
- 统一对接的数据类型 | ||
- 时态(类型参数):存储语句作为事件所发生的时间 | ||
- 参考: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
""" | ||
提供基本的词项定义 | ||
## 架构总览(最后更新于20230901 8:52:54) | ||
## 作为**类型参数**的抽象类型 | ||
- 外延内涵 | ||
- 外延 | ||
- 内涵 | ||
- 逻辑操作 | ||
- 与 | ||
- 或 | ||
- 非 | ||
- 变量类型 | ||
- 独立 | ||
- 非独 | ||
- 查询 | ||
- 时序关系 | ||
- 序列 | ||
- 平行 | ||
- 陈述类型 | ||
- 继承 | ||
- 相似 | ||
- 蕴含{时态} | ||
- 等价{时态} | ||
- 复合词项类型 | ||
- 词项集{外延内涵} | ||
- 词项逻辑集{外延内涵,逻辑操作} | ||
- 乘积 | ||
- 像{外延内涵} | ||
- 陈述逻辑集{逻辑操作} | ||
- 陈述时序集{时序关系} <: 陈述逻辑集{与} | ||
## 实现**数据结构**的具体类型 | ||
- ^词项 | ||
- ^原子 | ||
- 词语 | ||
- 像占位符 | ||
- 变量{变量类型} | ||
- 间隔 | ||
- 操作符 | ||
- ^复合词项{复合词项类型} | ||
- 通用复合词项{CT} <: ^复合词项{CT} | ||
- 像{EI} <: ^复合词项{复合词项类型_像{EI}} | ||
- ^陈述{陈述类型} | ||
- 陈述{T} <: ^陈述{T} | ||
(使用`^`标注抽象类型) | ||
📄具体在Narsese的文本表示,参见Conversion/core/string.jl | ||
## 参考 | ||
- OpenJunars 词项层级结构 | ||
## 现况 | ||
- 📌现在不使用「deepcopy」对词项进行深拷贝:将「拷贝与否」交给调用者 | ||
- 【20230803 11:31:40】暂不将整个文件拆分为「Narsese1-8」的形式,而是以[NAL-X]的格式标注其来源 | ||
""" | ||
module Terms | ||
|
||
# 引入 # | ||
|
||
# 抽象概念 | ||
include("concepts.jl") | ||
|
||
# 数据结构 | ||
include("structs.jl") | ||
|
||
# 别名 | ||
include("aliases.jl") | ||
|
||
# 方法 | ||
include("methods.jl") | ||
|
||
# 快捷构造方式 | ||
include("constructor_shortcuts.jl") | ||
|
||
# 副系词 | ||
include("secondary_copulas.jl") | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
#= | ||
存放各类Narsese词项类名的别名 | ||
- 缩写 | ||
- 归类(Union) | ||
现况: | ||
- 【20230724 18:08:29】使用连等号🆚使用常量(连等号定义常量问题) | ||
=# | ||
|
||
# 导出 | ||
export Term, ATerm, Atom, AAtom, ACompound | ||
export Compound, CCompound | ||
export Var, Op | ||
export TermSet, TermLogicalSet, TermProduct, StatementLogicalSet, StatementTemporalSet | ||
export TSet | ||
export TLSet, TermLSet, TLogicSet | ||
export TImage, TProduct | ||
export SLSet, StatementLSet, SLogicSet | ||
export STSet, StatementTSet, STemporalSet | ||
|
||
export AVType, AVariableType | ||
export VTIndependent, VTDependent, VTQuery | ||
# export Independent, VTIndependent # 【20230730 22:54:28】删去非VT别名,因:与「标点」的「Query请求」重名 | ||
# export Dependent, VTDependent | ||
# export Query, VTQuery | ||
|
||
export ACType, ACompoundType, AbstractCompoundType | ||
|
||
export ALOperation, ALogicOperation | ||
|
||
export IVar, DVar, QVar | ||
export STInheritance, STSimilarity, STImplication, STEquivalence, | ||
Inheritance, Similarity, Implication, Equivalence | ||
export TemporalStatementTypes | ||
export AStatement, AbstractStatement | ||
|
||
export ASType, AStatementType, AbstractStatementType | ||
export STImplicationRetrospective, STImplicationConcurrent, STImplicationPredictive | ||
export ImplicationRetrospective, ImplicationConcurrent, ImplicationPredictive | ||
export STEquivalenceRetrospective, STEquivalenceConcurrent, STEquivalencePredictive | ||
export EquivalenceRetrospective, EquivalenceConcurrent, EquivalencePredictive | ||
export STImplicationRetrospective, STImplicationConcurrent, STImplicationPredictive | ||
export ImplicationRetrospective, ImplicationConcurrent, ImplicationPredictive | ||
export STEquivalenceRetrospective, STEquivalenceConcurrent, STEquivalencePredictive | ||
export EquivalenceRetrospective, EquivalenceConcurrent, EquivalencePredictive | ||
|
||
export CTTermSet, CTTermLogicalSet, CTTermProduct, CTTermImage, CTStatementLogicalSet, CTStatementTemporalSet | ||
|
||
export Negation, Conjunction, Disjunction | ||
export ExtSet, ExtensionSet, | ||
IntSet, IntensionSet | ||
export ExtImage, ExtensionImage, | ||
IntImage, IntensionImage | ||
export ExtIntersection, ExtensionIntersection, | ||
IntIntersection, IntensionIntersection | ||
export ExtUnion, ExtensionUnion, IntUnion, IntensionUnion | ||
export ExtDiff, ExtensionDiff, ExtDifference, ExtensionDifference, | ||
IntDiff, IntensionDiff, IntDifference, IntensionDifference | ||
export ParConjunction, SeqConjunction | ||
|
||
export ATense, Tense, TTense | ||
export Eternal, Past, Present, Future | ||
export Retrospective, Concurrent, Predictive # 用于「时序蕴含/等价」的别名 | ||
|
||
# 抽象类型 # | ||
const AVType = AVariableType = AbstractVariableType | ||
const VTIndependent = VariableTypeIndependent | ||
const VTDependent = VariableTypeDependent | ||
const VTQuery = VariableTypeQuery # 【20230730 22:54:28】删去非VT别名,因:与「标点」的「Query请求」重名 | ||
|
||
const ALOperation = ALogicOperation = AbstractLogicOperation | ||
|
||
const ACType = ACompoundType = AbstractCompoundType | ||
|
||
const Tense = ATense = AbstractTense | ||
const TTense = Type{<:Tense} | ||
|
||
# 用于「时序蕴含/等价」的别名 | ||
const Retrospective::DataType = TensePast | ||
const Concurrent ::DataType = TensePresent | ||
const Predictive ::DataType = TenseFuture | ||
|
||
# 【20230814 16:20:01】注意:Julia以最后一个定义出的别名作为显示用类名 | ||
const Eternal::DataType = TenseEternal | ||
const Past ::DataType = TensePast | ||
const Present::DataType = TensePresent | ||
const Future ::DataType = TenseFuture | ||
|
||
# 根类型 # | ||
# 省去Abstract前缀 | ||
const Term = ATerm = AbstractTerm # 省去Abstract前缀 | ||
|
||
# 原子词项 # | ||
const Atom = AAtom = AbstractAtom | ||
const Var = Variable | ||
const Op = Operator | ||
|
||
# 各类型变量 | ||
const IVar = Variable{VTIndependent} | ||
const DVar = Variable{VTDependent} | ||
const QVar = Variable{VTQuery} | ||
|
||
# 复合词项 # | ||
# 结构 | ||
const ACompound = AbstractCompound | ||
const Compound = CCompound = CommonCompound | ||
# 类型 | ||
const CTTermSet = CompoundTypeTermSet | ||
const CTTermLogicalSet = CompoundTypeTermLogicalSet | ||
const CTTermProduct = CompoundTypeTermProduct | ||
const CTTermImage = CompoundTypeTermImage | ||
const CTStatementLogicalSet = CompoundTypeStatementLogicalSet | ||
const CTStatementTemporalSet = CompoundTypeStatementTemporalSet | ||
|
||
const AStatement = AbstractStatement | ||
|
||
# 复合词项:先定义泛型,再定义别名 | ||
const TermSet{EI} = Compound{CTTermSet{EI}} where EI <: AbstractEI | ||
const TermLogicalSet{EI, LO} = Compound{CTTermLogicalSet{EI, LO}} where {EI <: AbstractEI, LO <: AbstractLogicOperation} | ||
# const TermImage = Compound{CTTermImage} # 默认就是「像」,无需重定向 | ||
const TermProduct = Compound{CTTermProduct} | ||
const StatementLogicalSet{LO} = Compound{CTStatementLogicalSet{LO}} where {LO <: AbstractLogicOperation} | ||
const StatementTemporalSet{TR} = Compound{CTStatementTemporalSet{TR}} where {TR <: AbstractTemporalRelation} | ||
|
||
# 上述「泛型」的别名 | ||
const TSet = TermSet | ||
const TLSet = TermLSet = TLogicSet = TermLogicalSet | ||
const TImage = TermImage | ||
const TProduct = TermProduct | ||
const SLSet = StatementLSet = SLogicSet = StatementLogicalSet | ||
const STSet = StatementTSet = STemporalSet = StatementTemporalSet | ||
|
||
# 词项集 | ||
const Negation = StatementLSet{Not} | ||
const Conjunction = StatementLSet{And} | ||
const Disjunction = StatementLSet{Or} | ||
|
||
const ExtSet = ExtensionSet = Compound{CTTermSet{Extension}} | ||
const IntSet = IntensionSet = Compound{CTTermSet{Intension}} | ||
|
||
const ExtImage = ExtensionImage = TermImage{Extension} | ||
const IntImage = IntensionImage = TermImage{Intension} | ||
|
||
# 交集 | ||
const ExtIntersection = ExtensionIntersection = TermLSet{Extension, And} | ||
const IntIntersection = IntensionIntersection = TermLSet{Intension, And} | ||
|
||
# 并集(一般不使用) | ||
const ExtUnion = ExtensionUnion = TermLSet{Extension, Or} | ||
const IntUnion = IntensionUnion = TermLSet{Intension, Or} | ||
|
||
const ExtDiff = ExtensionDiff = ExtDifference = ExtensionDifference = TermLogicalSet{Extension, Not} | ||
const IntDiff = IntensionDiff = IntDifference = IntensionDifference = TermLogicalSet{Intension, Not} | ||
|
||
# 陈述时序集(原创) | ||
const ParConjunction = STSet{Parallel} | ||
const SeqConjunction = STSet{Sequential} | ||
|
||
# 陈述 # | ||
|
||
# 类型 | ||
const ASType = AStatementType = AbstractStatementType | ||
|
||
const STInheritance = StatementTypeInheritance | ||
const STSimilarity = StatementTypeSimilarity | ||
const STImplication = StatementTypeImplication{Eternal} # 【20230804 14:48:54】⚠此处变成了特值「Eternal」 | ||
const STEquivalence = StatementTypeEquivalence{Eternal} # 【20230804 14:48:54】⚠此处变成了特值「Eternal」 | ||
# 三个「带时态蕴含」 | ||
const STImplicationRetrospective = StatementTypeImplication{Retrospective} | ||
const STImplicationConcurrent = StatementTypeImplication{Concurrent} | ||
const STImplicationPredictive = StatementTypeImplication{Predictive} | ||
# 三个「带时态等价」 | ||
const STEquivalenceRetrospective = StatementTypeEquivalence{Retrospective} | ||
const STEquivalenceConcurrent = StatementTypeEquivalence{Concurrent} | ||
const STEquivalencePredictive = StatementTypeEquivalence{Predictive} | ||
|
||
"「有时态系词」:需要有格式`ST{时态<:Tense}`" | ||
const TemporalStatementTypes = Union{ | ||
STImplication, # 所有蕴含 | ||
STEquivalence # 所有等价 | ||
} | ||
|
||
# 构造器 | ||
const Inheritance = Statement{STInheritance} | ||
const Similarity = Statement{STSimilarity} | ||
const Implication = Statement{STImplication} | ||
const Equivalence = Statement{STEquivalence} | ||
# 三个「带时态蕴含」 【20230814 23:14:55】不再采用「Past/Present/Future」别名,此举会导致外部引用发生歧义(显示为原本的「参数类型」形式) | ||
const ImplicationRetrospective = Statement{STImplicationRetrospective} | ||
const ImplicationConcurrent = Statement{STImplicationConcurrent} | ||
const ImplicationPredictive = Statement{STImplicationPredictive} | ||
# 三个「带时态等价」 | ||
const EquivalenceRetrospective = Statement{STEquivalenceRetrospective} | ||
const EquivalenceConcurrent = Statement{STEquivalenceConcurrent} | ||
const EquivalencePredictive = Statement{STEquivalencePredictive} | ||
|
||
# 【20230821 22:14:31】现在只放置别名,那些其他什么的「统称」之类,留给「严格模式」预加载 |
Oops, something went wrong.