Skip to content

Commit

Permalink
v0.0.1 pre-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
xubowen committed Feb 16, 2022
1 parent cb893be commit dd5a5c7
Show file tree
Hide file tree
Showing 174 changed files with 748 additions and 577 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ __pycache__/
Tests/*.png
*.pkl
./utils/SparseLUT

temp/
# C extensions
*.so

Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@
"name": "Python: console",
"type": "python",
"request": "launch",
"program": "Console.py",
"module": "pynars.Console",
"console": "integratedTerminal",
"args": [
// "Tests/examples/single_step/nal7/nal7.7.nal"
"Tests/examples/single_step/nal7/nal7.7.nal"
// "Tests/examples/single_step/nal5.query.nal"
]
},
Expand Down
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License

Copyright (c) 2022 PyNARS authors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include requirements.txt
include pynars/*.json
include pynars/utils/SparseLUT/*.pyd
include pynars/utils/SparseLUT/*.pyi
include pynars/Narsese/Parser/*.lark
38 changes: 0 additions & 38 deletions README.en.md

This file was deleted.

55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
# PyNARS

#### 介绍
Python implementation of NARS (Non-Axiomatic-Reasoning-System).
References:
OpenNARS 3.0.4,
Design Report of OpenNARS 3.1.0
#### Description
Python implementation of NARS (Non-Axiomatic-Reasoning-System)

#### 软件架构
软件架构说明
Reference:
- OpenNARS 3.0.4,
- The Design Report of OpenNARS 3.1.0


#### 安装教程
#### Environments

1. xxxx
2. xxxx
3. xxxx
- Python version: 3.7.10.
- Only tested under this version, however, Python 3.7 and higher versions maybe acceptable.
- OS: Windows 10.
- Only tested under this OS, however, other OS might be ok.
- Packages Requirements: see `requirements.txt`.
- It is noted that the version of the python package `tqdm` should be no higher than 3.1.4, otherwise the color display would be abnormal. This is because of a bug of `tqdm`, which leads to conflicts between `sty` and `tqdm` and cause unexpected color display of `sty`. However, this constraints is not necessary, i.e., higher version of `tqdm` is ok if you don't mind abnormal display occuring. The abnormal case only occur when you first run the PyNARS when SparseLUT (Sparse Look-Up Table) is built.

#### 使用说明
#### Installation

1. xxxx
2. xxxx
3. xxxx

#### 参与贡献
pip install pynars

1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request

#### Instructions

#### 特技
1. Copy the file `pynars/config.json` to your workspace-directory. *(Optional)*
2. In the workspace-directory, run cmd `python -m pynars.Console`. To execute an `*.nal` file, run cmd `python -m pynars.Console <your-file-name.nal>`
3. Input Narsese in the console, input an positive integer to run a number of cycles, or input a comment which is a string with `'` as the beginning, e.g. `' your comment`.
4. Press `ctrl`+`C` to exit.

1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
#### Contribution

1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request


**Note:** This document will be imporved in the future.
38 changes: 38 additions & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# PyNARS

#### 介绍
Python implementation of NARS (Non-Axiomatic-Reasoning-System).

Reference:
- OpenNARS 3.0.4,
- The Design Report of OpenNARS 3.1.0


#### 运行环境

- Python版本: 3.7.10.
- 只有这个版本被测试过,但Python 3.7以及更高的版本应该都可以接受。
- 操作系统: Windows 10.
- 仅在这个操作系统下做过测试,但其他的操作系统或许也可以。
- 依赖包: 见`requirements.txt`.
- 请注意包`tqdm` 的版本不应超过3.1.4,否则颜色显示可能会异常。这是因为高版本`tqdm`中的BUG会导致包`sty``tqdm`之间的冲突,`sty`的颜色显示会出现错误。然而,这一约束不是必须的,即如果你不介意颜色显示异常则高版本的`tqdm`也可接受。异常显示只有在第一次运行PyNARS过程中构建稀疏查找表(SparseLUT)时出现。

#### 安装教程


pip install pynars


#### 使用说明

1. 复制文件`pynars/config.json`到你的工作目录。 *(可选)*
2. 在工作目录下,运行命令`python -m pynars.Console`。若需要运行`*.nal`文件,则运行命令`python -m pynars.Console <文件名.nal>`
3. 在控制台中输入纳思语(Narsese),输入正整数运行一定的推理周期,或输入`'`开头的字符串作为i注释(例如`' 这是一条注释`)。
4. 按下`ctrl`+`C`退出。

#### 参与贡献

1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
6 changes: 3 additions & 3 deletions Tests/test_Bag.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from Narsese import Budget
from pynars.Narsese import Budget
import unittest

from NARS.DataStructures import Bag, Task, Concept
from Narsese import Judgement, Term, Statement, Copula, Truth
from pynars.NARS.DataStructures import Bag, Task, Concept
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth

import matplotlib.pyplot as plt

Expand Down
12 changes: 6 additions & 6 deletions Tests/test_Compound.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import NARS
import unittest

from NARS.DataStructures import Bag, Task, Concept, Table
from Narsese import Judgement, Term, Statement, Copula, Truth
from pynars.NARS.DataStructures import Bag, Task, Concept, Table
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth

from pathlib import Path
import Narsese
from Narsese import Compound, Connector
from NAL.MetaLevelInference.VariableSubstitution import *
from Narsese._py.Variable import VarPrefix, Variable
from utils.IndexVar import IndexVar
from pynars.Narsese import Compound, Connector
from pynars.NAL.MetaLevelInference.VariableSubstitution import *
from pynars.Narsese._py.Variable import VarPrefix, Variable
from pynars.utils.IndexVar import IndexVar

class TEST_Compound(unittest.TestCase):
def test_0(self):
Expand Down
8 changes: 4 additions & 4 deletions Tests/test_Concept.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from Narsese import Budget
from pynars.Narsese import Budget
import unittest

from NARS.DataStructures import Bag, Task
from Narsese import Judgement, Term, Statement, Copula, Truth
from pynars.NARS.DataStructures import Bag, Task
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth
import Narsese
from NARS.DataStructures import Concept
from pynars.NARS.DataStructures import Concept

class TEST_Concept(unittest.TestCase):
def __init__(self, methodName: str = ...) -> None:
Expand Down
10 changes: 5 additions & 5 deletions Tests/test_Copula.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from Narsese import Budget
from pynars.Narsese import Budget
import unittest

from NARS.DataStructures import Bag, Task
from Narsese import Judgement, Term, Statement, Copula, Truth
from pynars.NARS.DataStructures import Bag, Task
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth
import Narsese
from NARS.DataStructures import Concept
from Narsese import Copula
from pynars.NARS.DataStructures import Concept
from pynars.Narsese import Copula

class TEST_Concept(unittest.TestCase):
def __init__(self, methodName: str = ...) -> None:
Expand Down
8 changes: 4 additions & 4 deletions Tests/test_EvidentialBase.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from Narsese import Budget
from pynars.Narsese import Budget
import unittest

from NARS.DataStructures import Bag, Task, Concept
from Narsese import Judgement, Term, Statement, Copula, Truth
from pynars.NARS.DataStructures import Bag, Task, Concept
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth

from Narsese import Base, Task
from pynars.Narsese import Base, Task

class TEST_Base(unittest.TestCase):
def __init__(self, methodName: str = ...) -> None:
Expand Down
6 changes: 3 additions & 3 deletions Tests/test_Examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import NARS
import unittest

from NARS.DataStructures import Bag, Task, Concept
from Narsese import Judgement, Term, Statement, Copula, Truth
from pynars.NARS.DataStructures import Bag, Task, Concept
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth

from pathlib import Path
import Narsese

from utils.Print import out_print, PrintType, print_filename
from pynars.utils.Print import out_print, PrintType, print_filename

examples_path = Path(__file__).parent/'examples'

Expand Down
8 changes: 4 additions & 4 deletions Tests/test_GetIndex.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import NARS
import unittest

from NARS.DataStructures import Bag, Task, Concept, Link
from Narsese import Judgement, Term, Statement, Copula, Truth, Connector
from pynars.NARS.DataStructures import Bag, Task, Concept, Link
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth, Connector

from pathlib import Path
import Narsese
from Narsese._py.Compound import Compound
from pynars.Narsese._py.Compound import Compound

from utils.Print import out_print, PrintType, print_filename
from pynars.utils.Print import out_print, PrintType, print_filename

class TEST_Get_Index(unittest.TestCase):
'''Examples files in `application`.'''
Expand Down
8 changes: 4 additions & 4 deletions Tests/test_InferenceEngine.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import NARS
import unittest

from NARS.DataStructures import Bag
from NARS.DataStructures._py.Concept import Concept
from NARS.DataStructures._py.Memory import Memory
from pynars.NARS.DataStructures import Bag
from pynars.NARS.DataStructures._py.Concept import Concept
from pynars.NARS.DataStructures._py.Memory import Memory

from NARS.InferenceEngine import GeneralEngine
from pynars.NARS.InferenceEngine import GeneralEngine
import Narsese


Expand Down
12 changes: 6 additions & 6 deletions Tests/test_Link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import NARS
import unittest

from NARS.DataStructures import Bag, Task, Concept, Link
from NARS.DataStructures._py.Link import LinkType, TaskLink, TermLink
from NARS.DataStructures._py.Memory import Memory
from Narsese import Judgement, Term, Statement, Copula, Truth, Connector
from pynars.NARS.DataStructures import Bag, Task, Concept, Link
from pynars.NARS.DataStructures._py.Link import LinkType, TaskLink, TermLink
from pynars.NARS.DataStructures._py.Memory import Memory
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth, Connector

from pathlib import Path
import Narsese
from Narsese import Compound, Budget
from pynars.Narsese import Compound, Budget

from utils.Print import out_print, PrintType, print_filename
from pynars.utils.Print import out_print, PrintType, print_filename

class TEST_Get_Index(unittest.TestCase):
'''Examples files in `application`.'''
Expand Down
8 changes: 4 additions & 4 deletions Tests/test_Memory.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import NARS
import unittest

from NARS.DataStructures import Bag, Task, Memory, Concept
from NARS.DataStructures._py.Concept import Concept
from Narsese import Judgement, Term, Statement, Copula, Truth
from pynars.NARS.DataStructures import Bag, Task, Memory, Concept
from pynars.NARS.DataStructures._py.Concept import Concept
from pynars.Narsese import Judgement, Term, Statement, Copula, Truth

from pathlib import Path
import Narsese
from Narsese import Compound, Connector
from pynars.Narsese import Compound, Connector


def test_conceptualize(self):
Expand Down
Loading

0 comments on commit dd5a5c7

Please sign in to comment.