public static bool IsMatch(string inToken, Regex inPattern, bool checkEmptyToken) { bool flag = false; if (checkEmptyToken == true) { // check if empty token //if(TokenUtil.IsNotEmptyToken(inToken) == true) if (TokenUtil.IsEmptyToken(inToken) == false) { var matcher = inPattern.Match(inToken); flag = matcher.Success; } } else // option: not to check empty token { var matcher = inPattern.Match(inToken); flag = matcher.Success; } return(flag); }
// to be improved to all unicode space // check if the token is one of space str (space token) // TBD, change to use data member public virtual bool IsSpaceToken() { bool spaceFlag = TokenUtil.IsSpaceToken(tokenStr_); return(spaceFlag); }
// true: if meet possessive pattern // private method private static bool IsPossessivePattern1(string inToken) { bool flag = false; // check if ends with possessive // upperCase: 'S, S', X', Z' if ((TokenUtil.IsMatch(inToken, pattern1a_) == true) || (TokenUtil.IsMatch(inToken, pattern1b_) == true) || (TokenUtil.IsMatch(inToken, pattern1c_) == true) || (TokenUtil.IsMatch(inToken, pattern1d_) == true) || (TokenUtil.IsMatch(inToken, pattern1e_) == true) || (TokenUtil.IsMatch(inToken, pattern1f_) == true)) { flag = true; } return(flag); }
public static bool IsPunc(string inToken) { bool checkEmptyTokenFlag = true; return(TokenUtil.IsMatch(inToken, patternP_, checkEmptyTokenFlag)); }
// true: if meet possessive pattern // private method private static bool IsParentheticPluralS(string inToken) { bool flag = false; if ((TokenUtil.IsMatch(inToken, patternS_) == true) && (TokenUtil.IsMatch(inToken, patternS1_) == false) && (TokenUtil.IsMatch(inToken, patternS2_) == false)) { flag = true; } return(flag); }