public static WordAlignmentMatrix GetBestAlignment(this ISegmentAligner aligner, ParallelTextSegment segment, Func <string, string> sourcePreprocessor = null, Func <string, string> targetPreprocessor = null) { IReadOnlyList <string> sourceSegment = segment.SourceSegment.Preprocess(sourcePreprocessor); IReadOnlyList <string> targetSegment = segment.TargetSegment.Preprocess(targetPreprocessor); return(aligner.GetBestAlignment(sourceSegment, targetSegment, segment.CreateAlignmentMatrix())); }
public ThotSmtEngine(ThotSmtModel smtModel) { _smtModel = smtModel; _sessions = new HashSet <ThotInteractiveTranslationSession>(); LoadHandle(); _segmentAligner = new FuzzyEditDistanceSegmentAligner(GetTranslationProbability); _confidenceEstimator = new Ibm1WordConfidenceEstimator(GetTranslationProbability); //_confidenceEstimator = new WppWordConfidenceEstimator(this); ErrorCorrectionModel = new ErrorCorrectionModel(); }
public static string GetGizaFormatString(this ISegmentAligner aligner, ParallelTextSegment segment, Func <string, string> sourcePreprocessor = null, Func <string, string> targetPreprocessor = null, bool isUnknown = true) { IReadOnlyList <string> sourceSegment = segment.SourceSegment.Preprocess(sourcePreprocessor); IReadOnlyList <string> targetSegment = segment.TargetSegment.Preprocess(targetPreprocessor); WordAlignmentMatrix alignment = aligner.GetBestAlignment(sourceSegment, targetSegment, segment.CreateAlignmentMatrix(isUnknown)); return(alignment.ToGizaFormat(sourceSegment, targetSegment)); }
public static WordAlignmentMatrix GetBestAlignment(this ISegmentAligner aligner, IReadOnlyList <string> sourceSegment, IReadOnlyList <string> targetSegment, WordAlignmentMatrix knownAlignment) { WordAlignmentMatrix estimatedAlignment = aligner.GetBestAlignment(sourceSegment, targetSegment); WordAlignmentMatrix alignment = estimatedAlignment; if (knownAlignment != null) { alignment = knownAlignment.Clone(); alignment.PrioritySymmetrizeWith(estimatedAlignment); } return(alignment); }
public SymmetrizedSegmentAligner(ISegmentAligner srcTrgAligner, ISegmentAligner trgSrcAligner) { _srcTrgAligner = srcTrgAligner; _trgSrcAligner = trgSrcAligner; }