1 | module babyStuff; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | create dictionary preg1_att_exclude_dict from file 'dict/preg1_adv_exclude.dict' with language as 'en'; create dictionary preg1_sub_dict from file 'dict/preg1_sub.dict' with language as 'en'; create dictionary preg1_adv_exclude_dict from file 'dict/preg1_adv_exclude.dict' with language as 'en'; create dictionary preg1_verb_dict from file 'dict/preg1_verb.dict' with language as 'en'; create view preg1_sub_view as extract dictionary 'preg1_sub_dict' on D.text as sub from Document D; create view preg1_verb_view as extract dictionary 'preg1_verb_dict'on D.text as verb from Document D; |
1 2 3 4 5 6 7 8 9 10 11 12 | create view preg1 as select S.sub as sub, V.verb as verb, CombineSpans(S.sub, V.verb) as match from preg1_sub_view S, preg1_verb_view V where And ( Not(ContainsDict('preg1_att_exclude_dict', LeftContextTok(S.sub, 3))), Not(ContainsDict('preg1_adv_exclude_dict', SpanBetween(S.sub, V.verb))), FollowsTok(S.sub, V.verb, 0, 4) ) ; |
1 2 3 4 5 6 7 8 9 10 11 12 13 | create view preg1 as extract LeftContextTok(S.sub, 3) as first, pattern (<S.sub>) <Token>{0, 4} (<V.verb>) return group 0 as match group 1 as sub group 2 as verb from preg1_sub_view S, preg1_verb_view V having And ( Not(ContainsDict('preg1_att_exclude_dict', first)), Not(ContainsDict('preg1_adv_exclude_dict', SpanBetween(sub, verb))) ) ; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | create view baby1 as extract LeftContextTok(S.sub, 3) as first, RightContextTok(O.obj, 3) as last, pattern (<S.sub>) <Token>{0, 4} (<V.verb>) <Token>{0, 3} (<O.obj>) return group 0 as match group 1 as sub group 2 as verb group 3 as obj from baby1_sub_view S, baby1_verb_view V, baby1_obj_view O having And ( Not(ContainsDict('baby1_att_exclude_dict', first)), Not(ContainsDict('baby1_com_exclude_dict', last)), Not(ContainsDict('baby1_adv_exclude_dict', SpanBetween(sub, verb))) ) ; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | create view babyStuff_output as ( select D.text as text, P.match as match from preg1 P, Document D ) union all ( select D.text as text, B.match as match from baby1 B, Document D ) ; output view babyStuff_output; |
1 2 3 4 5 6 7 8 9 10 11 | import systemT; extern AQLPath; extern TAM; systemT::compileAQL(["babyStuff"], TAM); doc = [ { text: "I am pregnant." }, {text: "I'm not pregnant."}, {text: "my friend is pregnant"}, {text: "my wife is preg"}]; doc -> transform { $.text, annotation: systemT::annotateDocument({label:"", text: $.text}, ["babySutff"], [TAM], "toJsonString", "standard") }; |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |