I have a input string that each word followed with two tags so the first tage of word named as label and second named as tag,for example:
string inputStr="word1/label1/tag1 word2/label2/tag2 word3/label3/tag3 ...";//inputStr="this/l1/t1 example/l2/t2 is/l3/t3 a/l4/t4 test/l5/t5"
also,I have many string named as rules that this rules incude some conditions so if that conditions are true then remove some of continuous words of input string .
I want to find which of rules can be applied to input string.Suppose that we have a hundred rulet,the rules have following structure:
ruleStr[i]="[MAX=2]A: DEL(A,m),LB(A,side,lable),lOC(A,k,side,wtag)";
DEL(A,m):means as m words of input string must be removed. this m words named as center segment.
LB(A,side,lable):means as the lable of first word in a position to left or right or center of the deleted words(center segment),the side value is left,right or center.
lOC(A,side,k,wtag):means as in k position to left or right or center(side) of deleted words is the word(wtag) or the tag(wtag).the k variable is index of wtag in terms as center segment starts with one.wtag shows a word or a tag in k position.
if wtag be a tag is shown as pos(tag) in
notice:
*In each ruleStr, number of DEL condition is one exactly and Maximum number of LB condition is three(left,right and center) and for LB condition is *(>=0).
*The DEL,LB,LOC conditions are disordered in each ruleStr.
see following example please:
string inputStr="A/l1/t1 B/l2/t2 C/l3/t3 D/l4/t4 E/l5/t5 F/l6/t6 G/l7/t7 H/l1/t1";
ruleStr[1]="[MAX=2]A: DEL(A,2),LB(A,left,l2),lOC(A,2,right,F)";// C,D is deleted
ruleStr[2]="[MAX=1]A: DEL(A,2),LB(A,left,l2),lOC(A,2,right,pos(t6))";// C,D are deleted
ruleStr[3]="[MAX=4]A: LB(A,left,l5),DEL(A,1),lOC(A,2,left,D),lOC(A,1,right,pos(t7))";// F is deleted
ruleStr[4]="[MAX=2]A: DEL(A,1),LB(A,left,l1),lOC(A,3,right,C)";// A is deleted
ruleStr[5]="[MAX=5]A: lOC(A,1,left,C),lOC(A,1,center,D),DEL(A,3),LB(A,right,l7),";// D,E,F are deleted
ruleStr[6]="[MAX=3]A: DEL(A,1),LB(A,center,l6),lOC(A,2,right,A)";// NOT TRUE OR DON'T MATCH FOR INPUT STRING
ruleStr[7]="[MAX=3]A: LB(A,left,l6),lOC(A,2,right,D),DEL(A,1)";// NOT TRUE OR DON'T MATCH FOR INPUT STRING
After apply each ruleStr to the inputStr we have:
outStr1="A/l1/t1 B/l2/t2 E/l5/t5 F/l6/t6 G/l7/t7 H/l1/t1";
outStr2="A/l1/t1 B/l2/t2 E/l5/t5 F/l6/t6 G/l7/t7 H/l1/t1";
outStr3="A/l1/t1 B/l2/t2 C/l3/t3 D/l4/t4 E/l5/t5 G/l7/t7 H/l1/t1";
outStr4="B/l2/t2 C/l3/t3 D/l4/t4 E/l5/t5 F/l6/t6 G/l7/t7 H/l1/t1";
outStr5="A/l1/t1 B/l2/t2 C/l3/t3 G/l7/t7 H/l1/t1";
for ruleStr[6,7] conditions do not match... .
How do I find the rules that can be applied to the input string? What is output string after applying each of them to the input string?
Anyone can help me in this respect,please?