private SearchResult CreateSearchResult(Segment segment, Segment translation)
        {
            var tu = new TranslationUnit
            {
                SourceSegment = segment.Duplicate(),                //this makes the original source segment, with tags, appear in the search window
                TargetSegment = translation ?? new Segment()
            };

            tu.ResourceId = new PersistentObjectToken(tu.GetHashCode(), Guid.Empty);

            const int score = 0;             //score to 0...change if needed to support scoring

            tu.Origin = TranslationUnitOrigin.Nmt;

            var searchResult = new SearchResult(tu)
            {
                ScoringResult = new ScoringResult
                {
                    BaseScore = score
                },
                TranslationProposal = tu
            };

            tu.ConfirmationLevel = ConfirmationLevel.Draft;

            return(searchResult);
        }
예제 #2
0
        /// <summary>
        /// Creates a consumable SearchResult using the source segment and translated segment
        /// </summary>
        /// <param name="searchSegment"></param>
        /// <param name="translation"></param>
        /// <param name="sourceSegment"></param>
        /// <returns></returns>
        private static SearchResult CreateSearchResult(Segment searchSegment, Segment translation)
        {
            _logger.Trace("");
            var unit = new TranslationUnit
            {
                SourceSegment     = searchSegment,
                TargetSegment     = translation,
                ConfirmationLevel = ConfirmationLevel.Translated,
                Origin            = TranslationUnitOrigin.Nmt
            };

            unit.ResourceId = new PersistentObjectToken(unit.GetHashCode(), Guid.Empty);
            var searchResult = new SearchResult(unit);

            // We do not currently support scoring, so always say that we're 25% sure on this translation.
            searchResult.ScoringResult = new ScoringResult()
            {
                BaseScore = 25
            };

            return(searchResult);
        }