public void AddSegmentPair(IReadOnlyList <string> sourceSegment, IReadOnlyList <string> targetSegment, WordAlignmentMatrix hintMatrix = null) { _directWordAlignmentModel.AddSegmentPair(sourceSegment, targetSegment, hintMatrix); WordAlignmentMatrix invertedHintMatrix = hintMatrix?.Clone(); invertedHintMatrix?.Transpose(); _inverseWordAlignmentModel.AddSegmentPair(targetSegment, sourceSegment, invertedHintMatrix); }
public WordAlignmentMatrix GetBestAlignment(IReadOnlyList <string> sourceSegment, IReadOnlyList <string> targetSegment) { WordAlignmentMatrix matrix = _srcTrgAligner.GetBestAlignment(sourceSegment, targetSegment); WordAlignmentMatrix invMatrix = _trgSrcAligner.GetBestAlignment(targetSegment, sourceSegment); invMatrix.Transpose(); matrix.SymmetrizeWith(invMatrix); return(matrix); }
public WordAlignmentMatrix GetBestAlignment(IReadOnlyList <string> sourceSegment, IReadOnlyList <string> targetSegment, WordAlignmentMatrix hintMatrix = null) { WordAlignmentMatrix matrix = _srcTrgAligner.GetBestAlignment(sourceSegment, targetSegment, hintMatrix); WordAlignmentMatrix invHintMatrix = null; if (hintMatrix != null) { invHintMatrix = hintMatrix.Clone(); invHintMatrix.Transpose(); } WordAlignmentMatrix invMatrix = _trgSrcAligner.GetBestAlignment(targetSegment, sourceSegment, invHintMatrix); invMatrix.Transpose(); matrix.SymmetrizeWith(invMatrix); return(matrix); }