コード例 #1
0
 public void TranslateInteractively_TranslationCorrect()
 {
     using (var smtModel = new ThotSmtModel(TestHelpers.ToyCorpusConfigFileName))
         using (IInteractiveSmtEngine engine = smtModel.CreateInteractiveEngine())
             using (IInteractiveTranslationSession session = engine.TranslateInteractively(1,
                                                                                           "me marcho hoy por la tarde .".Split()))
             {
                 TranslationResult result = session.CurrentResults[0];
                 Assert.That(result.TargetSegment, Is.EqualTo("i leave today in the afternoon .".Split()));
             }
 }
コード例 #2
0
 public void SetPrefix_MissingWord_TranslationCorrect()
 {
     using (var smtModel = new ThotSmtModel(TestHelpers.ToyCorpusConfigFileName))
         using (IInteractiveSmtEngine engine = smtModel.CreateInteractiveEngine())
             using (IInteractiveTranslationSession session = engine.TranslateInteractively(1,
                                                                                           "caminé a mi habitación .".Split()))
             {
                 TranslationResult result = session.CurrentResults[0];
                 Assert.That(result.TargetSegment, Is.EqualTo("caminé to my room .".Split()));
                 result = session.SetPrefix("i walked".Split(), true)[0];
                 Assert.That(result.TargetSegment, Is.EqualTo("i walked to my room .".Split()));
             }
 }
コード例 #3
0
        public void Approve_TwoSegmentsUnknownWord_LearnsUnknownWord()
        {
            using (var smtModel = new ThotSmtModel(TestHelpers.ToyCorpusConfigFileName))
                using (IInteractiveSmtEngine engine = smtModel.CreateInteractiveEngine())
                {
                    using (IInteractiveTranslationSession session = engine.TranslateInteractively(1,
                                                                                                  "hablé con recepción .".Split()))
                    {
                        TranslationResult result = session.CurrentResults[0];
                        Assert.That(result.TargetSegment, Is.EqualTo("hablé with reception .".Split()));
                        result = session.SetPrefix("i talked".Split(), true)[0];
                        Assert.That(result.TargetSegment, Is.EqualTo("i talked with reception .".Split()));
                        session.SetPrefix("i talked with reception .".Split(), true);
                        session.Approve();
                    }

                    using (IInteractiveTranslationSession session = engine.TranslateInteractively(1,
                                                                                                  "hablé hasta cinco en punto .".Split()))
                    {
                        TranslationResult result = session.CurrentResults[0];
                        Assert.That(result.TargetSegment, Is.EqualTo("talked until five o ' clock .".Split()));
                    }
                }
        }