Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
99eeea35
Commit
99eeea35
authored
Jun 13, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expanding regex to include + signs in behavior args
parent
b2805ea3
Pipeline
#12456
passed with stages
in 1 minute 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
CHANGELOG.md
CHANGELOG.md
+1
-0
MessageParser.java
src/main/java/com/owlmaddie/message/MessageParser.java
+1
-1
No files found.
CHANGELOG.md
View file @
99eeea35
...
...
@@ -14,6 +14,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
### Changed
-
**Huge improvements**
to
**chat prompt**
for more
*balanced*
dialog and
*predictable*
behaviors
-
Improved
**Behavior regex**
to include both
`<BEHAVIOR arg>`
and
`*BEHAVIOR arg*`
syntax, and ignore unknown behaviors.
-
Expanded regex to support args with
`+`
sign (i.e.
`<FRIENDSHIP +1>`
)
-
Improved
**message cleaning**
to remove any remaining
`**`
and
`<>`
after parsing behaviors
-
Privacy Policy updated
...
...
src/main/java/com/owlmaddie/message/MessageParser.java
View file @
99eeea35
...
...
@@ -19,7 +19,7 @@ public class MessageParser {
LOGGER
.
info
(
"Parsing message: {}"
,
input
);
StringBuilder
cleanedMessage
=
new
StringBuilder
();
List
<
Behavior
>
behaviors
=
new
ArrayList
<>();
Pattern
pattern
=
Pattern
.
compile
(
"[<*](FOLLOW|FLEE|ATTACK|FRIENDSHIP|UNFOLLOW)(?:\\s+(
-
?\\d+))?[>*]"
);
Pattern
pattern
=
Pattern
.
compile
(
"[<*](FOLLOW|FLEE|ATTACK|FRIENDSHIP|UNFOLLOW)(?:\\s+(
[+-]
?\\d+))?[>*]"
);
Matcher
matcher
=
pattern
.
matcher
(
input
);
while
(
matcher
.
find
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment