// NOTE: Currently this code is the same as the IPADIC dictionary entry parser, // which is okay for all the dictionaries supported so far... public GenericDictionaryEntry parse(String entry) { string[] fields = ParseLine(entry); string surface = fields[0]; short leftId = short.Parse(fields[1]); short rightId = short.Parse(fields[2]); short wordCost = short.Parse(fields[3]); string[] pos = new string[6]; Array.Copy(fields, 4, pos, 0, pos.Length); string[] features = new string[fields.Length - 10]; Array.Copy(fields, 10, features, 0, features.Length); GenericDictionaryEntry.Builder builder = new GenericDictionaryEntry.Builder() { Surface = surface, LeftId = leftId, RightId = rightId, WordCost = wordCost, PartOfSpeechFeatures = pos, OtherFeatures = features }; GenericDictionaryEntry dictionaryEntry = new GenericDictionaryEntry(builder); return(dictionaryEntry); }
protected override GenericDictionaryEntry MakeGenericDictionaryEntry(DictionaryEntry entry) { List <string> pos = MakePartOfSpeechFeatures(entry); List <string> features = MakeOtherFeatures(entry); var builder = new GenericDictionaryEntry.Builder(); builder.Surface = entry.GetSurface(); builder.LeftId = entry.GetLeftId(); builder.RightId = entry.GetRightId(); builder.WordCost = entry.GetWordCost(); builder.PartOfSpeechFeatures = pos.ToArray(); builder.OtherFeatures = features.ToArray(); return(new GenericDictionaryEntry(builder)); }