Skip to content

Commit

Permalink
Merge pull request #2 from ARCJ137442:dev
Browse files Browse the repository at this point in the history
Dev: 少量新特性,bug修复,依赖升级,文档修缮
  • Loading branch information
ARCJ137442 authored Apr 13, 2024
2 parents 0d9d6f0 + ff22133 commit efdf67e
Show file tree
Hide file tree
Showing 20 changed files with 298 additions and 112 deletions.
33 changes: 23 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "babel_nar"
version = "0.20.1"
version = "0.21.0"
edition = "2021"
description = """
Implementation and application supports of the NAVM model
Expand All @@ -25,7 +25,7 @@ repository = "https://github.com/ARCJ137442/BabelNAR.rs"
# 用于错误处理
thiserror = "1.0.58"
anyhow = "1.0.81"
clearscreen = "2.0.1"
clearscreen = "3.0.0"

[dependencies.nar_dev_utils]
# 【2024-03-13 21:17:55】实用库现在独立为`nar_dev_utils`
Expand Down
11 changes: 11 additions & 0 deletions README.en-us.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# BabelNAR.rs

[简体中文](./README.md) | English

🏗️The **English document** of the project is still under preparation. PR is welcome.

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)

Implementation and application supports of the NAVM model

⚠️【2024-04-03 15:12:55】**This documentation is still in progress. For full and latest content, please refer to [the Simplified Chinese version](README.zh-cn.md).**
81 changes: 78 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,84 @@
# BabelNAR.rs

English | [简体中文](README.zh-cn.md)
简体中文 | [English](./README-en-us.md)

🏗️项目的**英文文档**尚在筹建,有意者欢迎提交PR

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)

Implementation and application supports of the NAVM model
该项目使用[语义化版本 2.0.0](https://semver.org/)进行版本号管理。

[**NAVM.rs**](https://github.com/ARCJ137442/NAVM.rs)[CIN](#cin-computer-implement-of-nars)**启动器****运行时**及应用程序实现

- 前身为[**BabelNAR.jl**](https://github.com/ARCJ137442/BabelNAR.jl)
- ✨为「非公理虚拟机模型」提供程序实现
- ✨统一各[CIN](#cin-computer-implement-of-nars)**输入输出**形式,聚合使用各大NARS实现
- ✨提供一个方便使用的CLI工具,以便从配置中快速启动、测试各类NARS实现
- 🎯一站式NARS**启动器**
- 🎯NARS**交叉测试**工具

<!-- ## 安装 -->

<!-- * 📌【2024-04-10 10:19:40】有关具体环节,在crates.io中已经完善 -->

## 使用

### CLI

- 使用 JSON/HJSON 配置文件 (`.json`/`.hjson`)
- 格式可参考项目测试代码
- Rust调用侧:可参考项目测试代码

🏗️TODO(接受贡献)

## 概念

### CIN (Computer Implement of NARS)

- 「NARS计算机实现」之英文缩写
- 指代所有**实现NARS**的计算机软件系统
- 不要求完整实现NAL 1~9

### ***CommonNarsese***

🔗参考[**NAVM.jl**的对应部分](https://github.com/ARCJ137442/navm.jl?tab=readme-ov-file#commonnarsese)

## 各CIN对接情况

🕒最后更新时间:【2024-03-26 01:43:28】

| CIN | 实现方法 | 进程安全 | 输入转译 | 输出转译 |
| :---------- | :---------: | :--: | :--: | :--: |
| OpenNARS | `java -jar` ||| 🚧 |
| ONA | 直接启动exe ||| 🚧 |
| PyNARS | `python -m` || 🚧 | 🚧 |
| NARS-Python | 直接启动exe ||||
| OpenJunars | `julia` ||||

注:

- 🚧输入输出转译功能仍然在从[BabelNAR_Implements](https://github.com/ARCJ137442/BabelNAR_Implements.jl)迁移
- ❓NARS-Python的exe界面可能会在终止后延时关闭
- ❌基于`julia`启动OpenJunars脚本`launch.jl`时,对「输出捕获」尚未有成功记录
- ❌目前对NARS-Python的「输出捕获」尚未有成功记录

## CLI测试:各CIN完成度评估

🕒最后更新时间:【2024-04-07 16:52:29】

| | 简单演绎 | 高阶演绎 | 自变量消除 | 时间归纳 | 简单操作 | 时序操作 |
| :--- | :--: | :--: | :--: | :--: | :--: | :--: |
| 原理 | 继承关系的传递性 | 蕴含关系的蕴含保真 | 代入消元 | 前后事件的联系 | 直接要求「做某事」 | 在「发生某事,做某事,目标达成」中学会「若发生某事,就做某事」 |
| 对应NAL内容 | NAL-1 | NAL-5 | NAL-5 + NAL-6 | NAL-7 | NAL-8 | NAL-7 + NAL-8 |
| 语句输入 | `<A --> B>.` + `<B --> C>.` | `<<A --> B> ==> <C --> D>>.` + `<A --> B>.` | `<<A --> $1> ==> <$1 --> C>>.` + `<A --> B>.` | `<A --> B>. :\|:` + `<C --> D>. :\|:` | `<(*, ...) --> ^left>! :\|:` | `A. :\|:` + `<(*, {SELF}) --> ^left>. :\|:` + `G. :\|:` + `<(&/, A, <(*, ...) --> ^left>) ==> G>?` + `G! :\|:` |
| 预期输出 | `<A --> C>.` | `<C --> D>.` | `<B --> C>.` | `<<A --> B> =/> <C --> D>>.` | EXE `<(*, ...) --> ^left> :\|:` | EXE `<(&/, A, <(*, ...) --> ^left>) ==> G>` |
| OpenNARS(3.0.4) |||||||
| ONA |||||||
| PyNARS |||||||
| CXinNARS |||||||

## 参考

⚠️【2024-04-03 15:12:55】**This documentation is still in progress. For full and latest content, please refer to [the Simplified Chinese version](README.zh-cn.md).**
- [BabelNAR](https://github.com/ARCJ137442/BabelNAR.jl)
- [BabelNAR_Implements](https://github.com/ARCJ137442/BabelNAR_Implements.jl)
- [NAVM.rs](https://github.com/ARCJ137442/NAVM.rs)
65 changes: 0 additions & 65 deletions README.zh-cn.md

This file was deleted.

5 changes: 5 additions & 0 deletions src/bin/babelnar_cli/runtime_manage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ where
fn add_output_listener(output_cache: &mut OutputCache) {
output_cache.output_handlers.add_handler(|output| {
// 打印输出
// * 🚩【2024-04-13 17:57:32】暂不启用「详细输出」模式:尚未解决「详细输出后过长,但因信息取舍不能省掉『原始信息』」的问题
// * 💭CIN的「原始输出」总是信息量相对最多的(NAVM输出只取其中一个规则的子集)
// * 📌因此,开启「详细模式」必定造成「信息冗余」
// TODO: 💡或许后续可用配置开关「详细模式/纯NAVM输出模式」,以实现「自定义输出形式」
// * ✨这样的形式也方便调用其exe的其它外部程序解析exe输出(更为规范化)
println_cli!(&output);
// 继续返回
Some(output)
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cin_launcher/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const TEST_PATH_PYNARS: (&str, &str) = (PYNARS_ROOT, "pynars.ConsolePlus");
/// 启动并获取NARS
/// * 🚩【2024-03-27 18:55:07】目前就返回一个测试用的运行时
/// * 🎯敏捷开发用
fn get_nars() -> impl VmLauncher<CommandVmRuntime> {
fn get_nars() -> impl VmLauncher<Runtime = CommandVmRuntime> {
// OpenNARS::new(TEST_PATH_OPENNARS)
PyNARS::new(TEST_PATH_PYNARS.0, TEST_PATH_PYNARS.1)
// ONA::new(TEST_PATH_ONA)
Expand Down
3 changes: 2 additions & 1 deletion src/cin_implements/cxin_js/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ impl CXinJS {
}

/// 启动到「命令行运行时」
impl VmLauncher<CommandVmRuntime> for CXinJS {
impl VmLauncher for CXinJS {
type Runtime = CommandVmRuntime;
fn launch(self) -> Result<CommandVmRuntime> {
// 构造并启动虚拟机
pipe! {
Expand Down
3 changes: 2 additions & 1 deletion src/cin_implements/nars_python/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ impl NARSPython {
}

/// 启动到「命令行运行时」
impl VmLauncher<CommandVmRuntime> for NARSPython {
impl VmLauncher for NARSPython {
type Runtime = CommandVmRuntime;
fn launch(self) -> Result<CommandVmRuntime> {
// 构造指令,并启动虚拟机
manipulate!(
Expand Down
3 changes: 2 additions & 1 deletion src/cin_implements/ona/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ impl ONA {
}

/// 启动到「命令行运行时」
impl VmLauncher<CommandVmRuntime> for ONA {
impl VmLauncher for ONA {
type Runtime = CommandVmRuntime;
fn launch(self) -> Result<CommandVmRuntime> {
// 构造并启动虚拟机
let mut runtime = pipe! {
Expand Down
Loading

0 comments on commit efdf67e

Please sign in to comment.