/// <summary>Creates an extractor using the specified environment, and reading the rules from the given string</summary>
        /// <param name="env"/>
        /// <param name="str"/>
        /// <exception cref="System.IO.IOException">, ParseException</exception>
        /// <exception cref="Edu.Stanford.Nlp.Ling.Tokensregex.Parser.ParseException"/>
        /// <exception cref="Edu.Stanford.Nlp.Ling.Tokensregex.Parser.TokenSequenceParseException"/>
        public static CoreMapExpressionExtractor CreateExtractorFromString(Env env, string str)
        {
            TokenSequenceParser        parser    = new TokenSequenceParser();
            CoreMapExpressionExtractor extractor = parser.GetExpressionExtractor(env, new StringReader(str));

            return(extractor);
        }
        /// <summary>Creates an extractor using the specified environment, and reading the rules from the given filenames.</summary>
        /// <param name="env"/>
        /// <param name="filenames"/>
        /// <exception cref="System.Exception"/>
        public static CoreMapExpressionExtractor <M> CreateExtractorFromFiles <M>(Env env, IList <string> filenames)
            where M : MatchedExpression
        {
            CoreMapExpressionExtractor <M> extractor = new CoreMapExpressionExtractor <M>(env);

            foreach (string filename in filenames)
            {
                try
                {
                    using (BufferedReader br = IOUtils.ReaderFromString(filename))
                    {
                        if (verbose)
                        {
                            log.Info("Reading TokensRegex rules from " + filename);
                        }
                        TokenSequenceParser parser = new TokenSequenceParser();
                        parser.UpdateExpressionExtractor(extractor, br);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error parsing file: " + filename, ex);
                }
            }
            return(extractor);
        }