public MultiMapSet <KEY, VALUE> Clone() { MultiMapSet <KEY, VALUE> result = new MultiMapSet <KEY, VALUE>(); foreach (var pair in data) { result.data[pair.Key] = new HashSet <VALUE>(pair.Value); } return(result); }
public MultiMapSet <string, string> GetTagsWithDocuments(HashSet <string> documents) { HashSet <string> relevant_tags = new HashSet <string>(); foreach (string document in documents) { relevant_tags.UnionWith(ai_documents_with_tags.Get(document)); } MultiMapSet <string, string> results = new MultiMapSet <string, string>(); foreach (string relevant_tag in relevant_tags) { foreach (string relevant_document in ai_tags_with_documents.Get(relevant_tag)) { if (documents.Contains(relevant_document)) { results.Add(relevant_tag, relevant_document); } } } return(results); }
private MultiMapSet <string, string> ai_documents_with_tags; // document -> tags public AITags() { timestamp_generated = DateTime.UtcNow; ai_tags_with_documents = new MultiMapSet <string, string>(); ai_documents_with_tags = new MultiMapSet <string, string>(); }