Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
qwgame
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵国君
qwgame
Commits
cdf861c3
Commit
cdf861c3
authored
Apr 12, 2019
by
赵国君
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加independent
parent
c0fad60b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
24 deletions
+52
-24
ActionUtils.java
...qiwu/chatbotbackend/actiongenerate/utils/ActionUtils.java
+51
-23
ConfigTermText.java
...n/java/com/qiwu/chatbotbackend/entity/ConfigTermText.java
+1
-1
No files found.
src/main/java/com/qiwu/chatbotbackend/actiongenerate/utils/ActionUtils.java
View file @
cdf861c3
...
...
@@ -818,10 +818,9 @@ public class ActionUtils {
}
public
void
gamePlotInit
(
String
botName
,
int
botId
,
String
auth
,
JSONObject
parameters
,
String
startCondition
,
Map
<
String
,
HashSet
<
String
>>
conditionExtraKeywords
){
Boolean
flag
=
true
;
String
elem
[],
postfix
,
conditionName
,
keywordPosition
,
actionText
,
relationName
,
finalText
,
activeFlag
;
String
elem
[],
postfix
,
conditionName
,
conditionName2
,
keywordPosition
,
actionText
,
relationName
,
finalText
,
activeFlag
;
PlatformUtils
platformUtils
=
null
;
JSONObject
patternConditionJson
=
null
,
conditionJson
=
null
;
List
<
Integer
>
idList
=
new
ArrayList
<
Integer
>();
...
...
@@ -861,26 +860,27 @@ public class ActionUtils {
conditionJson
=
(
JSONObject
)
patternConditionJson
.
clone
();
conditionName
=
conditionJson
.
getString
(
"conditionName"
)
+
postfix
;
conditionName2
=
conditionName
+
"_independent"
;
if
(!
conditionExtraKeywords
.
containsKey
(
conditionName
+
"_tail"
)){
//如果没有用到这个condition,就跳过
if
(!
conditionExtraKeywords
.
containsKey
(
conditionName2
+
"_tail"
))
break
;
}
if
(
conditionExtraKeywords
.
containsKey
(
conditionName
+
"_tail"
))
{
conditionJson
.
put
(
"conditionName"
,
conditionName
);
conditionAppendKeyword
(
conditionName
,
conditionJson
,
conditionExtraKeywords
,
macroAppendMap
);
}
if
(
conditionJson
.
getString
(
"relationHead"
).
equals
(
"?"
))
keywordPosition
=
"left"
;
else
keywordPosition
=
"right"
;
flag
=
conditionAppendKeyword
(
conditionName
,
conditionJson
,
conditionExtraKeywords
,
macroAppendMap
);
if
(
conditionExtraKeywords
.
containsKey
(
conditionName2
+
"_tail"
))
{
conditionJson
.
put
(
"conditionName"
,
conditionName2
);
conditionAppendKeyword2
(
conditionName2
,
conditionJson
,
conditionExtraKeywords
,
macroAppendMap
);
conditionName
=
conditionName2
;
}
if
(
conditionJson
.
getBoolean
(
"active"
)
&&
!
conditionName
.
equals
(
startCondition
))
conditionJson
.
put
(
"active"
,
false
);
actionText
=
generateSingleActionText
(
conditionName
,
conditionJson
);
if
(
startCondition
.
equals
(
conditionName
))
{
conditionJson
.
put
(
"active"
,
true
);
...
...
@@ -904,12 +904,6 @@ public class ActionUtils {
}
parameters
.
put
(
"conditionData"
,
conditionData
);
//第一次提交,获取关键词单元的数据
ape
=
new
ActionPostElem
(
botId
,
botName
,
""
,
auth
,
""
,
conditionPostPair
);
postAction
(
ape
,
parameters
.
getString
(
"gameEditorSessionId"
));
...
...
@@ -1000,12 +994,6 @@ public class ActionUtils {
}
else
{
conditionJson
.
put
(
"relationHead"
,
extraKeywords
);
}
//将三元组头部的限定词替换为游戏中使用的关键词,如果为*,则不替换
//if(!conditionJson.getString("relationHead").equals("*"))
extraKeywords
=
Joiner
.
on
(
"+"
).
join
(
conditionExtraKeywords
.
get
(
conditionName
+
"_tail"
));
if
(
repeatKeywords
.
startsWith
(
"++"
)){
//要添加的关键词不为空
...
...
@@ -1024,6 +1012,46 @@ public class ActionUtils {
return
true
;
}
public
Boolean
conditionAppendKeyword2
(
String
conditionName
,
JSONObject
conditionJson
,
Map
<
String
,
HashSet
<
String
>>
conditionExtraKeywords
,
Map
<
String
,
StringBuffer
>
macroAppendMap
){
String
relationHead
=
conditionJson
.
getString
(
"relationHead"
);
String
repeatKeywords
=
conditionJson
.
getJSONArray
(
"repeatList"
).
getJSONObject
(
0
).
getString
(
"repeatKeywords"
).
split
(
"-"
)[
0
];
String
extraKeywords
=
Joiner
.
on
(
"+"
).
join
(
conditionExtraKeywords
.
get
(
conditionName
+
"_head"
));
//condition原来的值域是一个宏定义
if
(
relationHead
.
startsWith
(
"++"
)){
//要添加的关键词不为空
if
(!
extraKeywords
.
equals
(
""
))
{
if
(
macroAppendMap
.
containsKey
(
relationHead
))
{
macroAppendMap
.
get
(
relationHead
).
append
(
"+"
).
append
(
extraKeywords
);
}
else
{
macroAppendMap
.
put
(
relationHead
,
new
StringBuffer
(
extraKeywords
));
}
}
}
if
(
extraKeywords
!=
null
&&
extraKeywords
!=
""
)
{
conditionJson
.
put
(
"relationHead"
,
extraKeywords
);
}
extraKeywords
=
Joiner
.
on
(
"+"
).
join
(
conditionExtraKeywords
.
get
(
conditionName
+
"_tail"
));
if
(
repeatKeywords
.
startsWith
(
"++"
)){
//要添加的关键词不为空
if
(!
repeatKeywords
.
equals
(
""
))
{
if
(
macroAppendMap
.
containsKey
(
repeatKeywords
))
{
macroAppendMap
.
get
(
repeatKeywords
).
append
(
"+"
).
append
(
extraKeywords
);
}
else
{
macroAppendMap
.
put
(
repeatKeywords
,
new
StringBuffer
(
extraKeywords
));
}
}
}
if
(
extraKeywords
!=
null
&&
extraKeywords
!=
""
)
{
conditionJson
.
getJSONArray
(
"repeatList"
).
getJSONObject
(
0
).
put
(
"repeatKeywords"
,
extraKeywords
);
}
return
true
;
}
public
Set
<
String
>
getConditionNameSet
(
List
<
Condition
>
conditionList
){
String
elements
[];
String
conditionName
;
...
...
src/main/java/com/qiwu/chatbotbackend/entity/ConfigTermText.java
View file @
cdf861c3
...
...
@@ -195,7 +195,7 @@ public class ConfigTermText implements Cloneable{
nameCount
.
put
(
conditionName
,
nameCount
.
get
(
conditionName
)
+
1
);
//在conditionName后添加count
if
(
nameCount
.
get
(
conditionName
)
>
1
)
{
premise
.
setConditionName
(
conditionName
+
nameCount
.
get
(
conditionName
));
premise
.
setConditionName
(
conditionName
+
nameCount
.
get
(
conditionName
)
+
"_independent"
);
}
}
...
...
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