Example #1
0
        public int CompareTo(object obj)
        {
            XDictEntry that = obj as XDictEntry;

            if (that == null)
            {
                return(-1);
            }
            return(this.Word.CompareTo(that.Word));
        }
Example #2
0
        void ParseUnzipped(Stream s, XDict dict)
        {
            while (true)
            {
                BglBlock block = BglBlock.Read(s);
                if (block == null)
                {
                    break;
                }

                if (block.Type == 1 || block.Type == 10)
                {
                    XDictEntry e = ParseEntry(block);
                    dict.AddEntry(e);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Override to provide custom parsing of BGL fields, e.g.
        /// break up into multiple definitions, PartOfSpeech extraction etc.
        ///
        /// Different BGL sources may use different conventions.
        /// </summary>
        /// <param name="head"></param>
        /// <param name="def"></param>
        /// <param name="alternates"></param>
        /// <returns></returns>
        protected virtual XDictEntry CreateEntry(String head, String def, List <String> alternates)
        {
            XDictEntry entry = new XDictEntry(new XWordInfo(head));

            // TODO: Break up into multiple defs, PartOfSpeech parsing etc.
            if (!String.IsNullOrEmpty(def))
            {
                XWordInfo defWi = new XWordInfo(def);
                entry.Definitions.Add(defWi);
            }

            foreach (String alt in alternates)
            {
                // These are odd. In one of the sources,
                // for "Austen", alt is "Jane" for "hang", it's "draw", "and quarter"
                // Might depend on the source.
                XWordInfo wi = new XWordInfo(alt);
                entry.Comments.Add(wi);
            }

            return(entry);
        }
Example #4
0
 /// <summary>
 /// Add an entry to the dictionary and index
 /// </summary>
 /// <param name="entry"></param>
 public void AddEntry(XDictEntry entry)
 {
     Entries.Add(entry);
     _index.Add(entry.Word.Text, entry);
 }
Example #5
0
 /// <summary>
 /// Add an entry to the dictionary and index
 /// </summary>
 /// <param name="entry"></param>
 public void AddEntry(XDictEntry entry)
 {
     Entries.Add(entry);
     _index.Add(entry.Word.Text, entry);
 }
        /// <summary>
        /// Override to provide custom parsing of BGL fields, e.g.
        /// break up into multiple definitions, PartOfSpeech extraction etc.
        /// 
        /// Different BGL sources may use different conventions.
        /// </summary>
        /// <param name="head"></param>
        /// <param name="def"></param>
        /// <param name="alternates"></param>
        /// <returns></returns>
        protected virtual XDictEntry CreateEntry(String head, String def, List<String> alternates)
        {
            XDictEntry entry = new XDictEntry(new XWordInfo(head));

            // TODO: Break up into multiple defs, PartOfSpeech parsing etc.
            if (!String.IsNullOrEmpty(def))
            {
                XWordInfo defWi = new XWordInfo(def);
                entry.Definitions.Add(defWi);
            }

            foreach (String alt in alternates)
            {
                // These are odd. In one of the sources, 
                // for "Austen", alt is "Jane" for "hang", it's "draw", "and quarter"
                // Might depend on the source.
                XWordInfo wi = new XWordInfo(alt);
                entry.Comments.Add(wi);
            }

            return entry;
        }