Пример #1
0
        // Given a particular clue string (e.g. A-B-C) for the document, record it; This clue constraints a fragment scope for that particular document
        // Input clue stirng can be in any order (e.g. C-A-B)
        public void AddDocumentClue(string clue, Document doc)
        {
            // Lower case is required
            clue = clue.ToLower();
            // Condition on quantity of fragments
            List <string> fragments = ClueHelper.SeperateClueFragments(clue);
            // Add to all collection
            Clue addedOrExisting = ClueSet.Add(clue);

            // Add to scope
            if (fragments.Count > 1)
            {
                FragmentScopes.Add(addedOrExisting, doc);
            }
            // Add to fragments
            foreach (string fragment in fragments)
            {
                if (Fragments.ContainsKey(fragment))
                {
                    Fragments[fragment].Documents.Add(doc);
                }
                else
                {
                    Fragments[fragment] = new FragmentInfo(fragment, doc);
                }
                Fragments[fragment].FullClues.Add(addedOrExisting);
            }
        }
Пример #2
0
 // Given a particular clue A-B-C for the document; This clue constraints a fragment scope for that particular document
 public void AddDocumentClue(string clue, Document doc)  // Assumed clue lower cased
 {
     string[] fragments = ClueHelper.SeperateClueFragments(clue);
     // Add to scope
     if (fragments.Length > 1)
     {
         FragmentScopes.Add(clue, doc);
     }
     // Add to fragments
     foreach (string fragment in fragments)
     {
         if (Fragments.ContainsKey(fragment))
         {
             Fragments[fragment].Documents.Add(doc);
         }
         else
         {
             Fragments[fragment] = new FragmentInfo(fragment, doc);
         }
         Fragments[fragment].FragmentScopes.Add(clue);
     }
     // Add to all collection
     AllClues.Add(clue); // Notice by design (i.e. from where this function is called) clue is guaranteed to be non-duplicate to other already added ones; E.g. if it's manually created in clue creator we will rearrange it if it matches any existing ones.
 }