/// <summary>Matches all relevant mentions, i.e.</summary>
        /// <remarks>
        /// Matches all relevant mentions, i.e. entities and anchors, to tokens Note:
        /// entity mentions may match with multiple tokens!
        /// </remarks>
        public virtual void MatchCharSeqs(string filePrefix)
        {
            //
            // match the head and extent of entity mentions
            //
            ICollection <string> keys = mEntityMentions.Keys;

            foreach (string key in keys)
            {
                AceEntityMention m = mEntityMentions[key];
                //
                // match the head charseq to 1+ phrase(s)
                //
                try
                {
                    m.GetHead().Match(mTokens);
                }
                catch (MatchException)
                {
                    mLog.Severe("READER ERROR: Failed to match entity mention head: " + "[" + m.GetHead().GetText() + ", " + m.GetHead().GetByteStart() + ", " + m.GetHead().GetByteEnd() + "]");
                    mLog.Severe("Document tokens: " + TokensWithByteSpan(m.GetHead().GetByteStart(), m.GetHead().GetByteEnd()));
                    mLog.Severe("Document prefix: " + filePrefix);
                    System.Environment.Exit(1);
                }
                //
                // match the extent charseq to 1+ phrase(s)
                //
                try
                {
                    m.GetExtent().Match(mTokens);
                }
                catch (MatchException)
                {
                    mLog.Severe("READER ERROR: Failed to match entity mention extent: " + "[" + m.GetExtent().GetText() + ", " + m.GetExtent().GetByteStart() + ", " + m.GetExtent().GetByteEnd() + "]");
                    mLog.Severe("Document tokens: " + TokensWithByteSpan(m.GetExtent().GetByteStart(), m.GetExtent().GetByteEnd()));
                    System.Environment.Exit(1);
                }
                //
                // set the head word of the mention
                //
                m.DetectHeadToken(this);
            }
            // we need to do this for events as well since they may not have any AceEntityMentions associated with them (if they have no arguments)
            ICollection <string> eventKeys = mEventMentions.Keys;

            foreach (string key_1 in eventKeys)
            {
                AceEventMention m = mEventMentions[key_1];
                //
                // match the extent charseq to 1+ phrase(s)
                //
                try
                {
                    m.GetExtent().Match(mTokens);
                }
                catch (MatchException)
                {
                    mLog.Severe("READER ERROR: Failed to match event mention extent: " + "[" + m.GetExtent().GetText() + ", " + m.GetExtent().GetByteStart() + ", " + m.GetExtent().GetByteEnd() + "]");
                    mLog.Severe("Document tokens: " + TokensWithByteSpan(m.GetExtent().GetByteStart(), m.GetExtent().GetByteEnd()));
                    System.Environment.Exit(1);
                }
            }
        }