示例#1
0
        public int CompareTo(object obj)
        {
            XWordInfo that = obj as XWordInfo;

            if (that == null)
            {
                return(-1);
            }

            return(this.Text.CompareTo(that.Text));
        }
示例#2
0
        public string ToShortString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Word.Text);
            if (Word.PartOfSpeechSpeficied)
            {
                sb.Append("/" + Word.PartOfSpeech);
            }

            XWordInfo wi = FirstTranslation;

            if (wi != null)
            {
                sb.Append(" -> " + wi.Text);
            }

            return(sb.ToString());
        }
示例#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);
        }
        /// <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;
        }
示例#5
0
 public XDictEntry(XWordInfo word)
 {
     Word = word;
 }
示例#6
0
 public XDictEntry(XWordInfo word)
 {
     Word = word;
 }