我有一些这样的标记化字符串
declare UserAddress
tokens : List
end
我有一个像这样的公认令牌列表
rule "Count Frequency of RealTokens occurrence in RealAddresses"
salience -10
when
$token : RealToken();
$count : List() from collect(RealAddress(tokens contains $token.getToken()));
then
modify($token) { setCount($count) };
end
使用drools,如何确定给定tokens
中哪个UserAddress
与RealToken
的{{1}}值匹配?{/ p>
我已经尝试过了:
$count
但无法解决DRL语法问题:
rule "Find the Most Statistically Significant Token for each User Address"
salience -20
$ua : UserAddress();
$ut : String( length() > 0) from $ua.getTokens().subList(1, $ua.getTokens().size());
$rt : RealToken(token == $ut);
not(RealToken(token == $ut && this.count < $rt.count));
then
System.out.println("MSST: " + $ua.toString() + " = " + $rt.toString());
end
答案 0 :(得分:0)
错误信息非常清楚,当你不愿意看第85行时,你会发现
rule "Find the Most Statistically Significant Token for each User Address"
salience -20
$ua : UserAddress(); ############################### line 85
$ut : String( length() > 0) from $ua.getTokens().subList(1, $ua.getTokens().size());
$rt : RealToken(token == $ut);
第一个模式之前没有关键字when
。