-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDictionary.cs
75 lines (53 loc) · 2.64 KB
/
Dictionary.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace NarrativeArc
{
public class DictionaryMetaObject
{
public string DictionaryName { get; set; }
public string DictionaryCategoryPrefix { get; set; }
public string DictionaryDescription { get; set; }
public string DictionaryRawText { get; set; }
public bool UseDictionary { get; set; }
public DictionaryData DictData { get; set; }
public DictionaryMetaObject(string DictName, string DictDescript, string DictPrefix, string DictContents)
{
DictionaryName = DictName;
DictionaryDescription = DictDescript;
DictionaryRawText = DictContents;
DictionaryCategoryPrefix = DictPrefix;
UseDictionary = true;
DictData = new DictionaryData();
}
}
public class DictionaryData
{
public int NumCats { get; set; }
public int MaxWords { get; set; }
public string[] CatNames { get; set; }
public string[] CatValues { get; set; }
//yeah, we're going full inception with this variable. dictionary inside of a dictionary inside of a dictionary
//while it might seem unnecessarily complicated (and it might be), it makes sense.
//the first level simply differentiates the wildcard entries from the non-wildcard entries
//The second level is purely to refer to the word length -- does each sub-entry include 1-word entries, 2-word entries, etc?
//the third level contains the actual entries from the user's dictionary file
public Dictionary<string, Dictionary<int, Dictionary<string, string[]>>> FullDictionary { get; set; }
//this dictionary simply maps the specific wildcard entries to arrays, this way we can iterate across them since we have to do a serial search
//when we're using wildcards
public Dictionary<int, string[]> WildCardArrays { get; set; }
//lastly, this contains the precompiled regexes mapped to their original strings
public Dictionary<string, Regex> PrecompiledWildcards { get; set; }
public bool DictionaryLoaded { get; set; }
public DictionaryData()
{
NumCats = 0;
MaxWords = 0;
CatNames = new string[] { };
CatValues = new string[] { };
FullDictionary = new Dictionary<string, Dictionary<int, Dictionary<string, string[]>>>();
WildCardArrays = new Dictionary<int, string[]>();
PrecompiledWildcards = new Dictionary<string, Regex>();
DictionaryLoaded = false;
}
}
}