rivescript 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changes.md +6 -0
- data/README.md +5 -5
- data/lib/rivescript/brain.rb +12 -2
- data/lib/rivescript/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6cf48d3dc6eeff70e0698b9a7b42c8a9c921636586c561b9eb098af62ca0171e
|
|
4
|
+
data.tar.gz: 296f35bbfbea76b22e4646b3a6a642be7b5da10acaaef69d440e98807a1e9588
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf6a55bfcb6193c483447edcd18d2c6f71e756b1932848c86c8458c30d86955e56b3d892fcf215a18d3c003d0313e38350eecebef98b1d11ad9cfc8667a1d579
|
|
7
|
+
data.tar.gz: 3487acdf944f1ed82b2cd6fc013a199733bd401ca5ccf621adbb9f86cdbd5aa3ea0c701e34d3416180465093e0498264a6e0c97b58c2c92b82ce967c36c58dc1
|
data/Changes.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
- Preserve `%previous` context when a turn returns `ERR: No Reply Matched`
|
|
6
|
+
or `ERR: No Reply Found` (do not overwrite `history.reply[0]`)
|
|
7
|
+
- Add `eg/previous` demo for `%previous` surviving unmatched replies
|
|
8
|
+
|
|
3
9
|
## 0.1.1
|
|
4
10
|
|
|
5
11
|
- Ship the sample brain (`eg/brain`) inside the gem
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# RiveScript-
|
|
1
|
+
# RiveScript-rb
|
|
2
2
|
|
|
3
3
|
A [RiveScript](https://www.rivescript.com/) interpreter for Ruby 3.3+.
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ implementation.
|
|
|
17
17
|
Add to your `Gemfile`:
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
gem "rivescript", "~> 0.1.
|
|
20
|
+
gem "rivescript", "~> 0.1.2"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Then:
|
|
@@ -57,13 +57,13 @@ riveshell
|
|
|
57
57
|
# Gemfile (development / unreleased tip)
|
|
58
58
|
gem "rivescript",
|
|
59
59
|
git: "https://github.com/LilOleByte/rivescript-rb.git",
|
|
60
|
-
tag: "v0.1.
|
|
60
|
+
tag: "v0.1.2"
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
bundle install
|
|
65
|
-
bundle exec rake package # builds pkg/rivescript-0.1.
|
|
66
|
-
gem install --user-install pkg/rivescript-0.1.
|
|
65
|
+
bundle exec rake package # builds pkg/rivescript-0.1.2.gem + verifies contents
|
|
66
|
+
gem install --user-install pkg/rivescript-0.1.2.gem
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
## Usage
|
data/lib/rivescript/brain.rb
CHANGED
|
@@ -265,8 +265,13 @@ class RiveScript
|
|
|
265
265
|
begin
|
|
266
266
|
history["input"].pop
|
|
267
267
|
history["input"].unshift(msg)
|
|
268
|
-
|
|
269
|
-
history[
|
|
268
|
+
# Keep %previous intact when nothing matched / no reply was found.
|
|
269
|
+
# Otherwise ERR strings overwrite history.reply[0] and short
|
|
270
|
+
# conversations cannot continue (aichaos/rivescript-js#411).
|
|
271
|
+
unless error_reply?(reply)
|
|
272
|
+
history["reply"].pop
|
|
273
|
+
history["reply"].unshift(reply)
|
|
274
|
+
end
|
|
270
275
|
rescue StandardError
|
|
271
276
|
history = new_history
|
|
272
277
|
end
|
|
@@ -982,5 +987,10 @@ class RiveScript
|
|
|
982
987
|
"reply" => Array.new(10, "undefined")
|
|
983
988
|
}
|
|
984
989
|
end
|
|
990
|
+
|
|
991
|
+
def error_reply?(reply)
|
|
992
|
+
reply == @master.errors["replyNotMatched"] ||
|
|
993
|
+
reply == @master.errors["replyNotFound"]
|
|
994
|
+
end
|
|
985
995
|
end
|
|
986
996
|
end
|
data/lib/rivescript/version.rb
CHANGED