-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v0_0_2_pre_alpha' into v0_0_2_pre_alpha
- Loading branch information
Showing
109 changed files
with
46,389 additions
and
377 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ __pycache__/ | |
Tests/*.png | ||
*.pkl | ||
!pynars/utils/SparseLUT/*.pyd | ||
temp/ | ||
|
||
# C extensions | ||
*.so | ||
|
||
|
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,8 @@ | ||
<a --> b>. %1.00;0.90% | ||
<b --> c>. %1.00;0.90% | ||
<c --> d>. %1.00;0.90% | ||
<a --> d>? | ||
|
||
11000 | ||
|
||
''outputMustContain('<a --> d>. %1.00;0.73%') |
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,15 @@ | ||
' from https://code.google.com/archive/p/open-nars/issues/47 | ||
<{t1,{t2,{t3}}} --> [p1,[p2,[p3]]]>. %1.00;0.90% | ||
<c <-> t3>. %1.00;0.90% | ||
|
||
<{t1,{t2,{c}}} --> [p1,[p2,[p3]]]>? | ||
500 | ||
|
||
' |- | ||
|
||
' answer provided by OpenNARS 3.0.2 and 3.0.3 | ||
''outputMustContain('<{t1,{t2,{c}}} --> [[[p3],p2],p1]>. %1.00;0.59%') | ||
|
||
' right answer should be | ||
'''outputMustContain('<{t1,{t2,{c}}} --> [[[p3],p2],p1]>. %1.00;0.81%') | ||
' because it can use conj |
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,10 @@ | ||
//tom is a cat | ||
<{tom} --> cat>. | ||
//tom likes the sky | ||
<(*,{tom},{sky}) --> likes>. | ||
//the sky is blue | ||
<{sky} --> [blue]>. | ||
//cats like blue? | ||
<(*,cat,[blue]) --> likes>? | ||
10000 | ||
''outputMustContain('<(*,cat,[blue]) --> likes>. %1.00;0.37%') |
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,12 @@ | ||
'*silence=80 | ||
|
||
<0 --> num>. %1.00;0.90% | ||
<<$1 --> num> ==> <(*,$1) --> num>>. %1.00;0.90% | ||
<(*,(*,(*,(*,(*,0))))) --> num>? | ||
|
||
50000 | ||
|
||
''outputMustContain('') | ||
//''outputMustContain('<(*,(*,(*,(*,(*,0))))) --> num>.') | ||
''//outputMustContain('<(*,(*,(*,(*,(*,0))))) --> num>. %1.00') | ||
''//outputMustContain('<(*,(*,(*,(*,(*,0))))) --> num>. %1.00;0.53%') |
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,10 @@ | ||
<<$1 --> number> ==> <(/,successor,$1,_) --> number>>. | ||
<0 --> number>. | ||
<(/,successor,(/,successor,0,_),_) --> number>? | ||
|
||
20000 | ||
|
||
''outputMustContain('<(/,successor,0,_) --> number>.') | ||
//''outputMustContain('<(/,successor,(/,successor,0,_),_) --> number>.') | ||
//''outputMustContain('<(/,successor,(/,successor,0,_),_) --> number>. %1.00;0.73%') | ||
|
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,9 @@ | ||
<0 --> num>. %1.00;0.90% | ||
|
||
<<$1 --> num> ==> <(*,$1) --> num>>. %1.00;0.90% | ||
|
||
<(*,(*,(*,0))) --> num>? | ||
|
||
50000 | ||
|
||
''outputMustContain('<(*,(*,(*,0))) --> num>. %1.00;0.66%') |
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,28 @@ | ||
' MLN example by patrick | ||
|
||
' Facts: | ||
<(*,{Anna},{Bob}) --> Friends>. %1.00;0.99% | ||
<(*,{Anna},{Edward}) --> Friends>. %1.00;0.99% | ||
<(*,{Anna},{Frank}) --> Friends>. %1.00;0.99% | ||
<(*,{Edward},{Frank}) --> Friends>. %1.00;0.99% | ||
<(*,{Gary},{Helen}) --> Friends>. %1.00;0.99% | ||
(--,<(*,{Gary},{Frank}) --> Friends>). %1.00;0.99% | ||
<{Anna} --> [Drinks]>. %1.00;0.99% | ||
<{Edward} --> [Smokes]>. %1.00;0.99% | ||
|
||
' Rule0: | ||
' p=0.8, Drinks(x) => Cancer(x) | ||
<<$1 --> [Drinks]> ==> <$1 --> [Cancer]>>. %0.8;0.9% | ||
|
||
' Rule1: | ||
' p=0.8, Smokes(x) => Cancer(x) | ||
<<$1 --> [Smokes]> ==> <$1 --> [Cancer]>>. %0.8;0.9% | ||
|
||
' Rule2: | ||
' p=0.6 Friends(x, y) => (Smokes(x) <=> Smokes(y)) | ||
<<(*,$1,$2) --> Friends> ==> (||, (&&,<$1 --> [Smokes]>,<$2 --> [Smokes]>), (&&,(--,<$1 --> [Smokes]>),(--,<$2 --> [Smokes]>)))>. %0.6;0.9% | ||
|
||
<?who --> [Cancer]>? | ||
1000 | ||
|
||
''outputMustContain('<{Edward} --> [Cancer]>. %0.80;0.71%') |
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,8 @@ | ||
' unittset seq | ||
<a --> A>. :|: %1.00;0.90% | ||
8 | ||
<b --> B>. :|: %1.00;0.90% | ||
8 | ||
<c --> C>. :|: %1.00;0.90% | ||
100 | ||
''outputMustContain('<(&/,<a --> A>,+8,<b --> B>,+8) =/> <c --> C>>. :!16: %1.00;0.42%') |
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,7 @@ | ||
<a --> A>. :|: %1.00;0.90% | ||
8 | ||
<b --> B>. :|: %1.00;0.90% | ||
8 | ||
<c --> C>. :|: %1.00;0.90% | ||
100 | ||
''outputMustContain('<(&/,<a --> A>,+8,<b --> B>,+8) </> <c --> C>>. :!16: %1.00;0.42%') |
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,7 @@ | ||
<a --> A>. :|: %1.00;0.90% | ||
8 | ||
<b --> B>. :|: %1.00;0.90% | ||
8 | ||
<c --> C>. :|: %1.00;0.90% | ||
100 | ||
''outputMustContain('(&/,<a --> A>,+8,<b --> B>,+8,<c --> C>). :!16: %1.00;0.73%') |
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,6 @@ | ||
<(&/,<a --> A>,+10,(^pick,{SELF},a),+10) =/> <a --> B>>. | ||
100 | ||
<a --> A>. :|: | ||
10 | ||
<a --> B>! | ||
''outputMustContain('(^pick,{SELF},a). :!110: %1.00;0.90%') |
7 changes: 7 additions & 0 deletions
7
Tests/examples/multi_steps/nars_memorize_precondition2_parallel.nal
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,7 @@ | ||
<(&/,(&|,<a --> #A>,<a2 --> #A>),+10,(^pick,{SELF},a),+10) =/> <a --> B>>. | ||
100 | ||
<a --> A>. :|: | ||
<a2 --> A>. :|: | ||
10 | ||
<a --> B>! | ||
''outputMustContain('(^pick,{SELF},a). :!110: %1.00;0.90%') |
8 changes: 8 additions & 0 deletions
8
Tests/examples/multi_steps/nars_memorize_precondition2_sequential.nal
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,8 @@ | ||
<(&/,<a --> #A>,+10,<a2 --> #A>,+10,(^pick,{SELF},a),+10) =/> <a --> B>>. | ||
100 | ||
<a --> A>. :|: | ||
10 | ||
<a2 --> A>. :|: | ||
10 | ||
<a --> B>! | ||
''outputMustContain('(^pick,{SELF},a). :!120: %1.00;0.90%') |
8 changes: 8 additions & 0 deletions
8
Tests/examples/multi_steps/nars_memorize_precondition_sequence.nal
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,8 @@ | ||
<(&/,<a --> A>,+10,<x --> y>,+10,(^pick,{SELF},a),+10) =/> <a --> B>>. | ||
100 | ||
<a --> A>. :|: | ||
10 | ||
<x --> y>. :|: | ||
10 | ||
<a --> B>! | ||
''outputMustContain('(^pick,{SELF},a). :!120: %1.00;0.90%') |
6 changes: 6 additions & 0 deletions
6
Tests/examples/multi_steps/nars_memorize_precondition_var1.nal
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,6 @@ | ||
<(&/,<#1 --> A>,+10,(^pick,{SELF},#1),+10) =/> <a --> B>>. | ||
100 | ||
<a --> A>. :|: | ||
10 | ||
<a --> B>! | ||
''outputMustContain('(^pick,{SELF},a). :!110: %1.00;0.90%') |
6 changes: 6 additions & 0 deletions
6
Tests/examples/multi_steps/nars_memorize_precondition_var2.nal
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,6 @@ | ||
<(&/,<a --> A>,+10,(^pick,{SELF},a),+10) =/> <#1 --> B>>. | ||
100 | ||
<a --> A>. :|: | ||
10 | ||
<a --> B>! | ||
''outputMustContain('(^pick,{SELF},a). :!110: %1.00;0.90%') |
6 changes: 6 additions & 0 deletions
6
Tests/examples/multi_steps/nars_memorize_precondition_var3.nal
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,6 @@ | ||
<(&/,<$1 --> A>,+10,(^pick,{SELF},$1),+10) =/> <$1 --> B>>. | ||
100 | ||
<a --> A>. :|: | ||
10 | ||
<a --> B>! | ||
''outputMustContain('(^pick,{SELF},a). :!110: %1.00;0.90%') |
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,20 @@ | ||
'****** Mixed inference | ||
<swan --> bird>. | ||
<swan --> swimmer>. | ||
50 | ||
<bird --> swimmer>? | ||
80 | ||
<gull --> bird>. | ||
<gull --> swimmer>. | ||
80 | ||
<bird --> [feathered]>. | ||
<robin --> [feathered]>. | ||
80 | ||
<robin --> bird>? | ||
100 | ||
<robin --> swimmer>? | ||
7000 | ||
''outputMustContain('<bird --> swimmer>. %1.00;0.45%') | ||
//''outputMustContain('<bird --> swimmer>. %1.00;0.62%') | ||
''outputMustContain('<robin --> bird>. %1.00;0.45%') | ||
''outputMustContain('<robin --> swimmer>. %1.00;0.28%') |
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,13 @@ | ||
// *** Semi-compositionality | ||
<(&,light,[red]) --> traffic_signal>? | ||
5 | ||
<[red] --> traffic_signal>. %0.1% | ||
<light --> traffic_signal>. %0.1% | ||
500 | ||
''outputMustContain('<(&,[red],light) --> traffic_signal>. %0.19;0.81%') | ||
1000 | ||
<{light_1} --> (&,light,[red])>. | ||
<{light_1} --> traffic_signal>. | ||
200000 | ||
''outputMustContain('<(&,[red],light) --> traffic_signal>. %0.30;0.83%') | ||
|
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,20 @@ | ||
// *** Fuzzy concepts | ||
<{John} --> (/,taller_than,{Tom},_)>. | ||
<{John} --> boy>. | ||
5 | ||
<{Tom} --> (/,taller_than,_,boy)>? | ||
''outputMustContain('<boy --> (/,taller_than,{Tom},_)>. %1.00;0.45%') | ||
6 | ||
<{David} --> boy>. | ||
(--,<{David} --> (/,taller_than,{Tom},_)>). | ||
|
||
1000 | ||
|
||
//''outputMustContain('<boy --> (/,taller_than,{Tom},_)>. %0.00;0.40%') | ||
|
||
//''outputMustContain('<{Tom} --> (/,taller_than,_,boy)>. %1.00;0.45%') | ||
1 | ||
<{Karl} --> (/,taller_than,{Tom},_)>. | ||
<{Karl} --> boy>. | ||
500000 | ||
''outputMustContain('<boy --> (/,taller_than,{Tom},_)>. %0.67;0.71%') |
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,14 @@ | ||
<a --> A>. :|: %1.00;0.90% | ||
8 | ||
<b --> B>. :|: %1.00;0.90% | ||
8 | ||
<c --> C>. :|: %1.00;0.90% | ||
8 | ||
<a --> A>. :|: %1.00;0.90% | ||
100 | ||
<b --> B>. :|: %1.00;0.90% | ||
20000 | ||
<?1 =/> <c --> C>>? | ||
''outputMustContain('<(&/,<a --> A>,+8,<b --> B>,+8) =/> <c --> C>>. :!16: %1.00;0.42%') | ||
''outputMustContain('<(&/,<b --> B>,+8) =/> <c --> C>>. %0.50;0.62%') | ||
''outputMustContain('<(&/,<a --> A>,+16) =/> <c --> C>>. %0.50;0.62%') |
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,8 @@ | ||
<(*,a,b) --> like>. %1.00;0.90% | ||
<(*,b,c) --> like>. %1.00;0.90% | ||
<(*,a,c) --> like>. %1.00;0.90% | ||
<<(*,b,$1) --> like> ==> <(*,a,$1) --> like>>? | ||
//<(&&,<(*,#1,$2) --> like>,<(*,$3,#1) --> like>) ==> <(*,$3,$2) --> like>>? | ||
210000 | ||
''outputMustContain('<<(*,b,$1) --> like> ==> <(*,a,$1) --> like>>. %1.00;0.45%') | ||
''outputMustContain('<(&&,<(*,#1,$2) --> like>,<(*,$3,#1) --> like>) ==> <(*,$3,$2) --> like>>. %1.00;0.26%') |
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,33 @@ | ||
' stress test | ||
' from https://code.google.com/archive/p/open-nars/issues/1 | ||
|
||
<{b1} --> bird>. | ||
<{b1} --> fly>. | ||
<{b2} --> bird>. | ||
<{b2} --> fly>. | ||
<{b3} --> bird>. | ||
<{b3} --> fly>. | ||
<{b4} --> bird>. | ||
<{b4} --> fly>. | ||
<{b5} --> bird>. | ||
<{b5} --> fly>. | ||
<{b6} --> bird>. | ||
<{b6} --> fly>. | ||
<{b7} --> bird>. | ||
<{b7} --> fly>. | ||
<{b8} --> bird>. | ||
<{b8} --> fly>. | ||
<{b9} --> bird>. | ||
<{b9} --> fly>. | ||
<{bA} --> bird>. | ||
<{bA} --> fly>? | ||
|
||
' expected answers on a good run | ||
' Answer <{bA} --> fly>. %1.00;0.27% {2176 | ||
' Answer <{bA} --> fly>. %1.00;0.40% {6305 | ||
' Answer <{bA} --> fly>. %1.00;0.44% {32125 | ||
' Answer <{bA} --> fly>. %1.00;0.78% {44080 | ||
|
||
' give enough time | ||
60000 | ||
''outputMustContain('<{bA} --> fly>. %1.00;0.77%') |
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
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
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
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
Oops, something went wrong.