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
84b2db36
Commit
84b2db36
authored
Apr 15, 2019
by
hxw2303632
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of 192.168.1.81:hxw2303632/webapp
parents
f0601050
8b6893aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
43 deletions
+69
-43
ActionUtils.java
...qiwu/chatbotbackend/actiongenerate/utils/ActionUtils.java
+60
-35
ConfigTermText.java
...n/java/com/qiwu/chatbotbackend/entity/ConfigTermText.java
+1
-1
PlotConstructor2.java
.../com/qiwu/chatbotbackend/gameDesign/PlotConstructor2.java
+8
-7
No files found.
src/main/java/com/qiwu/chatbotbackend/actiongenerate/utils/ActionUtils.java
View file @
84b2db36
...
...
@@ -272,6 +272,7 @@ public class ActionUtils {
conditionJson
=
JSON
.
parseObject
(
condition
.
getConditionJsonText
());
conditionJson
.
put
(
"conditionId"
,
condition
.
getConditionId
());
data
.
getJSONArray
(
"conditionList"
).
add
(
conditionJson
);
conditionJson
.
put
(
"displayOrder"
,
condition
.
getDisplayOrder
());
}
intervalStatus
=
new
IntervalStatus
(
1
,
""
,
data
);
...
...
@@ -817,11 +818,10 @@ 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
>();
...
...
@@ -833,11 +833,7 @@ public class ActionUtils {
try
{
platformUtils
=
new
PlatformUtils
();
//helper.deleteUserData(botId);
idList
=
platformUtils
.
queryConditionIdByTypetreeId
(
parameters
.
getJSONArray
(
"conditionCategories"
));
id2unit
=
engine
.
queryUnitsByIdList
(
idList
);
for
(
Integer
id:
id2unit
.
keySet
()){
...
...
@@ -861,27 +857,28 @@ public class ActionUtils {
conditionJson
=
(
JSONObject
)
patternConditionJson
.
clone
();
conditionName
=
conditionJson
.
getString
(
"conditionName"
)
+
postfix
;
conditionName2
=
conditionName
+
"_independent"
;
if
(!
conditionExtraKeywords
.
containsKey
(
conditionName
+
"_tail"
)){
//如果没有用到这个condition,就跳过
break
;
if
(!
conditionExtraKeywords
.
containsKey
(
conditionName2
+
"_tail"
))
break
;
}
conditionJson
.
put
(
"conditionName"
,
conditionName
);
if
(
conditionJson
.
getString
(
"relationHead"
).
equals
(
"?"
))
keywordPosition
=
"left"
;
else
keywordPosition
=
"right"
;
flag
=
conditionAppendKeyword
(
conditionName
,
conditionJson
,
conditionExtraKeywords
,
macroAppendMap
);
if
(
conditionExtraKeywords
.
containsKey
(
conditionName
+
"_tail"
))
{
conditionJson
.
put
(
"conditionName"
,
conditionName
);
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
);
actionText
=
generateSingleActionText
(
conditionName
,
conditionJson
);
if
(
startCondition
.
equals
(
conditionName
))
{
conditionJson
.
put
(
"active"
,
true
);
actionText
=
actionText
.
replace
(
"status=waiting"
,
"status=active"
);
...
...
@@ -904,12 +901,6 @@ public class ActionUtils {
}
parameters
.
put
(
"conditionData"
,
conditionData
);
//第一次提交,获取关键词单元的数据
ape
=
new
ActionPostElem
(
botId
,
botName
,
""
,
auth
,
""
,
conditionPostPair
);
postAction
(
ape
,
parameters
.
getString
(
"gameEditorSessionId"
));
...
...
@@ -1000,12 +991,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 +1009,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 @
84b2db36
...
...
@@ -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"
);
}
}
...
...
src/main/java/com/qiwu/chatbotbackend/gameDesign/PlotConstructor2.java
View file @
84b2db36
...
...
@@ -985,14 +985,15 @@ public class PlotConstructor2 extends ElementConstructor {
String
feature
=
newTerm
.
getFeature
();
feature
=
feature
+
",activate,post::gameQA("
+
QA_URL
+
")"
;
newTerm
.
setFeature
(
feature
);
newTerm
.
setNextStep
(
stemStr
+
"_qa1,"
+
stemStr
+
"_qa2"
);
newTerm
.
setNextStep
(
"map*,item*,npc*,"
+
stemStr
+
"_qa1,"
+
stemStr
+
"_qa2"
);
return
newTerm
;
}
private
ConfigTermText
createTermExtra1
(
ConfigTermText
term
)
{
String
hPremise
=
"qa_score::number-Bigger=90"
;
String
featureStr
=
"match,activate,return-0"
;
String
nextStr
=
"map*,item*,npc*"
;
String
hPremise
=
"qa_score::number-BiggerOrEqual=98"
;
String
featureStr
=
"match,return-0"
;
//String nextStr = "map*,item*,npc*";
String
nextStr
=
" "
;
String
knowledgeStr
=
UNKNOWN_COUNTER_NAME
+
":+1"
;
String
configName
=
term
.
getConfigName
()+
"_qa1"
;
ConfigTermText
newTerm
=
new
ConfigTermText
(
" "
,
hPremise
,
featureStr
,
""
,
nextStr
,
knowledgeStr
);
...
...
@@ -1002,9 +1003,9 @@ public class PlotConstructor2 extends ElementConstructor {
}
private
ConfigTermText
createTermExtra2
(
ConfigTermText
term
)
{
String
hPremise
=
"qa_score::number-Smaller=9
0
"
;
String
featureStr
=
"match
,activate
"
;
String
nextStr
=
"
map*,item*,npc*
"
;
String
hPremise
=
"qa_score::number-Smaller=9
8
"
;
String
featureStr
=
"match"
;
String
nextStr
=
"
"
;
String
configName
=
term
.
getConfigName
()+
"_qa2"
;
if
(
term
.
getFeature
().
indexOf
(
"activate"
)
!=
-
1
)
{
nextStr
=
term
.
getNextStep
()
+
","
+
nextStr
;
...
...
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