private void readTrans(EdictEntryBuilder entry, XmlReader xml) { DictionarySense sense = new DictionarySense(); while (xml.Read()) { if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "trans") { break; } if (xml.NodeType == XmlNodeType.Element) { if (xml.Name == "trans_det") { string lang = xml.GetAttribute("xml:lang"); if (lang == "eng") { lang = null; } string value = xml.ReadString(); sense.addGloss(lang, value); } else { switch (xml.Name) { case "name_type": entry.nameType = fromEntity(xml); break; } } } } entry.addSense(sense, 1.0, 1.0); }
private void readSense(EdictEntryBuilder entry, XmlReader xml) { DictionarySense sense = new DictionarySense(); double globalMult = 1.0; double kanaMult = 0.8; while (xml.Read()) { if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "sense") { break; } if (xml.NodeType == XmlNodeType.Element) { if (xml.Name == "gloss") { string lang = xml.GetAttribute("xml:lang"); if (lang == "eng") { lang = null; } string value = xml.ReadString(); sense.addGloss(lang, value); } else { switch (xml.Name) { case "pos": entry.addPOS(fromEntity(xml)); break; case "field": case "misc": case "dial": string v = fromEntity(xml); adjustMultipliers(v, ref globalMult, ref kanaMult); sense.addMisc(v); break; } } } } entry.addSense(sense, globalMult, kanaMult); }
private void readTrans(EdictEntryBuilder entry, XmlReader xml) { DictionarySense sense = new DictionarySense(); while (xml.Read()) { if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "trans") break; if (xml.NodeType == XmlNodeType.Element) { if (xml.Name == "trans_det") { string lang = xml.GetAttribute("xml:lang"); if (lang == "eng") lang = null; string value = xml.ReadString(); sense.addGloss(lang, value); } else { switch (xml.Name) { case "name_type": entry.nameType = fromEntity(xml); break; } } } } entry.addSense(sense, 1.0, 1.0); }
private void readSense(EdictEntryBuilder entry, XmlReader xml) { DictionarySense sense = new DictionarySense(); double globalMult = 1.0; double kanaMult = 0.8; while (xml.Read()) { if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "sense") break; if (xml.NodeType == XmlNodeType.Element) { if (xml.Name == "gloss") { string lang = xml.GetAttribute("xml:lang"); if (lang == "eng") lang = null; string value = xml.ReadString(); sense.addGloss(lang, value); } else { switch (xml.Name) { case "pos": entry.addPOS(fromEntity(xml)); break; case "field": case "misc": case "dial": string v = fromEntity(xml); adjustMultipliers(v, ref globalMult, ref kanaMult); sense.addMisc(v); break; } } } } entry.addSense(sense, globalMult, kanaMult); }
public void addUserName(string key, string sense, string nameType) { lock (this) { Settings.app.removeBannedWord(key); EdictMatch match = new EdictMatch(key); EdictEntryBuilder eb = new EdictEntryBuilder(); eb.addKanji(new DictionaryKeyBuilder(key)); eb.addKana(new DictionaryKeyBuilder(sense)); DictionarySense ds = new DictionarySense(); ds.addGloss(null, sense); eb.addSense(ds); if (nameType != "notname") { eb.addPOS("name"); } else { eb.addPOS("n"); } eb.nameType = nameType; match.addEntry(new RatedEntry { entry = eb.build(), rate = 5.0F }); userNames[key] = match; this.isDirty = true; } }