Beispiel #1
0
        private void addToIndex(IDictionary <string, EdictMatch> dict, string key, double rate, EdictEntry entry)
        {
            if (key.Length > maxKeyLength)
            {
                return;
            }
            if (key.Length == 0)
            {
                rate = 1.5;
            }
            EdictMatch entries;
            RatedEntry newEntry = new RatedEntry {
                entry = entry, rate = (float)rate
            };

            if (dict.TryGetValue(key, out entries))
            {
                entries.addEntry(newEntry);
            }
            else
            {
                entries = new EdictMatch(key);
                entries.addEntry(newEntry);
                dict.Add(key, entries);
            }
        }
Beispiel #2
0
 private void addToIndex(IDictionary<string, EdictMatch> dict, string key, double rate, EdictEntry entry)
 {
     if (key.Length > maxKeyLength) {
         return;
     }
     if (key.Length == 0) {
         rate = 1.5;
     }
     EdictMatch entries;
     RatedEntry newEntry = new RatedEntry { entry = entry, rate = (float)rate };
     if (dict.TryGetValue(key, out entries)) {
         entries.addEntry(newEntry);
     } else {
         entries = new EdictMatch(key);
         entries.addEntry(newEntry);
         dict.Add(key, entries);
     }
 }
Beispiel #3
0
 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;
     }
 }