示例#1
0
        public ParseResult(ParseInput input, ParseRange range, FacetMoniker facetMoniker, double relevance,
                           bool isSuggestion = false)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (range == null)
            {
                throw new ArgumentNullException("range");
            }

            if (facetMoniker == null)
            {
                throw new ArgumentNullException("facetMoniker");
            }

            if (relevance < 0 || relevance > 1)
            {
                throw new ArgumentOutOfRangeException("relevance", "must be between 0 and 1, inclusive");
            }

            Input           = input;
            Range           = range;
            CompressedRange = input.ToCompressed(Range);
            FacetMoniker    = facetMoniker;
            Relevance       = relevance;
            IsSuggestion    = isSuggestion;
        }
示例#2
0
 internal ParseInputTerm(ParseInput input, int ordinal, string text, int startIndex, TermParseMode mode)
 {
     Input     = input;
     Ordinal   = ordinal;
     Text      = text;
     TextLower = Text.ToLower();
     Mode      = mode;
     _range    = new ParseRange(startIndex, text.Length);
 }
示例#3
0
 public ParseRange FromCompressed(ParseRange compressedRange)
 {
     return(ParseRange.FromIndexes(
                FromCompressed(compressedRange.StartIndex),
                FromCompressed(compressedRange.EndIndex)));
 }
示例#4
0
 public string GetTextForRange(ParseRange range)
 {
     return(Text.Substring(range.StartIndex, range.Length));
 }
示例#5
0
 public ParseRange ToCompressed(ParseRange originalRange)
 {
     return(ParseRange.FromIndexes(
                ToCompressed(originalRange.StartIndex),
                ToCompressed(originalRange.EndIndex)));
 }