public NGramNode(bool isRootNode, MultipleFile multipleFile) { if (!isRootNode) { this._symbol = (TSymbol)Convert.ChangeType(multipleFile.ReadLine().Trim(), typeof(TSymbol)); } var line = multipleFile.ReadLine(); var items = line.Split(" "); this._count = int.Parse(items[0]); this._probability = double.Parse(items[1]); this._probabilityOfUnseen = double.Parse(items[2]); var numberOfChildren = int.Parse(items[3]); if (numberOfChildren > 0) { _children = new Dictionary <TSymbol, NGramNode <TSymbol> >(); for (var i = 0; i < numberOfChildren; i++) { var childNode = new NGramNode <TSymbol>(false, multipleFile); _children.Add(childNode._symbol, childNode); } } }
public NGram(params string[] fileNameList) { var multipleFile = new MultipleFile(fileNameList); ReadHeader(multipleFile.GetStreamReader()); rootNode = new NGramNode <TSymbol>(true, multipleFile); multipleFile.Close(); }