/// <summary> /// /// </summary> private void Init() { using (StreamReader reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("dictionary.wordnet.index.noun"))) { int offset = 0; while (!reader.EndOfStream && offset++ < this.indexOffset) { reader.ReadLine(); } while (!reader.EndOfStream) { offset = 0; String wLine = reader.ReadLine(); String[] wLineParts = wLine.Split(' '); Noun noun = new Noun(); noun.SynsetOffset = new List <Int64>(); noun.Lemma = wLineParts[offset++]; noun.Pos = wLineParts[offset++]; noun.SynseCnt = wLineParts[offset++]; noun.PCnt = wLineParts[offset]; offset = offset + Int32.Parse(noun.PCnt); noun.SenseCnt = wLineParts[++offset]; noun.TagsenseCnt = wLineParts[++offset]; for (int index = ++offset; index < wLineParts.Length; index++) { Int64 synsetOffset = 0; if (Int64.TryParse(wLineParts[index], out synsetOffset)) { noun.SynsetOffset.Add(synsetOffset); } } this.nouns.Add(noun.Lemma, noun); } } }
/// <summary> /// /// </summary> private void Init() { using (StreamReader reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("dictionary.wordnet.index.noun"))) { int offset = 0; while (!reader.EndOfStream && offset++ < this.indexOffset) reader.ReadLine(); while (!reader.EndOfStream) { offset = 0; String wLine = reader.ReadLine(); String[] wLineParts = wLine.Split(' '); Noun noun = new Noun(); noun.SynsetOffset = new List<Int64>(); noun.Lemma = wLineParts[offset++]; noun.Pos = wLineParts[offset++]; noun.SynseCnt = wLineParts[offset++]; noun.PCnt = wLineParts[offset]; offset = offset+ Int32.Parse(noun.PCnt); noun.SenseCnt = wLineParts[++offset]; noun.TagsenseCnt = wLineParts[++offset]; for (int index = ++offset; index < wLineParts.Length; index++) { Int64 synsetOffset = 0; if (Int64.TryParse(wLineParts[index], out synsetOffset)) noun.SynsetOffset.Add(synsetOffset); } this.nouns.Add(noun.Lemma, noun); } } }