public void AddSegmentPair(IReadOnlyList <string> sourceSegment, IReadOnlyList <string> targetSegment, WordAlignmentMatrix hintMatrix = null) { CheckDisposed(); IntPtr nativeSourceSegment = Thot.ConvertStringsToNativeUtf8(sourceSegment); IntPtr nativeTargetSegment = Thot.ConvertStringsToNativeUtf8(targetSegment); IntPtr nativeMatrix = IntPtr.Zero; uint iLen = 0, jLen = 0; if (hintMatrix != null) { nativeMatrix = Thot.ConvertWordAlignmentMatrixToNativeMatrix(hintMatrix); iLen = (uint)hintMatrix.RowCount; jLen = (uint)hintMatrix.ColumnCount; } try { Thot.swAlignModel_addSentencePair(Handle, nativeSourceSegment, nativeTargetSegment, nativeMatrix, iLen, jLen); } finally { Thot.FreeNativeMatrix(nativeMatrix, iLen); Marshal.FreeHGlobal(nativeTargetSegment); Marshal.FreeHGlobal(nativeSourceSegment); } }
public void AddSegmentPair(IReadOnlyList <string> sourceSegment, IReadOnlyList <string> targetSegment) { CheckDisposed(); IntPtr nativeSourceSegment = Thot.ConvertStringsToNativeUtf8(sourceSegment); IntPtr nativeTargetSegment = Thot.ConvertStringsToNativeUtf8(targetSegment); try { Thot.swAlignModel_addSentencePair(Handle, nativeSourceSegment, nativeTargetSegment); } finally { Marshal.FreeHGlobal(nativeTargetSegment); Marshal.FreeHGlobal(nativeSourceSegment); } }