static bool CheckForm4(string Input, ParseTree ps, ParseNode vnode, ParseNode pn) { if (pn == null) { return(false); } //SBJ is ----ing PP //We don't know if adverbs or prep. phrases can come after ArrayList cmps = GetCMPList(pn); if (vnode.Goal == "VING") { if (!IsVPSP(ps, (ParseNode)cmps[0])) { return(false); } } else { return(false); } for (int i = 1; i < cmps.Count; i++) { ParseNode p = (ParseNode)cmps[i]; string goal = ((ParseNode)p.Children[0]).Goal; if (goal == "OBJ" || goal == "INFPH" || goal == "INFPO" || SentenceParser.IsADJ(p)) { return(false); } } return(true); }
static bool CheckForm33(string Input, ParseTree ps, ParseNode vnode, ParseNode pn) { if (pn == null) { return(false); } //SBJ ----s VING ArrayList cmps = GetCMPList(pn); ParseNode fcmp = (ParseNode)cmps[0]; if (!IsVING(ps, fcmp)) { return(false); } for (int i = 1; i < cmps.Count; i++) { ParseNode p = (ParseNode)cmps[i]; string goal = ((ParseNode)p.Children[0]).Goal; if (goal == "OBJ" || goal == "INFPH" || goal == "INFPO" || SentenceParser.IsADJ(p)) { return(false); } } return(true); }
static bool CheckForm20(string Input, ParseTree ps, ParseNode vnode, ParseNode pn) { if (pn == null) { return(false); } //SBJ ----s OBJ+VPSP ArrayList cmps = GetCMPList(pn); if (cmps.Count < 2) { return(false); } ParseNode fcmp = (ParseNode)cmps[0]; ParseNode fch = (ParseNode)fcmp.Children[0]; if (fch.Goal != "OBJ") { return(false); } if (!IsVPSP(ps, (ParseNode)cmps[1])) { return(false); } for (int i = 2; i < cmps.Count; i++) { ParseNode p = (ParseNode)cmps[i]; string goal = ((ParseNode)p.Children[0]).Goal; if (goal == "OBJ" || goal == "INFPH" || goal == "INFPO" || SentenceParser.IsADJ(p)) { return(false); } } return(true); }
static bool CheckForm15(string Input, ParseTree ps, ParseNode vnode, ParseNode pn) { if (pn == null) { return(false); } //SBJ ----s OBJ+Preposition+OBJ ArrayList cmps = GetCMPList(pn); ParseNode fcmp = (ParseNode)cmps[0]; ParseNode fch = (ParseNode)fcmp.Children[0]; if (fch.Goal != "OBJ") { return(false); } int i = 1; for (; i < cmps.Count; i++) { if (!SentenceParser.IsADV((ParseNode)cmps[i])) { break; } } if (i >= cmps.Count) { return(false); } ParseNode prplnode = (ParseNode)((ParseNode)cmps[i]).Children[0]; if (prplnode.Goal != "PRPL") { return(false); } ArrayList preps = GetPrepositions(ps, prplnode); foreach (string prs in preps) { if (prs != Input) { return(false); } } i++; for (; i < cmps.Count; i++) { ParseNode p = (ParseNode)cmps[i]; string goal = ((ParseNode)p.Children[0]).Goal; if (goal == "OBJ" || goal == "INFPH" || goal == "INFPO" || SentenceParser.IsADJ(p)) { return(false); } } return(true); }
/*static bool IsVPSP(ParseNode cmp) * { * // we don't know if two vpsp can come * ParseNode avjch=(ParseNode)cmp.Children[0]; * ParseNode ajsch=(ParseNode)avjch.Children[0]; * if(ajsch.Goal=="CMPAJS") * { * ParseNode ajch=(ParseNode)ajsch.Children[0]; * if(ajch.Goal=="CMPAJ") * return ((ParseNode)ajch.Children[0]).Goal=="VPSP"; * } * return false; * }*/ // Syntax structure follows the verb immediately // Any ADJ can be preceeded by some adverbs // Prepositional phrases can't come before or within // syntax structure. static bool CheckForm5(string Input, ParseTree ps, ParseNode vnode, ParseNode pn) { if (pn == null) { return(false); } //SBJ ----s OBJ+ADJ //SBJ ----s OBJ+OBJ ArrayList cmps = GetCMPList(pn); ParseNode fcmp = (ParseNode)cmps[0]; ParseNode fch = (ParseNode)fcmp.Children[0]; if (fch.Goal != "OBJ" || fcmp.Children.Count > 1) { return(false); } int i = 1; for (; i < cmps.Count; i++) { if (!SentenceParser.IsADV((ParseNode)cmps[i])) { break; } } if (i >= cmps.Count) { return(false); } ParseNode ch2 = (ParseNode)cmps[i]; if (i > 1 && ((ParseNode)ch2.Children[0]).Goal == "OBJ") { return(false); } if (!SentenceParser.IsADJ(ch2) && ((ParseNode)ch2.Children[0]).Goal != "OBJ") { return(false); } i++; for (; i < cmps.Count; i++) { ParseNode p = (ParseNode)cmps[i]; string goal = ((ParseNode)p.Children[0]).Goal; if (goal == "OBJ" || goal == "INFPH" || goal == "INFPO" || SentenceParser.IsADJ(p)) { return(false); } } return(true); }
static bool CheckForm1(string Input, ParseTree ps, ParseNode vnode, ParseNode pn) { // No OBJ if (pn == null) { return(true); } ArrayList cmps = GetCMPList(pn); foreach (ParseNode p in cmps) { string goal = ((ParseNode)p.Children[0]).Goal; if (goal == "OBJ" || goal == "INFPH" || SentenceParser.IsADJ(p)) { return(false); } } return(true); }
static bool CheckForm7(string Input, ParseTree ps, ParseNode vnode, ParseNode pn) { if (pn == null) { return(false); } //SBJ ----s ADJ ArrayList cmps = GetCMPList(pn); int i = 0; for (; i < cmps.Count; i++) { if (!SentenceParser.IsADV((ParseNode)cmps[i])) { break; } } if (i >= cmps.Count) { return(false); } ParseNode ch2 = (ParseNode)cmps[i]; if (!SentenceParser.IsADJ(ch2)) { return(false); } i++; for (; i < cmps.Count; i++) { ParseNode p = (ParseNode)cmps[i]; string goal = ((ParseNode)p.Children[0]).Goal; if (goal == "OBJ" || goal == "INFPH" || goal == "INFPO" || SentenceParser.IsADJ(p)) { return(false); } } return(true); }