public void FromStreamReader(StreamReader reader, TagSet tagSet, bool extend) { string line; HashSet <string> known = null; if (!extend) { known = new HashSet <string>(lexicon.Keys); } while ((line = reader.ReadLine()) != null) { string[] fields = line.Split('\t'); if (fields.Length >= 4) { string wf = fields[0]; if (!extend && known.Contains(wf.ToLower())) { continue; } string lf = fields[1]; int tag = tagSet.GetTagId(fields[2], true); int n = int.Parse(fields[3]); AddEntry(wf, lf, tag, n); } } }
protected override void ComputeOpenTags() { OpenTags = new int[openTagArray.Length]; TagSet tagSet = TaggedData.PosTagSet; for (int i = 0; i < OpenTags.Length; i++) { try { OpenTags[i] = tagSet.GetTagId(openTagArray[i]); } catch (TagNameException) { Console.WriteLine($"Open tag not in tag set: {openTagArray[i]}"); Environment.Exit(1); } } }